Fossil SCM

Remove a temporary refactoring crutch. Replace what is currenty believed to be the last of the accordions with details/summary tags.

stephan 2026-11-13 13:09 UTC accordion-rework
Commit d1f8e800b4a9f05018f504c0ee2516aa055404a852679e0878a5a812fdf2c56e
3 files changed +7 -6 +1 -2 +2 -16
+7 -6
--- src/backlink.c
+++ src/backlink.c
@@ -26,10 +26,11 @@
2626
#include <assert.h>
2727
2828
2929
/*
3030
** Show a graph of all wiki, tickets, and check-ins that refer to object zUuid.
31
+** If there are none, emit no output.
3132
**
3233
** If zLabel is not NULL and the graph is not empty, then output zLabel as
3334
** a prefix to the graph.
3435
*/
3536
void render_backlink_graph(const char *zUuid, const char *zLabel){
@@ -49,27 +50,27 @@
4950
" FROM backlink\n"
5051
" WHERE target GLOB %Q"
5152
" AND %Q GLOB (target || '*');",
5253
zGlob, zUuid
5354
);
55
+ fossil_free(zGlob);
5456
if( !db_exists("SELECT 1 FROM ok") ) return;
5557
if( zLabel ){
56
- cgi_printf("%s", zLabel);
57
- if( strstr(zLabel, "accordion")!=0 ){
58
- cgi_printf("<div class=\"accordion_panel\">\n");
59
- needEndPanel = 1;
60
- }
58
+ cgi_printf("<details open>"
59
+ "<summary class='section'>%h</summary>"
60
+ "<div class=\"accordion_panel\">", zLabel);
61
+ needEndPanel = 1;
6162
}
6263
blob_zero(&sql);
6364
blob_append(&sql, timeline_query_for_www(), -1);
6465
blob_append_sql(&sql, " AND event.objid IN ok ORDER BY mtime DESC");
6566
db_prepare(&q, "%s", blob_sql_text(&sql));
6667
www_print_timeline(&q,
6768
TIMELINE_DISJOINT|TIMELINE_GRAPH|TIMELINE_NOSCROLL|TIMELINE_REFS, 0);
6869
db_finalize(&q);
6970
if( needEndPanel ){
70
- cgi_printf("</div>\n");
71
+ cgi_printf("</div></details>\n");
7172
}
7273
}
7374
7475
/*
7576
** WEBPAGE: test-backlink-timeline
7677
--- src/backlink.c
+++ src/backlink.c
@@ -26,10 +26,11 @@
26 #include <assert.h>
27
28
29 /*
30 ** Show a graph of all wiki, tickets, and check-ins that refer to object zUuid.
 
31 **
32 ** If zLabel is not NULL and the graph is not empty, then output zLabel as
33 ** a prefix to the graph.
34 */
35 void render_backlink_graph(const char *zUuid, const char *zLabel){
@@ -49,27 +50,27 @@
49 " FROM backlink\n"
50 " WHERE target GLOB %Q"
51 " AND %Q GLOB (target || '*');",
52 zGlob, zUuid
53 );
 
54 if( !db_exists("SELECT 1 FROM ok") ) return;
55 if( zLabel ){
56 cgi_printf("%s", zLabel);
57 if( strstr(zLabel, "accordion")!=0 ){
58 cgi_printf("<div class=\"accordion_panel\">\n");
59 needEndPanel = 1;
60 }
61 }
62 blob_zero(&sql);
63 blob_append(&sql, timeline_query_for_www(), -1);
64 blob_append_sql(&sql, " AND event.objid IN ok ORDER BY mtime DESC");
65 db_prepare(&q, "%s", blob_sql_text(&sql));
66 www_print_timeline(&q,
67 TIMELINE_DISJOINT|TIMELINE_GRAPH|TIMELINE_NOSCROLL|TIMELINE_REFS, 0);
68 db_finalize(&q);
69 if( needEndPanel ){
70 cgi_printf("</div>\n");
71 }
72 }
73
74 /*
75 ** WEBPAGE: test-backlink-timeline
76
--- src/backlink.c
+++ src/backlink.c
@@ -26,10 +26,11 @@
26 #include <assert.h>
27
28
29 /*
30 ** Show a graph of all wiki, tickets, and check-ins that refer to object zUuid.
31 ** If there are none, emit no output.
32 **
33 ** If zLabel is not NULL and the graph is not empty, then output zLabel as
34 ** a prefix to the graph.
35 */
36 void render_backlink_graph(const char *zUuid, const char *zLabel){
@@ -49,27 +50,27 @@
50 " FROM backlink\n"
51 " WHERE target GLOB %Q"
52 " AND %Q GLOB (target || '*');",
53 zGlob, zUuid
54 );
55 fossil_free(zGlob);
56 if( !db_exists("SELECT 1 FROM ok") ) return;
57 if( zLabel ){
58 cgi_printf("<details open>"
59 "<summary class='section'>%h</summary>"
60 "<div class=\"accordion_panel\">", zLabel);
61 needEndPanel = 1;
 
62 }
63 blob_zero(&sql);
64 blob_append(&sql, timeline_query_for_www(), -1);
65 blob_append_sql(&sql, " AND event.objid IN ok ORDER BY mtime DESC");
66 db_prepare(&q, "%s", blob_sql_text(&sql));
67 www_print_timeline(&q,
68 TIMELINE_DISJOINT|TIMELINE_GRAPH|TIMELINE_NOSCROLL|TIMELINE_REFS, 0);
69 db_finalize(&q);
70 if( needEndPanel ){
71 cgi_printf("</div></details>\n");
72 }
73 }
74
75 /*
76 ** WEBPAGE: test-backlink-timeline
77
+1 -2
--- src/info.c
+++ src/info.c
@@ -1274,12 +1274,11 @@
12741274
db_finalize(&q1);
12751275
@ </details>
12761276
if( !PB("nowiki") ){
12771277
wiki_render_associated("checkin", zUuid, 0);
12781278
}
1279
- render_backlink_graph(zUuid,
1280
- "<div class=\"section accordion\">References</div>\n");
1279
+ render_backlink_graph(zUuid, "References");
12811280
@ <details open><summary class="section">Context</summary>
12821281
@ <div class="accordion_panel">
12831282
render_checkin_context(rid, 0, 2, 0);
12841283
@ </div></details>
12851284
@ <details open>
12861285
--- src/info.c
+++ src/info.c
@@ -1274,12 +1274,11 @@
1274 db_finalize(&q1);
1275 @ </details>
1276 if( !PB("nowiki") ){
1277 wiki_render_associated("checkin", zUuid, 0);
1278 }
1279 render_backlink_graph(zUuid,
1280 "<div class=\"section accordion\">References</div>\n");
1281 @ <details open><summary class="section">Context</summary>
1282 @ <div class="accordion_panel">
1283 render_checkin_context(rid, 0, 2, 0);
1284 @ </div></details>
1285 @ <details open>
1286
--- src/info.c
+++ src/info.c
@@ -1274,12 +1274,11 @@
1274 db_finalize(&q1);
1275 @ </details>
1276 if( !PB("nowiki") ){
1277 wiki_render_associated("checkin", zUuid, 0);
1278 }
1279 render_backlink_graph(zUuid, "References");
 
1280 @ <details open><summary class="section">Context</summary>
1281 @ <div class="accordion_panel">
1282 render_checkin_context(rid, 0, 2, 0);
1283 @ </div></details>
1284 @ <details open>
1285
+2 -16
--- src/wiki.c
+++ src/wiki.c
@@ -2538,24 +2538,10 @@
25382538
static void wiki_section_label(
25392539
const char *zPrefix, /* "branch", "tag", or "checkin" */
25402540
const char *zName, /* Name of the object */
25412541
unsigned int mFlags /* Zero or more WIKIASSOC_* flags */
25422542
){
2543
- if( (mFlags & WIKIASSOC_FULL_TITLE)==0 ){
2544
- @ <div class="section accordion">About</div>
2545
- }else if( zPrefix[0]=='c' ){ /* checkin/... */
2546
- @ <div class="section accordion">About check-in %.20h(zName)</div>
2547
- }else{
2548
- @ <div class="section accordion">About %s(zPrefix) %h(zName)</div>
2549
- }
2550
-}
2551
-/* Temporary refactoring crutch */
2552
-static void wiki_section_label_v2(
2553
- const char *zPrefix, /* "branch", "tag", or "checkin" */
2554
- const char *zName, /* Name of the object */
2555
- unsigned int mFlags /* Zero or more WIKIASSOC_* flags */
2556
-){
25572543
if( (mFlags & WIKIASSOC_FULL_TITLE)==0 ){
25582544
@ <summary class="section">About</summary>
25592545
}else if( zPrefix[0]=='c' ){ /* checkin/... */
25602546
@ <summary class="section accordion">About check-in %.20h(zName)</summary>
25612547
}else{
@@ -2629,11 +2615,11 @@
26292615
blob_init(&markdown, pWiki->zWiki, -1);
26302616
markdown_to_html(&markdown, &title, &tail);
26312617
if( blob_size(&title) ){
26322618
@ <summary class="section">%h(blob_str(&title))</summary>
26332619
}else{
2634
- wiki_section_label_v2(zPrefix, zName, mFlags);
2620
+ wiki_section_label(zPrefix, zName, mFlags);
26352621
}
26362622
wiki_submenu_to_read_wiki(zPrefix, zName, mFlags);
26372623
wiki_submenu_to_edit_wiki(zPrefix, zName, mFlags);
26382624
@ <div class="accordion_panel">
26392625
safe_html_context(DOCSRC_WIKI);
@@ -2657,11 +2643,11 @@
26572643
blob_init(&wiki, pWiki->zWiki, -1);
26582644
if( wiki_find_title(&wiki, &title, &tail) ){
26592645
@ <summary class="section">%h(blob_str(&title))</summary>
26602646
pBody = &tail;
26612647
}else{
2662
- wiki_section_label_v2(zPrefix, zName, mFlags);
2648
+ wiki_section_label(zPrefix, zName, mFlags);
26632649
pBody = &wiki;
26642650
}
26652651
wiki_submenu_to_edit_wiki(zPrefix, zName, mFlags);
26662652
@ <div class="accordion_panel"><div class="wiki">
26672653
wiki_convert(pBody, 0, WIKI_BUTTONS);
26682654
--- src/wiki.c
+++ src/wiki.c
@@ -2538,24 +2538,10 @@
2538 static void wiki_section_label(
2539 const char *zPrefix, /* "branch", "tag", or "checkin" */
2540 const char *zName, /* Name of the object */
2541 unsigned int mFlags /* Zero or more WIKIASSOC_* flags */
2542 ){
2543 if( (mFlags & WIKIASSOC_FULL_TITLE)==0 ){
2544 @ <div class="section accordion">About</div>
2545 }else if( zPrefix[0]=='c' ){ /* checkin/... */
2546 @ <div class="section accordion">About check-in %.20h(zName)</div>
2547 }else{
2548 @ <div class="section accordion">About %s(zPrefix) %h(zName)</div>
2549 }
2550 }
2551 /* Temporary refactoring crutch */
2552 static void wiki_section_label_v2(
2553 const char *zPrefix, /* "branch", "tag", or "checkin" */
2554 const char *zName, /* Name of the object */
2555 unsigned int mFlags /* Zero or more WIKIASSOC_* flags */
2556 ){
2557 if( (mFlags & WIKIASSOC_FULL_TITLE)==0 ){
2558 @ <summary class="section">About</summary>
2559 }else if( zPrefix[0]=='c' ){ /* checkin/... */
2560 @ <summary class="section accordion">About check-in %.20h(zName)</summary>
2561 }else{
@@ -2629,11 +2615,11 @@
2629 blob_init(&markdown, pWiki->zWiki, -1);
2630 markdown_to_html(&markdown, &title, &tail);
2631 if( blob_size(&title) ){
2632 @ <summary class="section">%h(blob_str(&title))</summary>
2633 }else{
2634 wiki_section_label_v2(zPrefix, zName, mFlags);
2635 }
2636 wiki_submenu_to_read_wiki(zPrefix, zName, mFlags);
2637 wiki_submenu_to_edit_wiki(zPrefix, zName, mFlags);
2638 @ <div class="accordion_panel">
2639 safe_html_context(DOCSRC_WIKI);
@@ -2657,11 +2643,11 @@
2657 blob_init(&wiki, pWiki->zWiki, -1);
2658 if( wiki_find_title(&wiki, &title, &tail) ){
2659 @ <summary class="section">%h(blob_str(&title))</summary>
2660 pBody = &tail;
2661 }else{
2662 wiki_section_label_v2(zPrefix, zName, mFlags);
2663 pBody = &wiki;
2664 }
2665 wiki_submenu_to_edit_wiki(zPrefix, zName, mFlags);
2666 @ <div class="accordion_panel"><div class="wiki">
2667 wiki_convert(pBody, 0, WIKI_BUTTONS);
2668
--- src/wiki.c
+++ src/wiki.c
@@ -2538,24 +2538,10 @@
2538 static void wiki_section_label(
2539 const char *zPrefix, /* "branch", "tag", or "checkin" */
2540 const char *zName, /* Name of the object */
2541 unsigned int mFlags /* Zero or more WIKIASSOC_* flags */
2542 ){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2543 if( (mFlags & WIKIASSOC_FULL_TITLE)==0 ){
2544 @ <summary class="section">About</summary>
2545 }else if( zPrefix[0]=='c' ){ /* checkin/... */
2546 @ <summary class="section accordion">About check-in %.20h(zName)</summary>
2547 }else{
@@ -2629,11 +2615,11 @@
2615 blob_init(&markdown, pWiki->zWiki, -1);
2616 markdown_to_html(&markdown, &title, &tail);
2617 if( blob_size(&title) ){
2618 @ <summary class="section">%h(blob_str(&title))</summary>
2619 }else{
2620 wiki_section_label(zPrefix, zName, mFlags);
2621 }
2622 wiki_submenu_to_read_wiki(zPrefix, zName, mFlags);
2623 wiki_submenu_to_edit_wiki(zPrefix, zName, mFlags);
2624 @ <div class="accordion_panel">
2625 safe_html_context(DOCSRC_WIKI);
@@ -2657,11 +2643,11 @@
2643 blob_init(&wiki, pWiki->zWiki, -1);
2644 if( wiki_find_title(&wiki, &title, &tail) ){
2645 @ <summary class="section">%h(blob_str(&title))</summary>
2646 pBody = &tail;
2647 }else{
2648 wiki_section_label(zPrefix, zName, mFlags);
2649 pBody = &wiki;
2650 }
2651 wiki_submenu_to_edit_wiki(zPrefix, zName, mFlags);
2652 @ <div class="accordion_panel"><div class="wiki">
2653 wiki_convert(pBody, 0, WIKI_BUTTONS);
2654

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button