Fossil SCM

Get /vinfo's About view ported to a DETAILS tag, collapsed by default.

stephan 2026-11-13 12:09 UTC accordion-rework
Commit 5628e2c9eddecfeb783b15d3a3de38950dcfae089999f18731c95e6ba0281f2b
2 files changed +4 -1 +21 -4
+4 -1
--- src/default.css
+++ src/default.css
@@ -1244,13 +1244,16 @@
12441244
display: none;
12451245
}
12461246
.accordion_closed > .accordion_btn_plus {
12471247
display: inline-block;
12481248
}
1249
-.accordion_panel {
1249
+.accordion_panel, details > div {
12501250
overflow-y: clip;
12511251
transition: max-height 0.25s ease-out;
1252
+}
1253
+details > summary.section {
1254
+ cursor: pointer;
12521255
}
12531256
.error {
12541257
color: darkred;
12551258
background: yellow;
12561259
}
12571260
--- src/default.css
+++ src/default.css
@@ -1244,13 +1244,16 @@
1244 display: none;
1245 }
1246 .accordion_closed > .accordion_btn_plus {
1247 display: inline-block;
1248 }
1249 .accordion_panel {
1250 overflow-y: clip;
1251 transition: max-height 0.25s ease-out;
 
 
 
1252 }
1253 .error {
1254 color: darkred;
1255 background: yellow;
1256 }
1257
--- src/default.css
+++ src/default.css
@@ -1244,13 +1244,16 @@
1244 display: none;
1245 }
1246 .accordion_closed > .accordion_btn_plus {
1247 display: inline-block;
1248 }
1249 .accordion_panel, details > div {
1250 overflow-y: clip;
1251 transition: max-height 0.25s ease-out;
1252 }
1253 details > summary.section {
1254 cursor: pointer;
1255 }
1256 .error {
1257 color: darkred;
1258 background: yellow;
1259 }
1260
+21 -4
--- src/wiki.c
+++ src/wiki.c
@@ -2527,10 +2527,11 @@
25272527
#if INTERFACE
25282528
#define WIKIASSOC_FULL_TITLE 0x00001 /* Full title */
25292529
#define WIKIASSOC_MENU_READ 0x00002 /* Add submenu link to read wiki */
25302530
#define WIKIASSOC_MENU_WRITE 0x00004 /* Add submenu link to add wiki */
25312531
#define WIKIASSOC_ALL 0x00007 /* All of the above */
2532
+#define WIKIASSOC_REVEAL 0x00008 /* Reveal content by default */
25322533
#endif
25332534
25342535
/*
25352536
** Show the default Section label for an associated wiki page.
25362537
*/
@@ -2544,10 +2545,24 @@
25442545
}else if( zPrefix[0]=='c' ){ /* checkin/... */
25452546
@ <div class="section accordion">About check-in %.20h(zName)</div>
25462547
}else{
25472548
@ <div class="section accordion">About %s(zPrefix) %h(zName)</div>
25482549
}
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{
2562
+ @ <summary class="section accordion">About %s(zPrefix) %h(zName)</summary>
2563
+ }
25492564
}
25502565
25512566
/*
25522567
** Add an "Wiki" button in a submenu that links to the read-wiki page.
25532568
*/
@@ -2604,20 +2619,21 @@
26042619
style_submenu_element("Add Wiki", "%R/wikiedit?name=%s/%t",
26052620
zPrefix, zName);
26062621
}
26072622
return 0;
26082623
}
2624
+ @ <details %s((WIKIASSOC_REVEAL & mFlags) ? "open" : "")>
26092625
if( fossil_strcmp(pWiki->zMimetype, "text/x-markdown")==0 ){
26102626
Blob tail = BLOB_INITIALIZER;
26112627
Blob title = BLOB_INITIALIZER;
26122628
Blob markdown;
26132629
blob_init(&markdown, pWiki->zWiki, -1);
26142630
markdown_to_html(&markdown, &title, &tail);
26152631
if( blob_size(&title) ){
2616
- @ <div class="section accordion">%h(blob_str(&title))</div>
2632
+ @ <summary class="section">%h(blob_str(&title))</summary>
26172633
}else{
2618
- wiki_section_label(zPrefix, zName, mFlags);
2634
+ wiki_section_label_v2(zPrefix, zName, mFlags);
26192635
}
26202636
wiki_submenu_to_read_wiki(zPrefix, zName, mFlags);
26212637
wiki_submenu_to_edit_wiki(zPrefix, zName, mFlags);
26222638
@ <div class="accordion_panel">
26232639
safe_html_context(DOCSRC_WIKI);
@@ -2638,14 +2654,14 @@
26382654
Blob title = BLOB_INITIALIZER;
26392655
Blob wiki;
26402656
Blob *pBody;
26412657
blob_init(&wiki, pWiki->zWiki, -1);
26422658
if( wiki_find_title(&wiki, &title, &tail) ){
2643
- @ <div class="section accordion">%h(blob_str(&title))</div>
2659
+ @ <summary class="section">%h(blob_str(&title))</summary>
26442660
pBody = &tail;
26452661
}else{
2646
- wiki_section_label(zPrefix, zName, mFlags);
2662
+ wiki_section_label_v2(zPrefix, zName, mFlags);
26472663
pBody = &wiki;
26482664
}
26492665
wiki_submenu_to_edit_wiki(zPrefix, zName, mFlags);
26502666
@ <div class="accordion_panel"><div class="wiki">
26512667
wiki_convert(pBody, 0, WIKI_BUTTONS);
@@ -2652,9 +2668,10 @@
26522668
@ </div></div>
26532669
blob_reset(&tail);
26542670
blob_reset(&title);
26552671
blob_reset(&wiki);
26562672
}
2673
+ @ </details>
26572674
manifest_destroy(pWiki);
26582675
builtin_request_js("accordion.js");
26592676
return 1;
26602677
}
26612678
--- src/wiki.c
+++ src/wiki.c
@@ -2527,10 +2527,11 @@
2527 #if INTERFACE
2528 #define WIKIASSOC_FULL_TITLE 0x00001 /* Full title */
2529 #define WIKIASSOC_MENU_READ 0x00002 /* Add submenu link to read wiki */
2530 #define WIKIASSOC_MENU_WRITE 0x00004 /* Add submenu link to add wiki */
2531 #define WIKIASSOC_ALL 0x00007 /* All of the above */
 
2532 #endif
2533
2534 /*
2535 ** Show the default Section label for an associated wiki page.
2536 */
@@ -2544,10 +2545,24 @@
2544 }else if( zPrefix[0]=='c' ){ /* checkin/... */
2545 @ <div class="section accordion">About check-in %.20h(zName)</div>
2546 }else{
2547 @ <div class="section accordion">About %s(zPrefix) %h(zName)</div>
2548 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2549 }
2550
2551 /*
2552 ** Add an "Wiki" button in a submenu that links to the read-wiki page.
2553 */
@@ -2604,20 +2619,21 @@
2604 style_submenu_element("Add Wiki", "%R/wikiedit?name=%s/%t",
2605 zPrefix, zName);
2606 }
2607 return 0;
2608 }
 
2609 if( fossil_strcmp(pWiki->zMimetype, "text/x-markdown")==0 ){
2610 Blob tail = BLOB_INITIALIZER;
2611 Blob title = BLOB_INITIALIZER;
2612 Blob markdown;
2613 blob_init(&markdown, pWiki->zWiki, -1);
2614 markdown_to_html(&markdown, &title, &tail);
2615 if( blob_size(&title) ){
2616 @ <div class="section accordion">%h(blob_str(&title))</div>
2617 }else{
2618 wiki_section_label(zPrefix, zName, mFlags);
2619 }
2620 wiki_submenu_to_read_wiki(zPrefix, zName, mFlags);
2621 wiki_submenu_to_edit_wiki(zPrefix, zName, mFlags);
2622 @ <div class="accordion_panel">
2623 safe_html_context(DOCSRC_WIKI);
@@ -2638,14 +2654,14 @@
2638 Blob title = BLOB_INITIALIZER;
2639 Blob wiki;
2640 Blob *pBody;
2641 blob_init(&wiki, pWiki->zWiki, -1);
2642 if( wiki_find_title(&wiki, &title, &tail) ){
2643 @ <div class="section accordion">%h(blob_str(&title))</div>
2644 pBody = &tail;
2645 }else{
2646 wiki_section_label(zPrefix, zName, mFlags);
2647 pBody = &wiki;
2648 }
2649 wiki_submenu_to_edit_wiki(zPrefix, zName, mFlags);
2650 @ <div class="accordion_panel"><div class="wiki">
2651 wiki_convert(pBody, 0, WIKI_BUTTONS);
@@ -2652,9 +2668,10 @@
2652 @ </div></div>
2653 blob_reset(&tail);
2654 blob_reset(&title);
2655 blob_reset(&wiki);
2656 }
 
2657 manifest_destroy(pWiki);
2658 builtin_request_js("accordion.js");
2659 return 1;
2660 }
2661
--- src/wiki.c
+++ src/wiki.c
@@ -2527,10 +2527,11 @@
2527 #if INTERFACE
2528 #define WIKIASSOC_FULL_TITLE 0x00001 /* Full title */
2529 #define WIKIASSOC_MENU_READ 0x00002 /* Add submenu link to read wiki */
2530 #define WIKIASSOC_MENU_WRITE 0x00004 /* Add submenu link to add wiki */
2531 #define WIKIASSOC_ALL 0x00007 /* All of the above */
2532 #define WIKIASSOC_REVEAL 0x00008 /* Reveal content by default */
2533 #endif
2534
2535 /*
2536 ** Show the default Section label for an associated wiki page.
2537 */
@@ -2544,10 +2545,24 @@
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{
2562 @ <summary class="section accordion">About %s(zPrefix) %h(zName)</summary>
2563 }
2564 }
2565
2566 /*
2567 ** Add an "Wiki" button in a submenu that links to the read-wiki page.
2568 */
@@ -2604,20 +2619,21 @@
2619 style_submenu_element("Add Wiki", "%R/wikiedit?name=%s/%t",
2620 zPrefix, zName);
2621 }
2622 return 0;
2623 }
2624 @ <details %s((WIKIASSOC_REVEAL & mFlags) ? "open" : "")>
2625 if( fossil_strcmp(pWiki->zMimetype, "text/x-markdown")==0 ){
2626 Blob tail = BLOB_INITIALIZER;
2627 Blob title = BLOB_INITIALIZER;
2628 Blob markdown;
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);
@@ -2638,14 +2654,14 @@
2654 Blob title = BLOB_INITIALIZER;
2655 Blob wiki;
2656 Blob *pBody;
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);
@@ -2652,9 +2668,10 @@
2668 @ </div></div>
2669 blob_reset(&tail);
2670 blob_reset(&title);
2671 blob_reset(&wiki);
2672 }
2673 @ </details>
2674 manifest_destroy(pWiki);
2675 builtin_request_js("accordion.js");
2676 return 1;
2677 }
2678

Keyboard Shortcuts

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