Fossil SCM

Add more linkage between the speicially named wiki pages and various objects.

drh 2018-12-30 21:37 UTC describe-objects-using-wiki
Commit 42327c67cc6983a301217c8b07ce88310b73923307d1f8be61f0c59beeffc719
3 files changed +21 -1 +12 -1 +39 -8
+21 -1
--- src/info.c
+++ src/info.c
@@ -690,10 +690,12 @@
690690
const char *zUser;
691691
const char *zOrigUser;
692692
const char *zComment;
693693
const char *zDate;
694694
const char *zOrigDate;
695
+ const char *zBrName;
696
+ Blob wiki_edit_links = BLOB_INITIALIZER;
695697
696698
style_header("Check-in [%S]", zUuid);
697699
login_anonymous_available();
698700
zEUser = db_text(0,
699701
"SELECT value FROM tagxref"
@@ -700,10 +702,13 @@
700702
" WHERE tagid=%d AND rid=%d AND tagtype>0",
701703
TAG_USER, rid);
702704
zEComment = db_text(0,
703705
"SELECT value FROM tagxref WHERE tagid=%d AND rid=%d",
704706
TAG_COMMENT, rid);
707
+ zBrName = db_text(0,
708
+ "SELECT value FROM tagxref WHERE tagid=%d AND rid=%d",
709
+ TAG_BRANCH, rid);
705710
zOrigUser = db_column_text(&q1, 2);
706711
zUser = zEUser ? zEUser : zOrigUser;
707712
zComment = db_column_text(&q1, 3);
708713
zDate = db_column_text(&q1,1);
709714
zOrigDate = db_column_text(&q1, 4);
@@ -754,11 +759,19 @@
754759
" WHERE rid=%d AND tagtype>0 "
755760
" AND tag.tagid=tagxref.tagid "
756761
" AND +tag.tagname GLOB 'sym-*'", rid);
757762
while( db_step(&q2)==SQLITE_ROW ){
758763
const char *zTagName = db_column_text(&q2, 0);
759
- @ | %z(href("%R/timeline?r=%T&unhide",zTagName))%h(zTagName)</a>
764
+ if( fossil_strcmp(zTagName,zBrName)==0 ){
765
+ @ | %z(href("%R/timeline?r=%T&unhide",zTagName))%h(zTagName)</a>
766
+ blob_appendf(&wiki_edit_links, " | %z%h</a>",
767
+ href("%R/wikiedit?name=branch/%h",zTagName), zTagName);
768
+ }else{
769
+ @ | %z(href("%R/timeline?t=%T&unhide",zTagName))%h(zTagName)</a>
770
+ blob_appendf(&wiki_edit_links, " | %z%h</a>",
771
+ href("%R/wikiedit?name=tag/%h",zTagName), zTagName);
772
+ }
760773
}
761774
db_finalize(&q2);
762775
@ </td></tr>
763776
764777
@ <tr><th>Files:</th>
@@ -803,10 +816,15 @@
803816
@ <tr><th>Received&nbsp;From:</th>
804817
@ <td>%h(zUser) @ %h(zIpAddr) on %s(zDate)</td></tr>
805818
}
806819
db_finalize(&q2);
807820
}
821
+ if( g.perm.WrWiki ){
822
+ @ <tr><th>Edit&nbsp;Wiki:</th>
823
+ @ <td>%z(href("%R/wikiedit?name=checkin/%s",zUuid))this checkin</a>
824
+ @ %b(&wiki_edit_links)</td>
825
+ }
808826
if( g.perm.Hyperlink ){
809827
@ <tr><th>Other&nbsp;Links:</th>
810828
@ <td>
811829
@ %z(href("%R/artifact/%!S",zUuid))manifest</a>
812830
@ | %z(href("%R/ci_tags/%!S",zUuid))tags</a>
@@ -818,15 +836,17 @@
818836
}
819837
@ </td>
820838
@ </tr>
821839
}
822840
@ </table>
841
+ blob_reset(&wiki_edit_links);
823842
}else{
824843
style_header("Check-in Information");
825844
login_anonymous_available();
826845
}
827846
db_finalize(&q1);
847
+ wiki_render_associated("checkin", zUuid, 0);
828848
render_backlink_graph(zUuid, "<div class=\"section\">References</div>\n");
829849
@ <div class="section">Context</div>
830850
render_checkin_context(rid, 0);
831851
@ <div class="section">Changes</div>
832852
@ <div class="sectionmenu">
833853
--- src/info.c
+++ src/info.c
@@ -690,10 +690,12 @@
690 const char *zUser;
691 const char *zOrigUser;
692 const char *zComment;
693 const char *zDate;
694 const char *zOrigDate;
 
 
695
696 style_header("Check-in [%S]", zUuid);
697 login_anonymous_available();
698 zEUser = db_text(0,
699 "SELECT value FROM tagxref"
@@ -700,10 +702,13 @@
700 " WHERE tagid=%d AND rid=%d AND tagtype>0",
701 TAG_USER, rid);
702 zEComment = db_text(0,
703 "SELECT value FROM tagxref WHERE tagid=%d AND rid=%d",
704 TAG_COMMENT, rid);
 
 
 
705 zOrigUser = db_column_text(&q1, 2);
706 zUser = zEUser ? zEUser : zOrigUser;
707 zComment = db_column_text(&q1, 3);
708 zDate = db_column_text(&q1,1);
709 zOrigDate = db_column_text(&q1, 4);
@@ -754,11 +759,19 @@
754 " WHERE rid=%d AND tagtype>0 "
755 " AND tag.tagid=tagxref.tagid "
756 " AND +tag.tagname GLOB 'sym-*'", rid);
757 while( db_step(&q2)==SQLITE_ROW ){
758 const char *zTagName = db_column_text(&q2, 0);
759 @ | %z(href("%R/timeline?r=%T&unhide",zTagName))%h(zTagName)</a>
 
 
 
 
 
 
 
 
760 }
761 db_finalize(&q2);
762 @ </td></tr>
763
764 @ <tr><th>Files:</th>
@@ -803,10 +816,15 @@
803 @ <tr><th>Received&nbsp;From:</th>
804 @ <td>%h(zUser) @ %h(zIpAddr) on %s(zDate)</td></tr>
805 }
806 db_finalize(&q2);
807 }
 
 
 
 
 
808 if( g.perm.Hyperlink ){
809 @ <tr><th>Other&nbsp;Links:</th>
810 @ <td>
811 @ %z(href("%R/artifact/%!S",zUuid))manifest</a>
812 @ | %z(href("%R/ci_tags/%!S",zUuid))tags</a>
@@ -818,15 +836,17 @@
818 }
819 @ </td>
820 @ </tr>
821 }
822 @ </table>
 
823 }else{
824 style_header("Check-in Information");
825 login_anonymous_available();
826 }
827 db_finalize(&q1);
 
828 render_backlink_graph(zUuid, "<div class=\"section\">References</div>\n");
829 @ <div class="section">Context</div>
830 render_checkin_context(rid, 0);
831 @ <div class="section">Changes</div>
832 @ <div class="sectionmenu">
833
--- src/info.c
+++ src/info.c
@@ -690,10 +690,12 @@
690 const char *zUser;
691 const char *zOrigUser;
692 const char *zComment;
693 const char *zDate;
694 const char *zOrigDate;
695 const char *zBrName;
696 Blob wiki_edit_links = BLOB_INITIALIZER;
697
698 style_header("Check-in [%S]", zUuid);
699 login_anonymous_available();
700 zEUser = db_text(0,
701 "SELECT value FROM tagxref"
@@ -700,10 +702,13 @@
702 " WHERE tagid=%d AND rid=%d AND tagtype>0",
703 TAG_USER, rid);
704 zEComment = db_text(0,
705 "SELECT value FROM tagxref WHERE tagid=%d AND rid=%d",
706 TAG_COMMENT, rid);
707 zBrName = db_text(0,
708 "SELECT value FROM tagxref WHERE tagid=%d AND rid=%d",
709 TAG_BRANCH, rid);
710 zOrigUser = db_column_text(&q1, 2);
711 zUser = zEUser ? zEUser : zOrigUser;
712 zComment = db_column_text(&q1, 3);
713 zDate = db_column_text(&q1,1);
714 zOrigDate = db_column_text(&q1, 4);
@@ -754,11 +759,19 @@
759 " WHERE rid=%d AND tagtype>0 "
760 " AND tag.tagid=tagxref.tagid "
761 " AND +tag.tagname GLOB 'sym-*'", rid);
762 while( db_step(&q2)==SQLITE_ROW ){
763 const char *zTagName = db_column_text(&q2, 0);
764 if( fossil_strcmp(zTagName,zBrName)==0 ){
765 @ | %z(href("%R/timeline?r=%T&unhide",zTagName))%h(zTagName)</a>
766 blob_appendf(&wiki_edit_links, " | %z%h</a>",
767 href("%R/wikiedit?name=branch/%h",zTagName), zTagName);
768 }else{
769 @ | %z(href("%R/timeline?t=%T&unhide",zTagName))%h(zTagName)</a>
770 blob_appendf(&wiki_edit_links, " | %z%h</a>",
771 href("%R/wikiedit?name=tag/%h",zTagName), zTagName);
772 }
773 }
774 db_finalize(&q2);
775 @ </td></tr>
776
777 @ <tr><th>Files:</th>
@@ -803,10 +816,15 @@
816 @ <tr><th>Received&nbsp;From:</th>
817 @ <td>%h(zUser) @ %h(zIpAddr) on %s(zDate)</td></tr>
818 }
819 db_finalize(&q2);
820 }
821 if( g.perm.WrWiki ){
822 @ <tr><th>Edit&nbsp;Wiki:</th>
823 @ <td>%z(href("%R/wikiedit?name=checkin/%s",zUuid))this checkin</a>
824 @ %b(&wiki_edit_links)</td>
825 }
826 if( g.perm.Hyperlink ){
827 @ <tr><th>Other&nbsp;Links:</th>
828 @ <td>
829 @ %z(href("%R/artifact/%!S",zUuid))manifest</a>
830 @ | %z(href("%R/ci_tags/%!S",zUuid))tags</a>
@@ -818,15 +836,17 @@
836 }
837 @ </td>
838 @ </tr>
839 }
840 @ </table>
841 blob_reset(&wiki_edit_links);
842 }else{
843 style_header("Check-in Information");
844 login_anonymous_available();
845 }
846 db_finalize(&q1);
847 wiki_render_associated("checkin", zUuid, 0);
848 render_backlink_graph(zUuid, "<div class=\"section\">References</div>\n");
849 @ <div class="section">Context</div>
850 render_checkin_context(rid, 0);
851 @ <div class="section">Changes</div>
852 @ <div class="sectionmenu">
853
+12 -1
--- src/timeline.c
+++ src/timeline.c
@@ -1423,10 +1423,11 @@
14231423
** dp=CHECKIN The same as d=CHECKIN&p=CHECKIN
14241424
** t=TAG Show only check-ins with the given TAG
14251425
** r=TAG Show check-ins related to TAG, equivalent to t=TAG&rel
14261426
** rel Show related check-ins as well as those matching t=TAG
14271427
** mionly Limit rel to show ancestors but not descendants
1428
+** nowiki Do not show wiki associated with branch or tag
14281429
** ms=MATCHSTYLE Set tag match style to EXACT, GLOB, LIKE, REGEXP
14291430
** u=USER Only show items associated with USER
14301431
** y=TYPE 'ci', 'w', 't', 'e', 'f', or 'all'.
14311432
** ss=VIEWSTYLE c: "Compact" v: "Verbose" m: "Modern" j: "Columnar"
14321433
** advm Use the "Advanced" or "Busy" menu design.
@@ -2269,11 +2270,21 @@
22692270
blob_zero(&sql);
22702271
db_prepare(&q, "SELECT * FROM timeline ORDER BY sortby DESC /*scan*/");
22712272
if( fossil_islower(desc.aData[0]) ){
22722273
desc.aData[0] = fossil_toupper(desc.aData[0]);
22732274
}
2274
- if( zBrName && wiki_render_associated("branch", zBrName) ){
2275
+ if( zBrName
2276
+ && !PB("nowiki")
2277
+ && wiki_render_associated("branch", zBrName, WIKIASSOC_FULL_TITLE)
2278
+ ){
2279
+ @ <div class="section">%b(&desc)</div>
2280
+ }else
2281
+ if( zTagName
2282
+ && matchStyle==MS_EXACT
2283
+ && !PB("nowiki")
2284
+ && wiki_render_associated("tag", zTagName, WIKIASSOC_FULL_TITLE)
2285
+ ){
22752286
@ <div class="section">%b(&desc)</div>
22762287
} else{
22772288
@ <h2>%b(&desc)</h2>
22782289
}
22792290
blob_reset(&desc);
22802291
--- src/timeline.c
+++ src/timeline.c
@@ -1423,10 +1423,11 @@
1423 ** dp=CHECKIN The same as d=CHECKIN&p=CHECKIN
1424 ** t=TAG Show only check-ins with the given TAG
1425 ** r=TAG Show check-ins related to TAG, equivalent to t=TAG&rel
1426 ** rel Show related check-ins as well as those matching t=TAG
1427 ** mionly Limit rel to show ancestors but not descendants
 
1428 ** ms=MATCHSTYLE Set tag match style to EXACT, GLOB, LIKE, REGEXP
1429 ** u=USER Only show items associated with USER
1430 ** y=TYPE 'ci', 'w', 't', 'e', 'f', or 'all'.
1431 ** ss=VIEWSTYLE c: "Compact" v: "Verbose" m: "Modern" j: "Columnar"
1432 ** advm Use the "Advanced" or "Busy" menu design.
@@ -2269,11 +2270,21 @@
2269 blob_zero(&sql);
2270 db_prepare(&q, "SELECT * FROM timeline ORDER BY sortby DESC /*scan*/");
2271 if( fossil_islower(desc.aData[0]) ){
2272 desc.aData[0] = fossil_toupper(desc.aData[0]);
2273 }
2274 if( zBrName && wiki_render_associated("branch", zBrName) ){
 
 
 
 
 
 
 
 
 
 
2275 @ <div class="section">%b(&desc)</div>
2276 } else{
2277 @ <h2>%b(&desc)</h2>
2278 }
2279 blob_reset(&desc);
2280
--- src/timeline.c
+++ src/timeline.c
@@ -1423,10 +1423,11 @@
1423 ** dp=CHECKIN The same as d=CHECKIN&p=CHECKIN
1424 ** t=TAG Show only check-ins with the given TAG
1425 ** r=TAG Show check-ins related to TAG, equivalent to t=TAG&rel
1426 ** rel Show related check-ins as well as those matching t=TAG
1427 ** mionly Limit rel to show ancestors but not descendants
1428 ** nowiki Do not show wiki associated with branch or tag
1429 ** ms=MATCHSTYLE Set tag match style to EXACT, GLOB, LIKE, REGEXP
1430 ** u=USER Only show items associated with USER
1431 ** y=TYPE 'ci', 'w', 't', 'e', 'f', or 'all'.
1432 ** ss=VIEWSTYLE c: "Compact" v: "Verbose" m: "Modern" j: "Columnar"
1433 ** advm Use the "Advanced" or "Busy" menu design.
@@ -2269,11 +2270,21 @@
2270 blob_zero(&sql);
2271 db_prepare(&q, "SELECT * FROM timeline ORDER BY sortby DESC /*scan*/");
2272 if( fossil_islower(desc.aData[0]) ){
2273 desc.aData[0] = fossil_toupper(desc.aData[0]);
2274 }
2275 if( zBrName
2276 && !PB("nowiki")
2277 && wiki_render_associated("branch", zBrName, WIKIASSOC_FULL_TITLE)
2278 ){
2279 @ <div class="section">%b(&desc)</div>
2280 }else
2281 if( zTagName
2282 && matchStyle==MS_EXACT
2283 && !PB("nowiki")
2284 && wiki_render_associated("tag", zTagName, WIKIASSOC_FULL_TITLE)
2285 ){
2286 @ <div class="section">%b(&desc)</div>
2287 } else{
2288 @ <h2>%b(&desc)</h2>
2289 }
2290 blob_reset(&desc);
2291
+39 -8
--- src/wiki.c
+++ src/wiki.c
@@ -1067,26 +1067,34 @@
10671067
int wrid = db_column_int(&q, 2);
10681068
double rWmtime = db_column_double(&q, 3);
10691069
sqlite3_int64 iMtime = (sqlite3_int64)(rWmtime*86400.0);
10701070
char *zAge;
10711071
int wcnt = db_column_int(&q, 4);
1072
+ char *zWDisplayName;
1073
+
1074
+ if( sqlite3_strglob("checkin/*", zWName)==0 ){
1075
+ zWDisplayName = mprintf("%.25s...", zWName);
1076
+ }else{
1077
+ zWDisplayName = mprintf("%s", zWName);
1078
+ }
10721079
if( wrid==0 ){
10731080
if( !showAll ) continue;
10741081
@ <tr><td data-sortkey="%h(zSort)">\
1075
- @ %z(href("%R/whistory?name=%T",zWName))<s>%h(zWName)</s></a></td>
1082
+ @ %z(href("%R/whistory?name=%T",zWName))<s>%h(zWDisplayName)</s></a></td>
10761083
}else{
10771084
@ <tr><td data=sortkey='%h(zSort)">\
1078
- @ %z(href("%R/wiki?name=%T",zWName))%h(zWName)</a></td>
1085
+ @ %z(href("%R/wiki?name=%T",zWName))%h(zWDisplayName)</a></td>
10791086
}
10801087
zAge = human_readable_age(rNow - rWmtime);
10811088
@ <td data-sortkey="%016llx(iMtime)">%s(zAge)</td>
10821089
fossil_free(zAge);
10831090
@ <td>%z(href("%R/whistory?name=%T",zWName))%d(wcnt)</a></td>
10841091
if( showRid ){
10851092
@ <td>%d(wrid)</td>
10861093
}
10871094
@ </tr>
1095
+ fossil_free(zWDisplayName);
10881096
}
10891097
@ </tbody></table></div>
10901098
db_finalize(&q);
10911099
style_table_sorter();
10921100
style_footer();
@@ -1483,10 +1491,34 @@
14831491
blob_zero(&out);
14841492
blob_read_from_file(&in, g.argv[2], ExtFILE);
14851493
markdown_to_html(&in, 0, &out);
14861494
blob_write_to_file(&out, "-");
14871495
}
1496
+
1497
+/*
1498
+** Allowed flags for wiki_render_associated
1499
+*/
1500
+#if INTERFACE
1501
+#define WIKIASSOC_FULL_TITLE 0x00001 /* Full title */
1502
+#endif
1503
+
1504
+/*
1505
+** Show the default Section label for an associated wiki page.
1506
+*/
1507
+static void wiki_section_label(
1508
+ const char *zPrefix, /* "branch", "tag", or "checkin" */
1509
+ const char *zName, /* Name of the object */
1510
+ unsigned int mFlags /* Zero or more WIKIASSOC_* flags */
1511
+){
1512
+ if( (mFlags & WIKIASSOC_FULL_TITLE)==0 ){
1513
+ @ <div class="section">About</div>
1514
+ }else if( zPrefix[0]=='c' ){ /* checkin/... */
1515
+ @ <div class="section">About checkin %.20h(zName)</div>
1516
+ }else{
1517
+ @ <div class="section">About %s(zPrefix) %h(zName)</div>
1518
+ }
1519
+}
14881520
14891521
/*
14901522
** Check to see if there exists a wiki page with a name zPrefix/zName.
14911523
** If there is, then render a <div class='section'>..</div> and
14921524
** return true.
@@ -1493,11 +1525,12 @@
14931525
**
14941526
** If there is no such wiki page, return false.
14951527
*/
14961528
int wiki_render_associated(
14971529
const char *zPrefix, /* "branch", "tag", or "checkin" */
1498
- const char *zName /* Name of the object */
1530
+ const char *zName, /* Name of the object */
1531
+ unsigned int mFlags /* Zero or more WIKIASSOC_* flags */
14991532
){
15001533
int rid;
15011534
Manifest *pWiki;
15021535
rid = db_int(0,
15031536
"SELECT rid FROM tagxref"
@@ -1515,20 +1548,18 @@
15151548
blob_init(&markdown, pWiki->zWiki, -1);
15161549
markdown_to_html(&markdown, &title, &tail);
15171550
if( blob_size(&title) ){
15181551
@ <div class="section">%h(blob_str(&title))</div>
15191552
}else{
1520
- @ <div class="section">About %s(zPrefix) %h(zName)<div>
1553
+ wiki_section_label(zPrefix, zName, mFlags);
15211554
}
1522
- @ <div class="wiki">
15231555
convert_href_and_output(&tail);
1524
- @ </div>
15251556
blob_reset(&tail);
15261557
blob_reset(&title);
15271558
blob_reset(&markdown);
15281559
}else if( fossil_strcmp(pWiki->zMimetype, "text/plain")==0 ){
1529
- @ <div class="section">About %s(zPrefix) %h(zName)</div>
1560
+ wiki_section_label(zPrefix, zName, mFlags);
15301561
@ <pre>
15311562
@ %h(pWiki->zWiki)
15321563
@ </pre>
15331564
}else{
15341565
Blob tail = BLOB_INITIALIZER;
@@ -1539,11 +1570,11 @@
15391570
@ <div class="section">%h(blob_str(&title))</div>
15401571
@ <div class="wiki">
15411572
wiki_convert(&tail, 0, WIKI_BUTTONS);
15421573
@ </div>
15431574
}else{
1544
- @ <div class="section">About %s(zPrefix) %h(zName)</div>
1575
+ wiki_section_label(zPrefix, zName, mFlags);
15451576
@ <div class="wiki">
15461577
wiki_convert(&wiki, 0, WIKI_BUTTONS);
15471578
@ </div>
15481579
}
15491580
blob_reset(&tail);
15501581
--- src/wiki.c
+++ src/wiki.c
@@ -1067,26 +1067,34 @@
1067 int wrid = db_column_int(&q, 2);
1068 double rWmtime = db_column_double(&q, 3);
1069 sqlite3_int64 iMtime = (sqlite3_int64)(rWmtime*86400.0);
1070 char *zAge;
1071 int wcnt = db_column_int(&q, 4);
 
 
 
 
 
 
 
1072 if( wrid==0 ){
1073 if( !showAll ) continue;
1074 @ <tr><td data-sortkey="%h(zSort)">\
1075 @ %z(href("%R/whistory?name=%T",zWName))<s>%h(zWName)</s></a></td>
1076 }else{
1077 @ <tr><td data=sortkey='%h(zSort)">\
1078 @ %z(href("%R/wiki?name=%T",zWName))%h(zWName)</a></td>
1079 }
1080 zAge = human_readable_age(rNow - rWmtime);
1081 @ <td data-sortkey="%016llx(iMtime)">%s(zAge)</td>
1082 fossil_free(zAge);
1083 @ <td>%z(href("%R/whistory?name=%T",zWName))%d(wcnt)</a></td>
1084 if( showRid ){
1085 @ <td>%d(wrid)</td>
1086 }
1087 @ </tr>
 
1088 }
1089 @ </tbody></table></div>
1090 db_finalize(&q);
1091 style_table_sorter();
1092 style_footer();
@@ -1483,10 +1491,34 @@
1483 blob_zero(&out);
1484 blob_read_from_file(&in, g.argv[2], ExtFILE);
1485 markdown_to_html(&in, 0, &out);
1486 blob_write_to_file(&out, "-");
1487 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1488
1489 /*
1490 ** Check to see if there exists a wiki page with a name zPrefix/zName.
1491 ** If there is, then render a <div class='section'>..</div> and
1492 ** return true.
@@ -1493,11 +1525,12 @@
1493 **
1494 ** If there is no such wiki page, return false.
1495 */
1496 int wiki_render_associated(
1497 const char *zPrefix, /* "branch", "tag", or "checkin" */
1498 const char *zName /* Name of the object */
 
1499 ){
1500 int rid;
1501 Manifest *pWiki;
1502 rid = db_int(0,
1503 "SELECT rid FROM tagxref"
@@ -1515,20 +1548,18 @@
1515 blob_init(&markdown, pWiki->zWiki, -1);
1516 markdown_to_html(&markdown, &title, &tail);
1517 if( blob_size(&title) ){
1518 @ <div class="section">%h(blob_str(&title))</div>
1519 }else{
1520 @ <div class="section">About %s(zPrefix) %h(zName)<div>
1521 }
1522 @ <div class="wiki">
1523 convert_href_and_output(&tail);
1524 @ </div>
1525 blob_reset(&tail);
1526 blob_reset(&title);
1527 blob_reset(&markdown);
1528 }else if( fossil_strcmp(pWiki->zMimetype, "text/plain")==0 ){
1529 @ <div class="section">About %s(zPrefix) %h(zName)</div>
1530 @ <pre>
1531 @ %h(pWiki->zWiki)
1532 @ </pre>
1533 }else{
1534 Blob tail = BLOB_INITIALIZER;
@@ -1539,11 +1570,11 @@
1539 @ <div class="section">%h(blob_str(&title))</div>
1540 @ <div class="wiki">
1541 wiki_convert(&tail, 0, WIKI_BUTTONS);
1542 @ </div>
1543 }else{
1544 @ <div class="section">About %s(zPrefix) %h(zName)</div>
1545 @ <div class="wiki">
1546 wiki_convert(&wiki, 0, WIKI_BUTTONS);
1547 @ </div>
1548 }
1549 blob_reset(&tail);
1550
--- src/wiki.c
+++ src/wiki.c
@@ -1067,26 +1067,34 @@
1067 int wrid = db_column_int(&q, 2);
1068 double rWmtime = db_column_double(&q, 3);
1069 sqlite3_int64 iMtime = (sqlite3_int64)(rWmtime*86400.0);
1070 char *zAge;
1071 int wcnt = db_column_int(&q, 4);
1072 char *zWDisplayName;
1073
1074 if( sqlite3_strglob("checkin/*", zWName)==0 ){
1075 zWDisplayName = mprintf("%.25s...", zWName);
1076 }else{
1077 zWDisplayName = mprintf("%s", zWName);
1078 }
1079 if( wrid==0 ){
1080 if( !showAll ) continue;
1081 @ <tr><td data-sortkey="%h(zSort)">\
1082 @ %z(href("%R/whistory?name=%T",zWName))<s>%h(zWDisplayName)</s></a></td>
1083 }else{
1084 @ <tr><td data=sortkey='%h(zSort)">\
1085 @ %z(href("%R/wiki?name=%T",zWName))%h(zWDisplayName)</a></td>
1086 }
1087 zAge = human_readable_age(rNow - rWmtime);
1088 @ <td data-sortkey="%016llx(iMtime)">%s(zAge)</td>
1089 fossil_free(zAge);
1090 @ <td>%z(href("%R/whistory?name=%T",zWName))%d(wcnt)</a></td>
1091 if( showRid ){
1092 @ <td>%d(wrid)</td>
1093 }
1094 @ </tr>
1095 fossil_free(zWDisplayName);
1096 }
1097 @ </tbody></table></div>
1098 db_finalize(&q);
1099 style_table_sorter();
1100 style_footer();
@@ -1483,10 +1491,34 @@
1491 blob_zero(&out);
1492 blob_read_from_file(&in, g.argv[2], ExtFILE);
1493 markdown_to_html(&in, 0, &out);
1494 blob_write_to_file(&out, "-");
1495 }
1496
1497 /*
1498 ** Allowed flags for wiki_render_associated
1499 */
1500 #if INTERFACE
1501 #define WIKIASSOC_FULL_TITLE 0x00001 /* Full title */
1502 #endif
1503
1504 /*
1505 ** Show the default Section label for an associated wiki page.
1506 */
1507 static void wiki_section_label(
1508 const char *zPrefix, /* "branch", "tag", or "checkin" */
1509 const char *zName, /* Name of the object */
1510 unsigned int mFlags /* Zero or more WIKIASSOC_* flags */
1511 ){
1512 if( (mFlags & WIKIASSOC_FULL_TITLE)==0 ){
1513 @ <div class="section">About</div>
1514 }else if( zPrefix[0]=='c' ){ /* checkin/... */
1515 @ <div class="section">About checkin %.20h(zName)</div>
1516 }else{
1517 @ <div class="section">About %s(zPrefix) %h(zName)</div>
1518 }
1519 }
1520
1521 /*
1522 ** Check to see if there exists a wiki page with a name zPrefix/zName.
1523 ** If there is, then render a <div class='section'>..</div> and
1524 ** return true.
@@ -1493,11 +1525,12 @@
1525 **
1526 ** If there is no such wiki page, return false.
1527 */
1528 int wiki_render_associated(
1529 const char *zPrefix, /* "branch", "tag", or "checkin" */
1530 const char *zName, /* Name of the object */
1531 unsigned int mFlags /* Zero or more WIKIASSOC_* flags */
1532 ){
1533 int rid;
1534 Manifest *pWiki;
1535 rid = db_int(0,
1536 "SELECT rid FROM tagxref"
@@ -1515,20 +1548,18 @@
1548 blob_init(&markdown, pWiki->zWiki, -1);
1549 markdown_to_html(&markdown, &title, &tail);
1550 if( blob_size(&title) ){
1551 @ <div class="section">%h(blob_str(&title))</div>
1552 }else{
1553 wiki_section_label(zPrefix, zName, mFlags);
1554 }
 
1555 convert_href_and_output(&tail);
 
1556 blob_reset(&tail);
1557 blob_reset(&title);
1558 blob_reset(&markdown);
1559 }else if( fossil_strcmp(pWiki->zMimetype, "text/plain")==0 ){
1560 wiki_section_label(zPrefix, zName, mFlags);
1561 @ <pre>
1562 @ %h(pWiki->zWiki)
1563 @ </pre>
1564 }else{
1565 Blob tail = BLOB_INITIALIZER;
@@ -1539,11 +1570,11 @@
1570 @ <div class="section">%h(blob_str(&title))</div>
1571 @ <div class="wiki">
1572 wiki_convert(&tail, 0, WIKI_BUTTONS);
1573 @ </div>
1574 }else{
1575 wiki_section_label(zPrefix, zName, mFlags);
1576 @ <div class="wiki">
1577 wiki_convert(&wiki, 0, WIKI_BUTTONS);
1578 @ </div>
1579 }
1580 blob_reset(&tail);
1581

Keyboard Shortcuts

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