Fossil SCM
A single new setting "wiki-classic" switches wiki display between the circa-2007 classic wiki and the new 2025 enhanced wiki.
Commit
918a2e2c5e1e047a3da4b27ebbfe5db26fec7078d912799c155eca0cb9f67f85
Parent
7d67724653de7f0…
11 files changed
+1
-1
+1
-1
+6
-11
+24
-22
+123
-8
+39
-12
-10
+61
-18
+1
-1
+1
-1
+2
-2
+1
-1
| --- src/backlink.c | ||
| +++ src/backlink.c | ||
| @@ -372,11 +372,11 @@ | ||
| 372 | 372 | bklnk.srctype = srctype; |
| 373 | 373 | bklnk.mtime = mtime; |
| 374 | 374 | if( mimetype==MT_NONE || mimetype==MT_WIKI ){ |
| 375 | 375 | int flags; |
| 376 | 376 | if( srctype==BKLNK_COMMENT ){ |
| 377 | - flags = WIKI_INLINE | WIKI_MARKDOWN_LINK; | |
| 377 | + flags = WIKI_INLINE | WIKI_MARKDOWN_LINK | WIKI_OVERRIDE; | |
| 378 | 378 | }else{ |
| 379 | 379 | flags = 0; |
| 380 | 380 | } |
| 381 | 381 | wiki_extract_links(zSrc, &bklnk, flags); |
| 382 | 382 | }else if( mimetype==MT_MARKDOWN ){ |
| 383 | 383 |
| --- src/backlink.c | |
| +++ src/backlink.c | |
| @@ -372,11 +372,11 @@ | |
| 372 | bklnk.srctype = srctype; |
| 373 | bklnk.mtime = mtime; |
| 374 | if( mimetype==MT_NONE || mimetype==MT_WIKI ){ |
| 375 | int flags; |
| 376 | if( srctype==BKLNK_COMMENT ){ |
| 377 | flags = WIKI_INLINE | WIKI_MARKDOWN_LINK; |
| 378 | }else{ |
| 379 | flags = 0; |
| 380 | } |
| 381 | wiki_extract_links(zSrc, &bklnk, flags); |
| 382 | }else if( mimetype==MT_MARKDOWN ){ |
| 383 |
| --- src/backlink.c | |
| +++ src/backlink.c | |
| @@ -372,11 +372,11 @@ | |
| 372 | bklnk.srctype = srctype; |
| 373 | bklnk.mtime = mtime; |
| 374 | if( mimetype==MT_NONE || mimetype==MT_WIKI ){ |
| 375 | int flags; |
| 376 | if( srctype==BKLNK_COMMENT ){ |
| 377 | flags = WIKI_INLINE | WIKI_MARKDOWN_LINK | WIKI_OVERRIDE; |
| 378 | }else{ |
| 379 | flags = 0; |
| 380 | } |
| 381 | wiki_extract_links(zSrc, &bklnk, flags); |
| 382 | }else if( mimetype==MT_MARKDOWN ){ |
| 383 |
+1
-1
| --- src/main.mk | ||
| +++ src/main.mk | ||
| @@ -277,11 +277,11 @@ | ||
| 277 | 277 | $(SRCDIR)/style.pikchrshow.css \ |
| 278 | 278 | $(SRCDIR)/style.uvlist.css \ |
| 279 | 279 | $(SRCDIR)/style.wikiedit.css \ |
| 280 | 280 | $(SRCDIR)/tree.js \ |
| 281 | 281 | $(SRCDIR)/useredit.js \ |
| 282 | - $(SRCDIR)/wiki.wiki | |
| 282 | + $(SRCDIR)/wiki-rules.txt | |
| 283 | 283 | |
| 284 | 284 | TRANS_SRC = \ |
| 285 | 285 | $(OBJDIR)/add_.c \ |
| 286 | 286 | $(OBJDIR)/ajax_.c \ |
| 287 | 287 | $(OBJDIR)/alerts_.c \ |
| 288 | 288 |
| --- src/main.mk | |
| +++ src/main.mk | |
| @@ -277,11 +277,11 @@ | |
| 277 | $(SRCDIR)/style.pikchrshow.css \ |
| 278 | $(SRCDIR)/style.uvlist.css \ |
| 279 | $(SRCDIR)/style.wikiedit.css \ |
| 280 | $(SRCDIR)/tree.js \ |
| 281 | $(SRCDIR)/useredit.js \ |
| 282 | $(SRCDIR)/wiki.wiki |
| 283 | |
| 284 | TRANS_SRC = \ |
| 285 | $(OBJDIR)/add_.c \ |
| 286 | $(OBJDIR)/ajax_.c \ |
| 287 | $(OBJDIR)/alerts_.c \ |
| 288 |
| --- src/main.mk | |
| +++ src/main.mk | |
| @@ -277,11 +277,11 @@ | |
| 277 | $(SRCDIR)/style.pikchrshow.css \ |
| 278 | $(SRCDIR)/style.uvlist.css \ |
| 279 | $(SRCDIR)/style.wikiedit.css \ |
| 280 | $(SRCDIR)/tree.js \ |
| 281 | $(SRCDIR)/useredit.js \ |
| 282 | $(SRCDIR)/wiki-rules.txt |
| 283 | |
| 284 | TRANS_SRC = \ |
| 285 | $(OBJDIR)/add_.c \ |
| 286 | $(OBJDIR)/ajax_.c \ |
| 287 | $(OBJDIR)/alerts_.c \ |
| 288 |
+6
-11
| --- src/printf.c | ||
| +++ src/printf.c | ||
| @@ -267,17 +267,16 @@ | ||
| 267 | 267 | ** treated like any other whitespace character. |
| 268 | 268 | */ |
| 269 | 269 | |
| 270 | 270 | /* |
| 271 | 271 | ** Return an appropriate set of flags for wiki_convert() for displaying |
| 272 | -** comments on a timeline. These flag settings are determined by | |
| 273 | -** configuration parameters. | |
| 272 | +** check-in comments on a timeline (%W) or for general display (%!W). | |
| 273 | +** The flags are determined by settings. | |
| 274 | 274 | ** |
| 275 | -** The altForm2 argument is true for "%!W" (with the "!" alternate-form-2 | |
| 276 | -** flags) and is false for plain "%W". The ! indicates that the text is | |
| 277 | -** to be rendered on a form rather than the timeline and that block markup | |
| 278 | -** is acceptable even if the "timeline-block-markup" setting is false. | |
| 275 | +** The altForm2 argument is true for "%!W" (indicating that the rendered | |
| 276 | +** wiki text is for general display) and false for "%W" (indicating that | |
| 277 | +** the text is being displayed in a timeline. | |
| 279 | 278 | */ |
| 280 | 279 | static int wiki_convert_flags(int altForm2){ |
| 281 | 280 | static int wikiFlags = 0; |
| 282 | 281 | if( wikiFlags==0 ){ |
| 283 | 282 | if( db_get_boolean("timeline-block-markup", 0) ){ |
| @@ -284,16 +283,12 @@ | ||
| 284 | 283 | wikiFlags = WIKI_INLINE | WIKI_NOBADLINKS; |
| 285 | 284 | }else{ |
| 286 | 285 | wikiFlags = WIKI_INLINE | WIKI_NOBLOCK | WIKI_NOBADLINKS; |
| 287 | 286 | } |
| 288 | 287 | if( db_get_boolean("timeline-plaintext", 0) ){ |
| 289 | - wikiFlags |= WIKI_LINKSONLY; | |
| 288 | + wikiFlags |= WIKI_LINKSONLY | WIKI_OVERRIDE; | |
| 290 | 289 | wikiFlags &= ~WIKI_MARKDOWN_INLINE; |
| 291 | - }else{ | |
| 292 | - int x = db_get_int("timeline-markdown", 0); | |
| 293 | - if( x & 1 ) wikiFlags |= WIKI_MARKDOWN_LINK; | |
| 294 | - if( x & 2 ) wikiFlags |= WIKI_MARKDOWN_FONT; | |
| 295 | 290 | } |
| 296 | 291 | if( db_get_boolean("timeline-hard-newlines", 0) ){ |
| 297 | 292 | wikiFlags |= WIKI_NEWLINE; |
| 298 | 293 | } |
| 299 | 294 | } |
| 300 | 295 |
| --- src/printf.c | |
| +++ src/printf.c | |
| @@ -267,17 +267,16 @@ | |
| 267 | ** treated like any other whitespace character. |
| 268 | */ |
| 269 | |
| 270 | /* |
| 271 | ** Return an appropriate set of flags for wiki_convert() for displaying |
| 272 | ** comments on a timeline. These flag settings are determined by |
| 273 | ** configuration parameters. |
| 274 | ** |
| 275 | ** The altForm2 argument is true for "%!W" (with the "!" alternate-form-2 |
| 276 | ** flags) and is false for plain "%W". The ! indicates that the text is |
| 277 | ** to be rendered on a form rather than the timeline and that block markup |
| 278 | ** is acceptable even if the "timeline-block-markup" setting is false. |
| 279 | */ |
| 280 | static int wiki_convert_flags(int altForm2){ |
| 281 | static int wikiFlags = 0; |
| 282 | if( wikiFlags==0 ){ |
| 283 | if( db_get_boolean("timeline-block-markup", 0) ){ |
| @@ -284,16 +283,12 @@ | |
| 284 | wikiFlags = WIKI_INLINE | WIKI_NOBADLINKS; |
| 285 | }else{ |
| 286 | wikiFlags = WIKI_INLINE | WIKI_NOBLOCK | WIKI_NOBADLINKS; |
| 287 | } |
| 288 | if( db_get_boolean("timeline-plaintext", 0) ){ |
| 289 | wikiFlags |= WIKI_LINKSONLY; |
| 290 | wikiFlags &= ~WIKI_MARKDOWN_INLINE; |
| 291 | }else{ |
| 292 | int x = db_get_int("timeline-markdown", 0); |
| 293 | if( x & 1 ) wikiFlags |= WIKI_MARKDOWN_LINK; |
| 294 | if( x & 2 ) wikiFlags |= WIKI_MARKDOWN_FONT; |
| 295 | } |
| 296 | if( db_get_boolean("timeline-hard-newlines", 0) ){ |
| 297 | wikiFlags |= WIKI_NEWLINE; |
| 298 | } |
| 299 | } |
| 300 |
| --- src/printf.c | |
| +++ src/printf.c | |
| @@ -267,17 +267,16 @@ | |
| 267 | ** treated like any other whitespace character. |
| 268 | */ |
| 269 | |
| 270 | /* |
| 271 | ** Return an appropriate set of flags for wiki_convert() for displaying |
| 272 | ** check-in comments on a timeline (%W) or for general display (%!W). |
| 273 | ** The flags are determined by settings. |
| 274 | ** |
| 275 | ** The altForm2 argument is true for "%!W" (indicating that the rendered |
| 276 | ** wiki text is for general display) and false for "%W" (indicating that |
| 277 | ** the text is being displayed in a timeline. |
| 278 | */ |
| 279 | static int wiki_convert_flags(int altForm2){ |
| 280 | static int wikiFlags = 0; |
| 281 | if( wikiFlags==0 ){ |
| 282 | if( db_get_boolean("timeline-block-markup", 0) ){ |
| @@ -284,16 +283,12 @@ | |
| 283 | wikiFlags = WIKI_INLINE | WIKI_NOBADLINKS; |
| 284 | }else{ |
| 285 | wikiFlags = WIKI_INLINE | WIKI_NOBLOCK | WIKI_NOBADLINKS; |
| 286 | } |
| 287 | if( db_get_boolean("timeline-plaintext", 0) ){ |
| 288 | wikiFlags |= WIKI_LINKSONLY | WIKI_OVERRIDE; |
| 289 | wikiFlags &= ~WIKI_MARKDOWN_INLINE; |
| 290 | } |
| 291 | if( db_get_boolean("timeline-hard-newlines", 0) ){ |
| 292 | wikiFlags |= WIKI_NEWLINE; |
| 293 | } |
| 294 | } |
| 295 |
+24
-22
| --- src/setup.c | ||
| +++ src/setup.c | ||
| @@ -988,16 +988,10 @@ | ||
| 988 | 988 | "1", "HH:MM:SS", |
| 989 | 989 | "2", "YYYY-MM-DD HH:MM", |
| 990 | 990 | "3", "YYMMDD HH:MM", |
| 991 | 991 | "4", "(off)" |
| 992 | 992 | }; |
| 993 | - static const char *const azMarkdown[] = { | |
| 994 | - "0", "none", | |
| 995 | - "1", "hyperlinks only", | |
| 996 | - "2", "styling only", | |
| 997 | - "3", "links and styling", | |
| 998 | - }; | |
| 999 | 993 | login_check_credentials(); |
| 1000 | 994 | if( !g.perm.Admin ){ |
| 1001 | 995 | login_needed(0); |
| 1002 | 996 | return; |
| 1003 | 997 | } |
| @@ -1014,24 +1008,10 @@ | ||
| 1014 | 1008 | "timeline-block-markup", "tbm", 0, 0); |
| 1015 | 1009 | @ <p>In timeline displays, check-in comments can be displayed with or |
| 1016 | 1010 | @ without block markup such as paragraphs, tables, etc. |
| 1017 | 1011 | @ (Property: "timeline-block-markup")</p> |
| 1018 | 1012 | |
| 1019 | - @ <hr> | |
| 1020 | - multiple_choice_attribute("Allow Markdown in timeline comments", | |
| 1021 | - "timeline-markdown", "tmkdn", "0", | |
| 1022 | - count(azMarkdown)/2, azMarkdown); | |
| 1023 | - @ <p>Allow or disallow a limited amount of Markdown-style format marks | |
| 1024 | - @ for check-in comments displayed in the timeline. Normally check-in | |
| 1025 | - @ comments use only <a href="%R/wiki_rules">Fossil Wiki</a>. This option | |
| 1026 | - @ allows some types of Markdown to be used as well: | |
| 1027 | - @ <ul><li>hyperlinks: <b>(</b><i>display</i><b>)[</b><i>target</i><b>]</b> \ | |
| 1028 | - @ and <b><</b><i>URL</i><b>></b>. | |
| 1029 | - @ <li>styling: *<i>emphasis</i>*, **<b>bold</b>**, `<tt>literal</tt>`, \ | |
| 1030 | - @ <b>\</b>-escapes</ul> | |
| 1031 | - @ (Property: "timeline-markdown")</p> | |
| 1032 | - | |
| 1033 | 1013 | @ <hr> |
| 1034 | 1014 | onoff_attribute("Plaintext comments on timelines", |
| 1035 | 1015 | "timeline-plaintext", "tpt", 0, 0); |
| 1036 | 1016 | @ <p>In timeline displays, check-in comments are displayed literally, |
| 1037 | 1017 | @ without any wiki or HTML interpretation. This setting takes priority |
| @@ -1452,12 +1432,12 @@ | ||
| 1452 | 1432 | db_begin_transaction(); |
| 1453 | 1433 | @ <form action="%R/setup_wiki" method="post"><div> |
| 1454 | 1434 | login_insert_csrf_secret(); |
| 1455 | 1435 | @ <input type="submit" name="submit" value="Apply Changes"></p> |
| 1456 | 1436 | @ <hr> |
| 1457 | - onoff_attribute("Associate Wiki Pages With Branches, Tags, Tickets, or Checkins", | |
| 1458 | - "wiki-about", "wiki-about", 1, 0); | |
| 1437 | + onoff_attribute("Associate Wiki Pages With Branches, Tags, Tickets," | |
| 1438 | + " or Checkins", "wiki-about", "wiki-about", 1, 0); | |
| 1459 | 1439 | @ <p> |
| 1460 | 1440 | @ Associate wiki pages with branches, tags, tickets, or checkins, based on |
| 1461 | 1441 | @ the wiki page name. Wiki pages that begin with "branch/", "checkin/", |
| 1462 | 1442 | @ "tag/" or "ticket" and which continue with the name of an existing branch, |
| 1463 | 1443 | @ check-in, tag or ticket are treated specially when this feature is enabled. |
| @@ -1466,10 +1446,32 @@ | ||
| 1466 | 1446 | @ <li> <b>checkin/</b><i>full-check-in-hash</i> |
| 1467 | 1447 | @ <li> <b>tag/</b><i>tag-name</i> |
| 1468 | 1448 | @ <li> <b>ticket/</b><i>full-ticket-hash</i> |
| 1469 | 1449 | @ </ul> |
| 1470 | 1450 | @ (Property: "wiki-about")</p> |
| 1451 | + @ <hr> | |
| 1452 | + onoff_attribute("Disable the 2025 enhancements to wiki formatting rules", | |
| 1453 | + "wiki-classic", "wiki-classic", 0, 0); | |
| 1454 | + @ <p>When enabled, only the original circa-2007 wiki formatting rules are | |
| 1455 | + @ recognized. The new formatting rules added in 2025 are ignored. Enable | |
| 1456 | + @ this setting if you are hosting an older repository that has preexisting | |
| 1457 | + @ wiki content that is adversely affected by the new rules. | |
| 1458 | + @ The enhanced wiki formatting rules added in 2025 are: | |
| 1459 | + @ <ul> | |
| 1460 | + @ <li> Markdown-style hyperlinks: \ | |
| 1461 | + @ <tt>[display](URL)</tt> | |
| 1462 | + @ <li> Angle-bracket hyperlinks:  <tt><URL></tt> | |
| 1463 | + @ <li> Font changes:  | |
| 1464 | + @ <tt>*italic*</tt>  \ | |
| 1465 | + @ <tt>**bold**</tt>  \ | |
| 1466 | + @ <tt>`teletype`</tt> | |
| 1467 | + @ <li> Backslash escapes: \ | |
| 1468 | + @ <tt>\></tt>   <tt>\[</tt>   <tt>\*</tt>   | |
| 1469 | + @ <tt>\_</tt>   <tt>\'</tt>   <tt>\\</tt>   | |
| 1470 | + @ <i>and so forth...</i> | |
| 1471 | + @ </ul> | |
| 1472 | + @ (Property: "wiki-classic") | |
| 1471 | 1473 | @ <hr> |
| 1472 | 1474 | entry_attribute("Allow Unsafe HTML In Markdown", 6, |
| 1473 | 1475 | "safe-html", "safe-html", "", 0); |
| 1474 | 1476 | @ <p>Allow "unsafe" HTML (ex: <script>, <form>, etc) to be |
| 1475 | 1477 | @ generated by <a href="%R/md_rules">Markdown-formatted</a> documents. |
| 1476 | 1478 | |
| 1477 | 1479 | ADDED src/wiki-rules.txt |
| --- src/setup.c | |
| +++ src/setup.c | |
| @@ -988,16 +988,10 @@ | |
| 988 | "1", "HH:MM:SS", |
| 989 | "2", "YYYY-MM-DD HH:MM", |
| 990 | "3", "YYMMDD HH:MM", |
| 991 | "4", "(off)" |
| 992 | }; |
| 993 | static const char *const azMarkdown[] = { |
| 994 | "0", "none", |
| 995 | "1", "hyperlinks only", |
| 996 | "2", "styling only", |
| 997 | "3", "links and styling", |
| 998 | }; |
| 999 | login_check_credentials(); |
| 1000 | if( !g.perm.Admin ){ |
| 1001 | login_needed(0); |
| 1002 | return; |
| 1003 | } |
| @@ -1014,24 +1008,10 @@ | |
| 1014 | "timeline-block-markup", "tbm", 0, 0); |
| 1015 | @ <p>In timeline displays, check-in comments can be displayed with or |
| 1016 | @ without block markup such as paragraphs, tables, etc. |
| 1017 | @ (Property: "timeline-block-markup")</p> |
| 1018 | |
| 1019 | @ <hr> |
| 1020 | multiple_choice_attribute("Allow Markdown in timeline comments", |
| 1021 | "timeline-markdown", "tmkdn", "0", |
| 1022 | count(azMarkdown)/2, azMarkdown); |
| 1023 | @ <p>Allow or disallow a limited amount of Markdown-style format marks |
| 1024 | @ for check-in comments displayed in the timeline. Normally check-in |
| 1025 | @ comments use only <a href="%R/wiki_rules">Fossil Wiki</a>. This option |
| 1026 | @ allows some types of Markdown to be used as well: |
| 1027 | @ <ul><li>hyperlinks: <b>(</b><i>display</i><b>)[</b><i>target</i><b>]</b> \ |
| 1028 | @ and <b><</b><i>URL</i><b>></b>. |
| 1029 | @ <li>styling: *<i>emphasis</i>*, **<b>bold</b>**, `<tt>literal</tt>`, \ |
| 1030 | @ <b>\</b>-escapes</ul> |
| 1031 | @ (Property: "timeline-markdown")</p> |
| 1032 | |
| 1033 | @ <hr> |
| 1034 | onoff_attribute("Plaintext comments on timelines", |
| 1035 | "timeline-plaintext", "tpt", 0, 0); |
| 1036 | @ <p>In timeline displays, check-in comments are displayed literally, |
| 1037 | @ without any wiki or HTML interpretation. This setting takes priority |
| @@ -1452,12 +1432,12 @@ | |
| 1452 | db_begin_transaction(); |
| 1453 | @ <form action="%R/setup_wiki" method="post"><div> |
| 1454 | login_insert_csrf_secret(); |
| 1455 | @ <input type="submit" name="submit" value="Apply Changes"></p> |
| 1456 | @ <hr> |
| 1457 | onoff_attribute("Associate Wiki Pages With Branches, Tags, Tickets, or Checkins", |
| 1458 | "wiki-about", "wiki-about", 1, 0); |
| 1459 | @ <p> |
| 1460 | @ Associate wiki pages with branches, tags, tickets, or checkins, based on |
| 1461 | @ the wiki page name. Wiki pages that begin with "branch/", "checkin/", |
| 1462 | @ "tag/" or "ticket" and which continue with the name of an existing branch, |
| 1463 | @ check-in, tag or ticket are treated specially when this feature is enabled. |
| @@ -1466,10 +1446,32 @@ | |
| 1466 | @ <li> <b>checkin/</b><i>full-check-in-hash</i> |
| 1467 | @ <li> <b>tag/</b><i>tag-name</i> |
| 1468 | @ <li> <b>ticket/</b><i>full-ticket-hash</i> |
| 1469 | @ </ul> |
| 1470 | @ (Property: "wiki-about")</p> |
| 1471 | @ <hr> |
| 1472 | entry_attribute("Allow Unsafe HTML In Markdown", 6, |
| 1473 | "safe-html", "safe-html", "", 0); |
| 1474 | @ <p>Allow "unsafe" HTML (ex: <script>, <form>, etc) to be |
| 1475 | @ generated by <a href="%R/md_rules">Markdown-formatted</a> documents. |
| 1476 | |
| 1477 | DDED src/wiki-rules.txt |
| --- src/setup.c | |
| +++ src/setup.c | |
| @@ -988,16 +988,10 @@ | |
| 988 | "1", "HH:MM:SS", |
| 989 | "2", "YYYY-MM-DD HH:MM", |
| 990 | "3", "YYMMDD HH:MM", |
| 991 | "4", "(off)" |
| 992 | }; |
| 993 | login_check_credentials(); |
| 994 | if( !g.perm.Admin ){ |
| 995 | login_needed(0); |
| 996 | return; |
| 997 | } |
| @@ -1014,24 +1008,10 @@ | |
| 1008 | "timeline-block-markup", "tbm", 0, 0); |
| 1009 | @ <p>In timeline displays, check-in comments can be displayed with or |
| 1010 | @ without block markup such as paragraphs, tables, etc. |
| 1011 | @ (Property: "timeline-block-markup")</p> |
| 1012 | |
| 1013 | @ <hr> |
| 1014 | onoff_attribute("Plaintext comments on timelines", |
| 1015 | "timeline-plaintext", "tpt", 0, 0); |
| 1016 | @ <p>In timeline displays, check-in comments are displayed literally, |
| 1017 | @ without any wiki or HTML interpretation. This setting takes priority |
| @@ -1452,12 +1432,12 @@ | |
| 1432 | db_begin_transaction(); |
| 1433 | @ <form action="%R/setup_wiki" method="post"><div> |
| 1434 | login_insert_csrf_secret(); |
| 1435 | @ <input type="submit" name="submit" value="Apply Changes"></p> |
| 1436 | @ <hr> |
| 1437 | onoff_attribute("Associate Wiki Pages With Branches, Tags, Tickets," |
| 1438 | " or Checkins", "wiki-about", "wiki-about", 1, 0); |
| 1439 | @ <p> |
| 1440 | @ Associate wiki pages with branches, tags, tickets, or checkins, based on |
| 1441 | @ the wiki page name. Wiki pages that begin with "branch/", "checkin/", |
| 1442 | @ "tag/" or "ticket" and which continue with the name of an existing branch, |
| 1443 | @ check-in, tag or ticket are treated specially when this feature is enabled. |
| @@ -1466,10 +1446,32 @@ | |
| 1446 | @ <li> <b>checkin/</b><i>full-check-in-hash</i> |
| 1447 | @ <li> <b>tag/</b><i>tag-name</i> |
| 1448 | @ <li> <b>ticket/</b><i>full-ticket-hash</i> |
| 1449 | @ </ul> |
| 1450 | @ (Property: "wiki-about")</p> |
| 1451 | @ <hr> |
| 1452 | onoff_attribute("Disable the 2025 enhancements to wiki formatting rules", |
| 1453 | "wiki-classic", "wiki-classic", 0, 0); |
| 1454 | @ <p>When enabled, only the original circa-2007 wiki formatting rules are |
| 1455 | @ recognized. The new formatting rules added in 2025 are ignored. Enable |
| 1456 | @ this setting if you are hosting an older repository that has preexisting |
| 1457 | @ wiki content that is adversely affected by the new rules. |
| 1458 | @ The enhanced wiki formatting rules added in 2025 are: |
| 1459 | @ <ul> |
| 1460 | @ <li> Markdown-style hyperlinks: \ |
| 1461 | @ <tt>[display](URL)</tt> |
| 1462 | @ <li> Angle-bracket hyperlinks:  <tt><URL></tt> |
| 1463 | @ <li> Font changes:  |
| 1464 | @ <tt>*italic*</tt>  \ |
| 1465 | @ <tt>**bold**</tt>  \ |
| 1466 | @ <tt>`teletype`</tt> |
| 1467 | @ <li> Backslash escapes: \ |
| 1468 | @ <tt>\></tt>   <tt>\[</tt>   <tt>\*</tt>   |
| 1469 | @ <tt>\_</tt>   <tt>\'</tt>   <tt>\\</tt>   |
| 1470 | @ <i>and so forth...</i> |
| 1471 | @ </ul> |
| 1472 | @ (Property: "wiki-classic") |
| 1473 | @ <hr> |
| 1474 | entry_attribute("Allow Unsafe HTML In Markdown", 6, |
| 1475 | "safe-html", "safe-html", "", 0); |
| 1476 | @ <p>Allow "unsafe" HTML (ex: <script>, <form>, etc) to be |
| 1477 | @ generated by <a href="%R/md_rules">Markdown-formatted</a> documents. |
| 1478 | |
| 1479 | DDED src/wiki-rules.txt |
+123
-8
| --- a/src/wiki-rules.txt | ||
| +++ b/src/wiki-rules.txt | ||
| @@ -1,10 +1,125 @@ | ||
| 1 | 1 | <h2>Wiki Formatting Rule Summary</h2> |
| 2 | 2 | |
| 3 | - # Blank lines are paragraph breaks | |
| 4 | - # Bullets are "*" surrounded by two spaces at the beginning of a line | |
| 5 | - # Enumeration items are "#" or a digit and a "." surrounded by two | |
| 6 | - spaces at the beginning of a line | |
| 7 | - # Indented paragraphs begin with a tab or two spaces | |
| 8 | - # Hyperlinks are contained within square brackets: | |
| 9 | - <nowiki>"<b>[</b><i>target</i><b>]</b>" | |
| 10 | - or "<b>[</b><i>target</i><b>|</b><i>lab or "<b>< | |
| 3 | +<ol> | |
| 4 | +<li> Blank lines are paragraph breaks | |
| 5 | +<li> Bullets are "*" surrounded by two spaces at the beginning of a line | |
| 6 | +<li> Enumeration items are "#" or a digit and a "." surrounded by two | |
| 7 | + spaces at the beginning of a line | |
| 8 | +<li> Indented paragraphs begin with a tab or two spaces | |
| 9 | +<li> Hyperlinks in square brackets: | |
| 10 | + "<b>[</b><i>target</i><b>]</b>" | |
| 11 | + or "<b>[</b><i>target</i><b>|</b><i>label</i><b>]</b>" | |
| 12 | + or "<b><</b><i>URL</i><b>></b>" | |
| 13 | ++<li> Hyperlinks in angle brackets: "<b><</b><i>URL</i><b>></b>" | |
| 14 | ++<li> Markdown-style hyperlinks: | |
| 15 | ++ "<b>[</b><i>label</i><b>](</b><i>target</i><b>)</b>" | |
| 16 | +<li> Most ordinary HTML works | |
| 17 | ++<li> Fonts: "<b>*</b><i>italic</i><b>*</b>", | |
| 18 | ++ "<b>**</b><i>bold</i><b>**</b>", | |
| 19 | ++ "<b>`</b><i>teletype</i><b>`</b>". | |
| 20 | ++<li> Backslash escapes: <b>\< \[ \* \_  | |
| 21 | ++ \> \\</b> <i>and so forth....</i> | |
| 22 | +<li> <verbatim> and <nowiki> | |
| 23 | +</ol> | |
| 24 | + | |
| 25 | +<h2>Formatting Rule Details</h2> | |
| 26 | + | |
| 27 | +<ol> | |
| 28 | +<li> <p><b>Paragraphs.</b> | |
| 29 | + Any sequence of one or more blank lines forms a paragraph break. | |
| 30 | + Centered or right-justified paragraphs are not supported by wiki markup, | |
| 31 | + but you can do these things if you need them using HTML. | |
| 32 | + | |
| 33 | +<li> <p><b>Bullet Lists.</b> | |
| 34 | + A bullet list item is a line that begins with a single "*" character | |
| 35 | + surrounded on both sides by two or more spaces or by a tab. | |
| 36 | + Only a single level of bullet list is supported by wiki. | |
| 37 | + For nested lists, use HTML. | |
| 38 | + | |
| 39 | +<li> <p><b>Enumeration Lists.</b> | |
| 40 | + An enumeration list item is a line that begins with a single "#" | |
| 41 | + character surrounded on both sides by two or more spaces or by a tab. | |
| 42 | + Or it can be a number and a "." (ex: "5.") surrounded on both sides | |
| 43 | + by two spaces or a tab. | |
| 44 | + Only a single level of enumeration list is supported by wiki. | |
| 45 | + For nested lists or for enumerations that count using letters or | |
| 46 | + roman numerals, use HTML. | |
| 47 | + | |
| 48 | +<li> <p><b>Indented Paragraphs.</b> | |
| 49 | + Any paragraph that begins with two or more spaces or a tab and which | |
| 50 | + is not a bullet or enumeration list item is rendered indented. | |
| 51 | + Only a single level of indentation is supported by wiki. | |
| 52 | + Use HTML for deeper indentation. | |
| 53 | + | |
| 54 | +<li> <p><b>Hyperlinks.</b> | |
| 55 | + Text within square brackets ("[...]") becomes a | |
| 56 | + hyperlink. The target can be a wiki page name, the artifact ID of | |
| 57 | + a check-in or ticket, the name of an image, a URL, or an | |
| 58 | + [#intermap|interwiki link] of the form | |
| 59 | + "<i>Tag</i><b>:</b><i>PageName</i>". | |
| 60 | + By default, the target is displayed as the text of the hyperlink. | |
| 61 | + But you can specify alternative text after the target name | |
| 62 | + separated by a "|" character. | |
| 63 | + You can also link to internal anchor names using | |
| 64 | + [#anchor-name], providing you have added the necessary | |
| 65 | + "<a name='anchor-name'></a>" tag to your wiki page. | |
| 66 | + | |
| 67 | ++<li> <p><b>Auto-links</b> | |
| 68 | ++ A URL that begins with "http://" or "https://" and that is | |
| 69 | ++ enclosed in <...> functions as a hyperlink. | |
| 70 | ++ | |
| 71 | ++ | |
| 72 | ++<li> <p><b>Markdown-style hyperlinks</b> | |
| 73 | ++ Links of the form | |
| 74 | ++ "<b>[</b><i>display-text</i><b>](</b><i>target</i><b>)</b>" | |
| 75 | ++ show "<i>display-text</i>" on screen and make it a hyperlin | |
| 76 | ++ to "<i>target</i>". | |
| 77 | + | |
| 78 | +<li> <p><b>HTML.</b> | |
| 79 | + The following standard HTML elements may be used: | |
| 80 | + <a> <address> <article> <aside> <b> | |
| 81 | + <big> <blockquote> <br> <center> <cite> | |
| 82 | + <code> <col> <colgroup> <dd> | |
| 83 | + <del> <dfn> | |
| 84 | + <div> <dl> <dt> <em> <font> <footer> | |
| 85 | + <ins> | |
| 86 | + <h1> <h2> <h3> <h4> <h5> <h6> | |
| 87 | + <header> <hr> <i> <img> <kbd> <li> | |
| 88 | + <nav> <nobr> <nowiki> <ol> <p> <pre> | |
| 89 | + <s> <samp> <section> <small> <span> | |
| 90 | + <strike> <strong> <sub> <sup> <table> | |
| 91 | + <tbody> <td> <tfoot> <th> <thead> | |
| 92 | + <title> <tr> <tt> <u> <ul> <var> | |
| 93 | + <verbatim>. There are two non-standard elements available: | |
| 94 | + <verbatim> and <nowiki>. No other elements are allowed. | |
| 95 | + All attributes are checked and only a few benign attributes are | |
| 96 | + allowed on each element. In particular, any attributes that specify | |
| 97 | + javascript or CSS are elided. | |
| 98 | + | |
| 99 | ++<li> <p><b>Font Markup.</b> | |
| 100 | ++ Text enclosed within "<tt>*...*</tt>" or "<tt>_..._</tt>" is | |
| 101 | ++ emphasized (italic font). Text within "<tt>**...**</tt>" or | |
| 102 | ++ "<tt>__...__</tt>" gets strong emphasis (bold font). | |
| 103 | ++ Text within "<tt>`...`</tt>" is rendered literally using a | |
| 104 | ++ constant-width font. Special characters (ex: "<" or "[") within | |
| 105 | ++ "<tt>`...`</tt>" lose their special meaning and are rendered | |
| 106 | ++ literally. | |
| 107 | ++ | |
| 108 | ++<li> <p><b>Backslash escapes.</b> | |
| 109 | ++ A backslash followed by any other character is rendered as just | |
| 110 | ++ the other character. The character that follows the backslash | |
| 111 | ++ loses any special meaning it might have had otherwise. This is | |
| 112 | ++ useful for escaping markup for literal display. | |
| 113 | + | |
| 114 | +<li> <p><b>Special Markup.</b> | |
| 115 | + The <nowiki> tag disables all wiki formatting rules through | |
| 116 | + the matching </nowiki> element. The <verbatim> tag works | |
| 117 | + like <pre> with the addition that it also disables all wiki | |
| 118 | + and HTML markup through the matching </verbatim>. | |
| 119 | + Text within | |
| 120 | + <tt><verbatim type="pikchr">...</verbatim></tt> | |
| 121 | + is formatted using <a href="https://pikchr.org/home">Pikchr</a>. | |
| 122 | +</ol> | |
| 123 | + | |
| 124 | +<a name="intermap"></a> | |
| 125 | +<h2>Interwiki Tag [/intermap|Map]</h2> |
| --- a/src/wiki-rules.txt | |
| +++ b/src/wiki-rules.txt | |
| @@ -1,10 +1,125 @@ | |
| 1 | <h2>Wiki Formatting Rule Summary</h2> |
| 2 | |
| 3 | # Blank lines are paragraph breaks |
| 4 | # Bullets are "*" surrounded by two spaces at the beginning of a line |
| 5 | # Enumeration items are "#" or a digit and a "." surrounded by two |
| 6 | spaces at the beginning of a line |
| 7 | # Indented paragraphs begin with a tab or two spaces |
| 8 | # Hyperlinks are contained within square brackets: |
| 9 | <nowiki>"<b>[</b><i>target</i><b>]</b>" |
| 10 | or "<b>[</b><i>target</i><b>|</b><i>lab or "<b>< |
| --- a/src/wiki-rules.txt | |
| +++ b/src/wiki-rules.txt | |
| @@ -1,10 +1,125 @@ | |
| 1 | <h2>Wiki Formatting Rule Summary</h2> |
| 2 | |
| 3 | <ol> |
| 4 | <li> Blank lines are paragraph breaks |
| 5 | <li> Bullets are "*" surrounded by two spaces at the beginning of a line |
| 6 | <li> Enumeration items are "#" or a digit and a "." surrounded by two |
| 7 | spaces at the beginning of a line |
| 8 | <li> Indented paragraphs begin with a tab or two spaces |
| 9 | <li> Hyperlinks in square brackets: |
| 10 | "<b>[</b><i>target</i><b>]</b>" |
| 11 | or "<b>[</b><i>target</i><b>|</b><i>label</i><b>]</b>" |
| 12 | or "<b><</b><i>URL</i><b>></b>" |
| 13 | +<li> Hyperlinks in angle brackets: "<b><</b><i>URL</i><b>></b>" |
| 14 | +<li> Markdown-style hyperlinks: |
| 15 | + "<b>[</b><i>label</i><b>](</b><i>target</i><b>)</b>" |
| 16 | <li> Most ordinary HTML works |
| 17 | +<li> Fonts: "<b>*</b><i>italic</i><b>*</b>", |
| 18 | + "<b>**</b><i>bold</i><b>**</b>", |
| 19 | + "<b>`</b><i>teletype</i><b>`</b>". |
| 20 | +<li> Backslash escapes: <b>\< \[ \* \_  |
| 21 | + \> \\</b> <i>and so forth....</i> |
| 22 | <li> <verbatim> and <nowiki> |
| 23 | </ol> |
| 24 | |
| 25 | <h2>Formatting Rule Details</h2> |
| 26 | |
| 27 | <ol> |
| 28 | <li> <p><b>Paragraphs.</b> |
| 29 | Any sequence of one or more blank lines forms a paragraph break. |
| 30 | Centered or right-justified paragraphs are not supported by wiki markup, |
| 31 | but you can do these things if you need them using HTML. |
| 32 | |
| 33 | <li> <p><b>Bullet Lists.</b> |
| 34 | A bullet list item is a line that begins with a single "*" character |
| 35 | surrounded on both sides by two or more spaces or by a tab. |
| 36 | Only a single level of bullet list is supported by wiki. |
| 37 | For nested lists, use HTML. |
| 38 | |
| 39 | <li> <p><b>Enumeration Lists.</b> |
| 40 | An enumeration list item is a line that begins with a single "#" |
| 41 | character surrounded on both sides by two or more spaces or by a tab. |
| 42 | Or it can be a number and a "." (ex: "5.") surrounded on both sides |
| 43 | by two spaces or a tab. |
| 44 | Only a single level of enumeration list is supported by wiki. |
| 45 | For nested lists or for enumerations that count using letters or |
| 46 | roman numerals, use HTML. |
| 47 | |
| 48 | <li> <p><b>Indented Paragraphs.</b> |
| 49 | Any paragraph that begins with two or more spaces or a tab and which |
| 50 | is not a bullet or enumeration list item is rendered indented. |
| 51 | Only a single level of indentation is supported by wiki. |
| 52 | Use HTML for deeper indentation. |
| 53 | |
| 54 | <li> <p><b>Hyperlinks.</b> |
| 55 | Text within square brackets ("[...]") becomes a |
| 56 | hyperlink. The target can be a wiki page name, the artifact ID of |
| 57 | a check-in or ticket, the name of an image, a URL, or an |
| 58 | [#intermap|interwiki link] of the form |
| 59 | "<i>Tag</i><b>:</b><i>PageName</i>". |
| 60 | By default, the target is displayed as the text of the hyperlink. |
| 61 | But you can specify alternative text after the target name |
| 62 | separated by a "|" character. |
| 63 | You can also link to internal anchor names using |
| 64 | [#anchor-name], providing you have added the necessary |
| 65 | "<a name='anchor-name'></a>" tag to your wiki page. |
| 66 | |
| 67 | +<li> <p><b>Auto-links</b> |
| 68 | + A URL that begins with "http://" or "https://" and that is |
| 69 | + enclosed in <...> functions as a hyperlink. |
| 70 | + |
| 71 | + |
| 72 | +<li> <p><b>Markdown-style hyperlinks</b> |
| 73 | + Links of the form |
| 74 | + "<b>[</b><i>display-text</i><b>](</b><i>target</i><b>)</b>" |
| 75 | + show "<i>display-text</i>" on screen and make it a hyperlin |
| 76 | + to "<i>target</i>". |
| 77 | |
| 78 | <li> <p><b>HTML.</b> |
| 79 | The following standard HTML elements may be used: |
| 80 | <a> <address> <article> <aside> <b> |
| 81 | <big> <blockquote> <br> <center> <cite> |
| 82 | <code> <col> <colgroup> <dd> |
| 83 | <del> <dfn> |
| 84 | <div> <dl> <dt> <em> <font> <footer> |
| 85 | <ins> |
| 86 | <h1> <h2> <h3> <h4> <h5> <h6> |
| 87 | <header> <hr> <i> <img> <kbd> <li> |
| 88 | <nav> <nobr> <nowiki> <ol> <p> <pre> |
| 89 | <s> <samp> <section> <small> <span> |
| 90 | <strike> <strong> <sub> <sup> <table> |
| 91 | <tbody> <td> <tfoot> <th> <thead> |
| 92 | <title> <tr> <tt> <u> <ul> <var> |
| 93 | <verbatim>. There are two non-standard elements available: |
| 94 | <verbatim> and <nowiki>. No other elements are allowed. |
| 95 | All attributes are checked and only a few benign attributes are |
| 96 | allowed on each element. In particular, any attributes that specify |
| 97 | javascript or CSS are elided. |
| 98 | |
| 99 | +<li> <p><b>Font Markup.</b> |
| 100 | + Text enclosed within "<tt>*...*</tt>" or "<tt>_..._</tt>" is |
| 101 | + emphasized (italic font). Text within "<tt>**...**</tt>" or |
| 102 | + "<tt>__...__</tt>" gets strong emphasis (bold font). |
| 103 | + Text within "<tt>`...`</tt>" is rendered literally using a |
| 104 | + constant-width font. Special characters (ex: "<" or "[") within |
| 105 | + "<tt>`...`</tt>" lose their special meaning and are rendered |
| 106 | + literally. |
| 107 | + |
| 108 | +<li> <p><b>Backslash escapes.</b> |
| 109 | + A backslash followed by any other character is rendered as just |
| 110 | + the other character. The character that follows the backslash |
| 111 | + loses any special meaning it might have had otherwise. This is |
| 112 | + useful for escaping markup for literal display. |
| 113 | |
| 114 | <li> <p><b>Special Markup.</b> |
| 115 | The <nowiki> tag disables all wiki formatting rules through |
| 116 | the matching </nowiki> element. The <verbatim> tag works |
| 117 | like <pre> with the addition that it also disables all wiki |
| 118 | and HTML markup through the matching </verbatim>. |
| 119 | Text within |
| 120 | <tt><verbatim type="pikchr">...</verbatim></tt> |
| 121 | is formatted using <a href="https://pikchr.org/home">Pikchr</a>. |
| 122 | </ol> |
| 123 | |
| 124 | <a name="intermap"></a> |
| 125 | <h2>Interwiki Tag [/intermap|Map]</h2> |
+39
-12
| --- src/wiki.c | ||
| +++ src/wiki.c | ||
| @@ -264,26 +264,53 @@ | ||
| 264 | 264 | ** WEBPAGE: wiki_rules |
| 265 | 265 | ** |
| 266 | 266 | ** Show a summary of the wiki formatting rules. |
| 267 | 267 | */ |
| 268 | 268 | void wiki_rules_page(void){ |
| 269 | - Blob x; | |
| 270 | - int fTxt = P("txt")!=0; | |
| 269 | + Blob x, y, line; | |
| 270 | + int bClDflt = db_get_boolean("wiki-classic",0); | |
| 271 | + int bClassic; | |
| 272 | + if( P("classic")!=0 ){ | |
| 273 | + bClassic = 1; | |
| 274 | + }else if( P("enhanced")!=0 ){ | |
| 275 | + bClassic = 0; | |
| 276 | + }else{ | |
| 277 | + bClassic = bClDflt; | |
| 278 | + } | |
| 271 | 279 | style_set_current_feature("wiki"); |
| 272 | 280 | style_header("Wiki Formatting Rules"); |
| 273 | - if( fTxt ){ | |
| 274 | - style_submenu_element("Formatted", "%R/wiki_rules"); | |
| 281 | + style_submenu_element("Markdown","%R/md_rules"); | |
| 282 | + if( bClassic ){ | |
| 283 | + style_submenu_element("Enhanced-Wiki","%R/wiki_rules?enhanced"); | |
| 275 | 284 | }else{ |
| 276 | - style_submenu_element("Plain-Text", "%R/wiki_rules?txt=1"); | |
| 277 | - } | |
| 278 | - style_submenu_element("Markdown","%R/md_rules"); | |
| 279 | - blob_init(&x, builtin_text("wiki.wiki"), -1); | |
| 280 | - blob_materialize(&x); | |
| 281 | - interwiki_append_map_table(&x); | |
| 282 | - safe_html_context(DOCSRC_TRUSTED); | |
| 283 | - wiki_render_by_mimetype(&x, fTxt ? "text/plain" : "text/x-fossil-wiki"); | |
| 285 | + style_submenu_element("Classic-Wiki","%R/wiki_rules?classic"); | |
| 286 | + } | |
| 287 | + if( bClassic && !bClDflt ){ | |
| 288 | + @ <p>NOTE: This repository is set to render wiki text using the | |
| 289 | + @ <a href="%R/wiki_rules">Enhanced Wiki Rules</a>. The following | |
| 290 | + @ describes the Classic Wiki Rules where are a subset of the | |
| 291 | + @ enhanced rules. | |
| 292 | + }else if( !bClassic && bClDflt ){ | |
| 293 | + @ <p>NOTE: This repository is set to render wiki text using the | |
| 294 | + @ <a href="%R/wiki_rules">Classic Wiki Rules</a>. The following | |
| 295 | + @ describes the Enhanced Wiki Rules where are a subset of the | |
| 296 | + @ classic rules. | |
| 297 | + } | |
| 298 | + blob_init(&x, builtin_text("wiki-rules.txt"), -1); | |
| 299 | + blob_init(&y, 0, 0); | |
| 300 | + while( blob_line(&x, &line) ){ | |
| 301 | + if( blob_buffer(&line)[0]!='+' ){ | |
| 302 | + blob_append(&y, blob_buffer(&line), blob_size(&line)); | |
| 303 | + }else if( !bClassic ){ | |
| 304 | + blob_append(&y, blob_buffer(&line)+1, blob_size(&line)-1); | |
| 305 | + } | |
| 306 | + } | |
| 284 | 307 | blob_reset(&x); |
| 308 | + blob_reset(&line); | |
| 309 | + interwiki_append_map_table(&y); | |
| 310 | + cgi_append_content(blob_buffer(&y), blob_size(&y)); | |
| 311 | + blob_reset(&y); | |
| 285 | 312 | style_finish_page(); |
| 286 | 313 | } |
| 287 | 314 | |
| 288 | 315 | /* |
| 289 | 316 | ** WEBPAGE: markup_help |
| 290 | 317 | |
| 291 | 318 | DELETED src/wiki.wiki |
| --- src/wiki.c | |
| +++ src/wiki.c | |
| @@ -264,26 +264,53 @@ | |
| 264 | ** WEBPAGE: wiki_rules |
| 265 | ** |
| 266 | ** Show a summary of the wiki formatting rules. |
| 267 | */ |
| 268 | void wiki_rules_page(void){ |
| 269 | Blob x; |
| 270 | int fTxt = P("txt")!=0; |
| 271 | style_set_current_feature("wiki"); |
| 272 | style_header("Wiki Formatting Rules"); |
| 273 | if( fTxt ){ |
| 274 | style_submenu_element("Formatted", "%R/wiki_rules"); |
| 275 | }else{ |
| 276 | style_submenu_element("Plain-Text", "%R/wiki_rules?txt=1"); |
| 277 | } |
| 278 | style_submenu_element("Markdown","%R/md_rules"); |
| 279 | blob_init(&x, builtin_text("wiki.wiki"), -1); |
| 280 | blob_materialize(&x); |
| 281 | interwiki_append_map_table(&x); |
| 282 | safe_html_context(DOCSRC_TRUSTED); |
| 283 | wiki_render_by_mimetype(&x, fTxt ? "text/plain" : "text/x-fossil-wiki"); |
| 284 | blob_reset(&x); |
| 285 | style_finish_page(); |
| 286 | } |
| 287 | |
| 288 | /* |
| 289 | ** WEBPAGE: markup_help |
| 290 | |
| 291 | ELETED src/wiki.wiki |
| --- src/wiki.c | |
| +++ src/wiki.c | |
| @@ -264,26 +264,53 @@ | |
| 264 | ** WEBPAGE: wiki_rules |
| 265 | ** |
| 266 | ** Show a summary of the wiki formatting rules. |
| 267 | */ |
| 268 | void wiki_rules_page(void){ |
| 269 | Blob x, y, line; |
| 270 | int bClDflt = db_get_boolean("wiki-classic",0); |
| 271 | int bClassic; |
| 272 | if( P("classic")!=0 ){ |
| 273 | bClassic = 1; |
| 274 | }else if( P("enhanced")!=0 ){ |
| 275 | bClassic = 0; |
| 276 | }else{ |
| 277 | bClassic = bClDflt; |
| 278 | } |
| 279 | style_set_current_feature("wiki"); |
| 280 | style_header("Wiki Formatting Rules"); |
| 281 | style_submenu_element("Markdown","%R/md_rules"); |
| 282 | if( bClassic ){ |
| 283 | style_submenu_element("Enhanced-Wiki","%R/wiki_rules?enhanced"); |
| 284 | }else{ |
| 285 | style_submenu_element("Classic-Wiki","%R/wiki_rules?classic"); |
| 286 | } |
| 287 | if( bClassic && !bClDflt ){ |
| 288 | @ <p>NOTE: This repository is set to render wiki text using the |
| 289 | @ <a href="%R/wiki_rules">Enhanced Wiki Rules</a>. The following |
| 290 | @ describes the Classic Wiki Rules where are a subset of the |
| 291 | @ enhanced rules. |
| 292 | }else if( !bClassic && bClDflt ){ |
| 293 | @ <p>NOTE: This repository is set to render wiki text using the |
| 294 | @ <a href="%R/wiki_rules">Classic Wiki Rules</a>. The following |
| 295 | @ describes the Enhanced Wiki Rules where are a subset of the |
| 296 | @ classic rules. |
| 297 | } |
| 298 | blob_init(&x, builtin_text("wiki-rules.txt"), -1); |
| 299 | blob_init(&y, 0, 0); |
| 300 | while( blob_line(&x, &line) ){ |
| 301 | if( blob_buffer(&line)[0]!='+' ){ |
| 302 | blob_append(&y, blob_buffer(&line), blob_size(&line)); |
| 303 | }else if( !bClassic ){ |
| 304 | blob_append(&y, blob_buffer(&line)+1, blob_size(&line)-1); |
| 305 | } |
| 306 | } |
| 307 | blob_reset(&x); |
| 308 | blob_reset(&line); |
| 309 | interwiki_append_map_table(&y); |
| 310 | cgi_append_content(blob_buffer(&y), blob_size(&y)); |
| 311 | blob_reset(&y); |
| 312 | style_finish_page(); |
| 313 | } |
| 314 | |
| 315 | /* |
| 316 | ** WEBPAGE: markup_help |
| 317 | |
| 318 | ELETED src/wiki.wiki |
D
src/wiki.wiki
-10
| --- a/src/wiki.wiki | ||
| +++ b/src/wiki.wiki | ||
| @@ -1,10 +0,0 @@ | ||
| 1 | -<h2>Wiki Formatting Rule Summary</h2> | |
| 2 | - | |
| 3 | - # Blank lines are paragraph breaks | |
| 4 | - # Bullets are "*" surrounded by two spaces at the beginning of a line | |
| 5 | - # Enumeration items are "#" or a digit and a "." surrounded by two | |
| 6 | - spaces at the beginning of a line | |
| 7 | - # Indented paragraphs begin with a tab or two spaces | |
| 8 | - # Hyperlinks are contained within square brackets: | |
| 9 | - <nowiki>"<b>[</b><i>target</i><b>]</b>" | |
| 10 | - or "<b>[</b><i>target</i><b>|</b><i>lab or "<b>< |
| --- a/src/wiki.wiki | |
| +++ b/src/wiki.wiki | |
| @@ -1,10 +0,0 @@ | |
| 1 | <h2>Wiki Formatting Rule Summary</h2> |
| 2 | |
| 3 | # Blank lines are paragraph breaks |
| 4 | # Bullets are "*" surrounded by two spaces at the beginning of a line |
| 5 | # Enumeration items are "#" or a digit and a "." surrounded by two |
| 6 | spaces at the beginning of a line |
| 7 | # Indented paragraphs begin with a tab or two spaces |
| 8 | # Hyperlinks are contained within square brackets: |
| 9 | <nowiki>"<b>[</b><i>target</i><b>]</b>" |
| 10 | or "<b>[</b><i>target</i><b>|</b><i>lab or "<b>< |
| --- a/src/wiki.wiki | |
| +++ b/src/wiki.wiki | |
| @@ -1,10 +0,0 @@ | |
+61
-18
| --- src/wikiformat.c | ||
| +++ src/wikiformat.c | ||
| @@ -500,10 +500,23 @@ | ||
| 500 | 500 | short allowWiki; /* ALLOW_WIKI if wiki allowed before tag */ |
| 501 | 501 | const char *zId; /* ID attribute or NULL */ |
| 502 | 502 | } *aStack; |
| 503 | 503 | }; |
| 504 | 504 | |
| 505 | + | |
| 506 | +/* | |
| 507 | +** SETTING: wiki-use-html boolean default=off | |
| 508 | +** | |
| 509 | +** If enabled, recognize only HTML in Fossil Wiki text. Other wiki markup | |
| 510 | +** is ignored. In other words, this setting make HTML the wiki markup | |
| 511 | +** language. | |
| 512 | +** | |
| 513 | +** CAUTION: When enabled, this setting allows *all* HTML text through, | |
| 514 | +** unsanitized. Only use this setting in closed environments where all | |
| 515 | +** inputs are from trusted users, as the ability to inject arbitrary | |
| 516 | +** HTML can be misused by rapscallions. | |
| 517 | +*/ | |
| 505 | 518 | /* |
| 506 | 519 | ** Return TRUE if HTML should be used as the sole markup language for wiki. |
| 507 | 520 | ** |
| 508 | 521 | ** On first invocation, this routine consults the "wiki-use-html" setting. |
| 509 | 522 | ** It caches the result for subsequent invocations, under the assumption |
| @@ -512,10 +525,37 @@ | ||
| 512 | 525 | static int wikiUsesHtml(void){ |
| 513 | 526 | static int r = -1; |
| 514 | 527 | if( r<0 ) r = db_get_boolean("wiki-use-html", 0); |
| 515 | 528 | return r; |
| 516 | 529 | } |
| 530 | + | |
| 531 | +/* | |
| 532 | +** SETTING: wiki-classic boolean default=off | |
| 533 | +** | |
| 534 | +** When enabled, this setting causes Fossil Wiki text to be rendered | |
| 535 | +** in the original circa-2007 style which omits the enhancements added | |
| 536 | +** in 2025. Enable this setting if you have an older repository with | |
| 537 | +** a lot of wiki-formatted text that does not render well using the | |
| 538 | +** new enhancements. | |
| 539 | +** | |
| 540 | +** The specific wiki formatting enhancements that are disabled when | |
| 541 | +** then setting is turned on are: | |
| 542 | +** | |
| 543 | +** * Markdown hyperlinks: [display-text](URL) | |
| 544 | +** * Bracket hyperlinks: <URL> | |
| 545 | +** * Font changes: *italic* **bold** `teletype` | |
| 546 | +** * Backslash escapes: \\< \\[ \\* \\' \\_ \\\\ and so forth | |
| 547 | +*/ | |
| 548 | +/* | |
| 549 | +** Return TRUE limit wiki formatting to the classic circa-2007 style | |
| 550 | +** and omit the 2025 enhancements. | |
| 551 | +*/ | |
| 552 | +static int wikiClassic(void){ | |
| 553 | + static int r = -1; | |
| 554 | + if( r<0 ) r = db_get_boolean("wiki-classic", 0); | |
| 555 | + return r; | |
| 556 | +} | |
| 517 | 557 | |
| 518 | 558 | /* |
| 519 | 559 | ** z points to a "<" character. Check to see if this is the start of |
| 520 | 560 | ** a valid markup. If it is, return the total number of characters in |
| 521 | 561 | ** the markup including the initial "<" and the terminating ">". If |
| @@ -2066,10 +2106,17 @@ | ||
| 2066 | 2106 | Renderer renderer; |
| 2067 | 2107 | |
| 2068 | 2108 | memset(&renderer, 0, sizeof(renderer)); |
| 2069 | 2109 | renderer.renderFlags = flags; |
| 2070 | 2110 | renderer.state = ALLOW_WIKI|AT_NEWLINE|AT_PARAGRAPH|flags; |
| 2111 | + if( (flags & WIKI_OVERRIDE)==0 ){ | |
| 2112 | + if( wikiClassic() ){ | |
| 2113 | + renderer.state &= ~(WIKI_MARKDOWN_INLINE); | |
| 2114 | + }else{ | |
| 2115 | + renderer.state |= WIKI_MARKDOWN_INLINE; | |
| 2116 | + } | |
| 2117 | + } | |
| 2071 | 2118 | if( flags & WIKI_INLINE ){ |
| 2072 | 2119 | renderer.wantAutoParagraph = 0; |
| 2073 | 2120 | }else{ |
| 2074 | 2121 | renderer.wantAutoParagraph = 1; |
| 2075 | 2122 | } |
| @@ -2133,12 +2180,14 @@ | ||
| 2133 | 2180 | ** |
| 2134 | 2181 | ** Translate the input FILE from Fossil-wiki into HTML and write |
| 2135 | 2182 | ** the resulting HTML on standard output. |
| 2136 | 2183 | ** |
| 2137 | 2184 | ** Options: |
| 2138 | -** --buttons Set the WIKI_BUTTONS flag | |
| 2185 | +** --buttons Set the WIKI_BUTTONS flag | |
| 2186 | +** --classic Use only classic wiki rules | |
| 2139 | 2187 | ** --dark-pikchr Render pikchrs in dark mode |
| 2188 | +** --enhanced Use 2025 enhanced wiki rules | |
| 2140 | 2189 | ** --htmlonly Set the WIKI_HTMLONLY flag |
| 2141 | 2190 | ** --inline Set the WIKI_INLINE flag |
| 2142 | 2191 | ** --linksonly Set the WIKI_LINKSONLY flag |
| 2143 | 2192 | ** --markdown Allow all in-line markdown syntax |
| 2144 | 2193 | ** --markdown-link Allow markdown hyperlink syntax |
| @@ -2151,10 +2200,17 @@ | ||
| 2151 | 2200 | void test_wiki_render(void){ |
| 2152 | 2201 | Blob in, out; |
| 2153 | 2202 | int flags = ALLOW_LINKS; |
| 2154 | 2203 | int bText, bTokenize; |
| 2155 | 2204 | if( find_option("buttons",0,0)!=0 ) flags |= WIKI_BUTTONS; |
| 2205 | + if( find_option("classic",0,0)!=0 ){ | |
| 2206 | + flags |= WIKI_OVERRIDE; | |
| 2207 | + flags &= ~(WIKI_MARKDOWN_INLINE); | |
| 2208 | + } | |
| 2209 | + if( find_option("enhanced",0,0)!=0 ){ | |
| 2210 | + flags |= WIKI_OVERRIDE|WIKI_MARKDOWN_INLINE; | |
| 2211 | + } | |
| 2156 | 2212 | if( find_option("htmlonly",0,0)!=0 ) flags |= WIKI_HTMLONLY; |
| 2157 | 2213 | if( find_option("linksonly",0,0)!=0 ) flags |= WIKI_LINKSONLY; |
| 2158 | 2214 | if( find_option("nobadlinks",0,0)!=0 ) flags |= WIKI_NOBADLINKS; |
| 2159 | 2215 | if( find_option("inline",0,0)!=0 ) flags |= WIKI_INLINE; |
| 2160 | 2216 | if( find_option("noblock",0,0)!=0 ) flags |= WIKI_NOBLOCK; |
| @@ -2281,10 +2337,11 @@ | ||
| 2281 | 2337 | /* |
| 2282 | 2338 | ** Parse text looking for wiki hyperlinks in one of the formats: |
| 2283 | 2339 | ** |
| 2284 | 2340 | ** [target] |
| 2285 | 2341 | ** [target|...] |
| 2342 | +** [display](target) | |
| 2286 | 2343 | ** |
| 2287 | 2344 | ** Where "target" can be either an artifact ID prefix or a wiki page |
| 2288 | 2345 | ** name. For each such hyperlink found, add an entry to the |
| 2289 | 2346 | ** backlink table. |
| 2290 | 2347 | */ |
| @@ -2295,30 +2352,16 @@ | ||
| 2295 | 2352 | ){ |
| 2296 | 2353 | Renderer renderer; |
| 2297 | 2354 | int tokenType; |
| 2298 | 2355 | ParsedMarkup markup; |
| 2299 | 2356 | int n; |
| 2300 | - int inlineOnly; | |
| 2301 | - int wikiHtmlOnly = 0; | |
| 2302 | 2357 | |
| 2303 | 2358 | memset(&renderer, 0, sizeof(renderer)); |
| 2304 | - renderer.state = ALLOW_WIKI|AT_NEWLINE|AT_PARAGRAPH; | |
| 2305 | - if( flags & WIKI_NOBLOCK ){ | |
| 2306 | - renderer.state |= INLINE_MARKUP_ONLY; | |
| 2307 | - } | |
| 2308 | - if( wikiUsesHtml() ){ | |
| 2309 | - renderer.state |= WIKI_HTMLONLY; | |
| 2310 | - wikiHtmlOnly = 1; | |
| 2311 | - } | |
| 2312 | - inlineOnly = (renderer.state & INLINE_MARKUP_ONLY)!=0; | |
| 2359 | + renderer.state = ALLOW_WIKI; | |
| 2313 | 2360 | |
| 2314 | 2361 | while( z[0] ){ |
| 2315 | - if( wikiHtmlOnly ){ | |
| 2316 | - n = nextRawToken(z, &renderer, &tokenType); | |
| 2317 | - }else{ | |
| 2318 | - n = nextWikiToken(z, &renderer, &tokenType); | |
| 2319 | - } | |
| 2362 | + n = nextWikiToken(z, &renderer, &tokenType); | |
| 2320 | 2363 | switch( tokenType ){ |
| 2321 | 2364 | case TOKEN_LINK: { |
| 2322 | 2365 | char *zTarget, *zEnd; |
| 2323 | 2366 | int i; |
| 2324 | 2367 | |
| @@ -2402,11 +2445,11 @@ | ||
| 2402 | 2445 | } |
| 2403 | 2446 | }else |
| 2404 | 2447 | |
| 2405 | 2448 | /* Ignore block markup for in-line rendering. |
| 2406 | 2449 | */ |
| 2407 | - if( inlineOnly && (markup.iType&MUTYPE_INLINE)==0 ){ | |
| 2450 | + if( (markup.iType & MUTYPE_INLINE)==0 ){ | |
| 2408 | 2451 | /* Do nothing */ |
| 2409 | 2452 | }else |
| 2410 | 2453 | |
| 2411 | 2454 | /* Generate end-tags */ |
| 2412 | 2455 | if( markup.endTag ){ |
| 2413 | 2456 |
| --- src/wikiformat.c | |
| +++ src/wikiformat.c | |
| @@ -500,10 +500,23 @@ | |
| 500 | short allowWiki; /* ALLOW_WIKI if wiki allowed before tag */ |
| 501 | const char *zId; /* ID attribute or NULL */ |
| 502 | } *aStack; |
| 503 | }; |
| 504 | |
| 505 | /* |
| 506 | ** Return TRUE if HTML should be used as the sole markup language for wiki. |
| 507 | ** |
| 508 | ** On first invocation, this routine consults the "wiki-use-html" setting. |
| 509 | ** It caches the result for subsequent invocations, under the assumption |
| @@ -512,10 +525,37 @@ | |
| 512 | static int wikiUsesHtml(void){ |
| 513 | static int r = -1; |
| 514 | if( r<0 ) r = db_get_boolean("wiki-use-html", 0); |
| 515 | return r; |
| 516 | } |
| 517 | |
| 518 | /* |
| 519 | ** z points to a "<" character. Check to see if this is the start of |
| 520 | ** a valid markup. If it is, return the total number of characters in |
| 521 | ** the markup including the initial "<" and the terminating ">". If |
| @@ -2066,10 +2106,17 @@ | |
| 2066 | Renderer renderer; |
| 2067 | |
| 2068 | memset(&renderer, 0, sizeof(renderer)); |
| 2069 | renderer.renderFlags = flags; |
| 2070 | renderer.state = ALLOW_WIKI|AT_NEWLINE|AT_PARAGRAPH|flags; |
| 2071 | if( flags & WIKI_INLINE ){ |
| 2072 | renderer.wantAutoParagraph = 0; |
| 2073 | }else{ |
| 2074 | renderer.wantAutoParagraph = 1; |
| 2075 | } |
| @@ -2133,12 +2180,14 @@ | |
| 2133 | ** |
| 2134 | ** Translate the input FILE from Fossil-wiki into HTML and write |
| 2135 | ** the resulting HTML on standard output. |
| 2136 | ** |
| 2137 | ** Options: |
| 2138 | ** --buttons Set the WIKI_BUTTONS flag |
| 2139 | ** --dark-pikchr Render pikchrs in dark mode |
| 2140 | ** --htmlonly Set the WIKI_HTMLONLY flag |
| 2141 | ** --inline Set the WIKI_INLINE flag |
| 2142 | ** --linksonly Set the WIKI_LINKSONLY flag |
| 2143 | ** --markdown Allow all in-line markdown syntax |
| 2144 | ** --markdown-link Allow markdown hyperlink syntax |
| @@ -2151,10 +2200,17 @@ | |
| 2151 | void test_wiki_render(void){ |
| 2152 | Blob in, out; |
| 2153 | int flags = ALLOW_LINKS; |
| 2154 | int bText, bTokenize; |
| 2155 | if( find_option("buttons",0,0)!=0 ) flags |= WIKI_BUTTONS; |
| 2156 | if( find_option("htmlonly",0,0)!=0 ) flags |= WIKI_HTMLONLY; |
| 2157 | if( find_option("linksonly",0,0)!=0 ) flags |= WIKI_LINKSONLY; |
| 2158 | if( find_option("nobadlinks",0,0)!=0 ) flags |= WIKI_NOBADLINKS; |
| 2159 | if( find_option("inline",0,0)!=0 ) flags |= WIKI_INLINE; |
| 2160 | if( find_option("noblock",0,0)!=0 ) flags |= WIKI_NOBLOCK; |
| @@ -2281,10 +2337,11 @@ | |
| 2281 | /* |
| 2282 | ** Parse text looking for wiki hyperlinks in one of the formats: |
| 2283 | ** |
| 2284 | ** [target] |
| 2285 | ** [target|...] |
| 2286 | ** |
| 2287 | ** Where "target" can be either an artifact ID prefix or a wiki page |
| 2288 | ** name. For each such hyperlink found, add an entry to the |
| 2289 | ** backlink table. |
| 2290 | */ |
| @@ -2295,30 +2352,16 @@ | |
| 2295 | ){ |
| 2296 | Renderer renderer; |
| 2297 | int tokenType; |
| 2298 | ParsedMarkup markup; |
| 2299 | int n; |
| 2300 | int inlineOnly; |
| 2301 | int wikiHtmlOnly = 0; |
| 2302 | |
| 2303 | memset(&renderer, 0, sizeof(renderer)); |
| 2304 | renderer.state = ALLOW_WIKI|AT_NEWLINE|AT_PARAGRAPH; |
| 2305 | if( flags & WIKI_NOBLOCK ){ |
| 2306 | renderer.state |= INLINE_MARKUP_ONLY; |
| 2307 | } |
| 2308 | if( wikiUsesHtml() ){ |
| 2309 | renderer.state |= WIKI_HTMLONLY; |
| 2310 | wikiHtmlOnly = 1; |
| 2311 | } |
| 2312 | inlineOnly = (renderer.state & INLINE_MARKUP_ONLY)!=0; |
| 2313 | |
| 2314 | while( z[0] ){ |
| 2315 | if( wikiHtmlOnly ){ |
| 2316 | n = nextRawToken(z, &renderer, &tokenType); |
| 2317 | }else{ |
| 2318 | n = nextWikiToken(z, &renderer, &tokenType); |
| 2319 | } |
| 2320 | switch( tokenType ){ |
| 2321 | case TOKEN_LINK: { |
| 2322 | char *zTarget, *zEnd; |
| 2323 | int i; |
| 2324 | |
| @@ -2402,11 +2445,11 @@ | |
| 2402 | } |
| 2403 | }else |
| 2404 | |
| 2405 | /* Ignore block markup for in-line rendering. |
| 2406 | */ |
| 2407 | if( inlineOnly && (markup.iType&MUTYPE_INLINE)==0 ){ |
| 2408 | /* Do nothing */ |
| 2409 | }else |
| 2410 | |
| 2411 | /* Generate end-tags */ |
| 2412 | if( markup.endTag ){ |
| 2413 |
| --- src/wikiformat.c | |
| +++ src/wikiformat.c | |
| @@ -500,10 +500,23 @@ | |
| 500 | short allowWiki; /* ALLOW_WIKI if wiki allowed before tag */ |
| 501 | const char *zId; /* ID attribute or NULL */ |
| 502 | } *aStack; |
| 503 | }; |
| 504 | |
| 505 | |
| 506 | /* |
| 507 | ** SETTING: wiki-use-html boolean default=off |
| 508 | ** |
| 509 | ** If enabled, recognize only HTML in Fossil Wiki text. Other wiki markup |
| 510 | ** is ignored. In other words, this setting make HTML the wiki markup |
| 511 | ** language. |
| 512 | ** |
| 513 | ** CAUTION: When enabled, this setting allows *all* HTML text through, |
| 514 | ** unsanitized. Only use this setting in closed environments where all |
| 515 | ** inputs are from trusted users, as the ability to inject arbitrary |
| 516 | ** HTML can be misused by rapscallions. |
| 517 | */ |
| 518 | /* |
| 519 | ** Return TRUE if HTML should be used as the sole markup language for wiki. |
| 520 | ** |
| 521 | ** On first invocation, this routine consults the "wiki-use-html" setting. |
| 522 | ** It caches the result for subsequent invocations, under the assumption |
| @@ -512,10 +525,37 @@ | |
| 525 | static int wikiUsesHtml(void){ |
| 526 | static int r = -1; |
| 527 | if( r<0 ) r = db_get_boolean("wiki-use-html", 0); |
| 528 | return r; |
| 529 | } |
| 530 | |
| 531 | /* |
| 532 | ** SETTING: wiki-classic boolean default=off |
| 533 | ** |
| 534 | ** When enabled, this setting causes Fossil Wiki text to be rendered |
| 535 | ** in the original circa-2007 style which omits the enhancements added |
| 536 | ** in 2025. Enable this setting if you have an older repository with |
| 537 | ** a lot of wiki-formatted text that does not render well using the |
| 538 | ** new enhancements. |
| 539 | ** |
| 540 | ** The specific wiki formatting enhancements that are disabled when |
| 541 | ** then setting is turned on are: |
| 542 | ** |
| 543 | ** * Markdown hyperlinks: [display-text](URL) |
| 544 | ** * Bracket hyperlinks: <URL> |
| 545 | ** * Font changes: *italic* **bold** `teletype` |
| 546 | ** * Backslash escapes: \\< \\[ \\* \\' \\_ \\\\ and so forth |
| 547 | */ |
| 548 | /* |
| 549 | ** Return TRUE limit wiki formatting to the classic circa-2007 style |
| 550 | ** and omit the 2025 enhancements. |
| 551 | */ |
| 552 | static int wikiClassic(void){ |
| 553 | static int r = -1; |
| 554 | if( r<0 ) r = db_get_boolean("wiki-classic", 0); |
| 555 | return r; |
| 556 | } |
| 557 | |
| 558 | /* |
| 559 | ** z points to a "<" character. Check to see if this is the start of |
| 560 | ** a valid markup. If it is, return the total number of characters in |
| 561 | ** the markup including the initial "<" and the terminating ">". If |
| @@ -2066,10 +2106,17 @@ | |
| 2106 | Renderer renderer; |
| 2107 | |
| 2108 | memset(&renderer, 0, sizeof(renderer)); |
| 2109 | renderer.renderFlags = flags; |
| 2110 | renderer.state = ALLOW_WIKI|AT_NEWLINE|AT_PARAGRAPH|flags; |
| 2111 | if( (flags & WIKI_OVERRIDE)==0 ){ |
| 2112 | if( wikiClassic() ){ |
| 2113 | renderer.state &= ~(WIKI_MARKDOWN_INLINE); |
| 2114 | }else{ |
| 2115 | renderer.state |= WIKI_MARKDOWN_INLINE; |
| 2116 | } |
| 2117 | } |
| 2118 | if( flags & WIKI_INLINE ){ |
| 2119 | renderer.wantAutoParagraph = 0; |
| 2120 | }else{ |
| 2121 | renderer.wantAutoParagraph = 1; |
| 2122 | } |
| @@ -2133,12 +2180,14 @@ | |
| 2180 | ** |
| 2181 | ** Translate the input FILE from Fossil-wiki into HTML and write |
| 2182 | ** the resulting HTML on standard output. |
| 2183 | ** |
| 2184 | ** Options: |
| 2185 | ** --buttons Set the WIKI_BUTTONS flag |
| 2186 | ** --classic Use only classic wiki rules |
| 2187 | ** --dark-pikchr Render pikchrs in dark mode |
| 2188 | ** --enhanced Use 2025 enhanced wiki rules |
| 2189 | ** --htmlonly Set the WIKI_HTMLONLY flag |
| 2190 | ** --inline Set the WIKI_INLINE flag |
| 2191 | ** --linksonly Set the WIKI_LINKSONLY flag |
| 2192 | ** --markdown Allow all in-line markdown syntax |
| 2193 | ** --markdown-link Allow markdown hyperlink syntax |
| @@ -2151,10 +2200,17 @@ | |
| 2200 | void test_wiki_render(void){ |
| 2201 | Blob in, out; |
| 2202 | int flags = ALLOW_LINKS; |
| 2203 | int bText, bTokenize; |
| 2204 | if( find_option("buttons",0,0)!=0 ) flags |= WIKI_BUTTONS; |
| 2205 | if( find_option("classic",0,0)!=0 ){ |
| 2206 | flags |= WIKI_OVERRIDE; |
| 2207 | flags &= ~(WIKI_MARKDOWN_INLINE); |
| 2208 | } |
| 2209 | if( find_option("enhanced",0,0)!=0 ){ |
| 2210 | flags |= WIKI_OVERRIDE|WIKI_MARKDOWN_INLINE; |
| 2211 | } |
| 2212 | if( find_option("htmlonly",0,0)!=0 ) flags |= WIKI_HTMLONLY; |
| 2213 | if( find_option("linksonly",0,0)!=0 ) flags |= WIKI_LINKSONLY; |
| 2214 | if( find_option("nobadlinks",0,0)!=0 ) flags |= WIKI_NOBADLINKS; |
| 2215 | if( find_option("inline",0,0)!=0 ) flags |= WIKI_INLINE; |
| 2216 | if( find_option("noblock",0,0)!=0 ) flags |= WIKI_NOBLOCK; |
| @@ -2281,10 +2337,11 @@ | |
| 2337 | /* |
| 2338 | ** Parse text looking for wiki hyperlinks in one of the formats: |
| 2339 | ** |
| 2340 | ** [target] |
| 2341 | ** [target|...] |
| 2342 | ** [display](target) |
| 2343 | ** |
| 2344 | ** Where "target" can be either an artifact ID prefix or a wiki page |
| 2345 | ** name. For each such hyperlink found, add an entry to the |
| 2346 | ** backlink table. |
| 2347 | */ |
| @@ -2295,30 +2352,16 @@ | |
| 2352 | ){ |
| 2353 | Renderer renderer; |
| 2354 | int tokenType; |
| 2355 | ParsedMarkup markup; |
| 2356 | int n; |
| 2357 | |
| 2358 | memset(&renderer, 0, sizeof(renderer)); |
| 2359 | renderer.state = ALLOW_WIKI; |
| 2360 | |
| 2361 | while( z[0] ){ |
| 2362 | n = nextWikiToken(z, &renderer, &tokenType); |
| 2363 | switch( tokenType ){ |
| 2364 | case TOKEN_LINK: { |
| 2365 | char *zTarget, *zEnd; |
| 2366 | int i; |
| 2367 | |
| @@ -2402,11 +2445,11 @@ | |
| 2445 | } |
| 2446 | }else |
| 2447 | |
| 2448 | /* Ignore block markup for in-line rendering. |
| 2449 | */ |
| 2450 | if( (markup.iType & MUTYPE_INLINE)==0 ){ |
| 2451 | /* Do nothing */ |
| 2452 | }else |
| 2453 | |
| 2454 | /* Generate end-tags */ |
| 2455 | if( markup.endTag ){ |
| 2456 |
+1
-1
| --- tools/makemake.tcl | ||
| +++ tools/makemake.tcl | ||
| @@ -212,11 +212,11 @@ | ||
| 212 | 212 | # be relative to that. |
| 213 | 213 | set extra_files { |
| 214 | 214 | diff.tcl |
| 215 | 215 | merge.tcl |
| 216 | 216 | markdown.md |
| 217 | - wiki.wiki | |
| 217 | + wiki-rules.txt | |
| 218 | 218 | *.js |
| 219 | 219 | default.css |
| 220 | 220 | style.*.css |
| 221 | 221 | ../skins/*/*.txt |
| 222 | 222 | sounds/*.wav |
| 223 | 223 |
| --- tools/makemake.tcl | |
| +++ tools/makemake.tcl | |
| @@ -212,11 +212,11 @@ | |
| 212 | # be relative to that. |
| 213 | set extra_files { |
| 214 | diff.tcl |
| 215 | merge.tcl |
| 216 | markdown.md |
| 217 | wiki.wiki |
| 218 | *.js |
| 219 | default.css |
| 220 | style.*.css |
| 221 | ../skins/*/*.txt |
| 222 | sounds/*.wav |
| 223 |
| --- tools/makemake.tcl | |
| +++ tools/makemake.tcl | |
| @@ -212,11 +212,11 @@ | |
| 212 | # be relative to that. |
| 213 | set extra_files { |
| 214 | diff.tcl |
| 215 | merge.tcl |
| 216 | markdown.md |
| 217 | wiki-rules.txt |
| 218 | *.js |
| 219 | default.css |
| 220 | style.*.css |
| 221 | ../skins/*/*.txt |
| 222 | sounds/*.wav |
| 223 |
+1
-1
| --- win/Makefile.mingw | ||
| +++ win/Makefile.mingw | ||
| @@ -663,11 +663,11 @@ | ||
| 663 | 663 | $(SRCDIR)/style.pikchrshow.css \ |
| 664 | 664 | $(SRCDIR)/style.uvlist.css \ |
| 665 | 665 | $(SRCDIR)/style.wikiedit.css \ |
| 666 | 666 | $(SRCDIR)/tree.js \ |
| 667 | 667 | $(SRCDIR)/useredit.js \ |
| 668 | - $(SRCDIR)/wiki.wiki | |
| 668 | + $(SRCDIR)/wiki-rules.txt | |
| 669 | 669 | |
| 670 | 670 | TRANS_SRC = \ |
| 671 | 671 | $(OBJDIR)/add_.c \ |
| 672 | 672 | $(OBJDIR)/ajax_.c \ |
| 673 | 673 | $(OBJDIR)/alerts_.c \ |
| 674 | 674 |
| --- win/Makefile.mingw | |
| +++ win/Makefile.mingw | |
| @@ -663,11 +663,11 @@ | |
| 663 | $(SRCDIR)/style.pikchrshow.css \ |
| 664 | $(SRCDIR)/style.uvlist.css \ |
| 665 | $(SRCDIR)/style.wikiedit.css \ |
| 666 | $(SRCDIR)/tree.js \ |
| 667 | $(SRCDIR)/useredit.js \ |
| 668 | $(SRCDIR)/wiki.wiki |
| 669 | |
| 670 | TRANS_SRC = \ |
| 671 | $(OBJDIR)/add_.c \ |
| 672 | $(OBJDIR)/ajax_.c \ |
| 673 | $(OBJDIR)/alerts_.c \ |
| 674 |
| --- win/Makefile.mingw | |
| +++ win/Makefile.mingw | |
| @@ -663,11 +663,11 @@ | |
| 663 | $(SRCDIR)/style.pikchrshow.css \ |
| 664 | $(SRCDIR)/style.uvlist.css \ |
| 665 | $(SRCDIR)/style.wikiedit.css \ |
| 666 | $(SRCDIR)/tree.js \ |
| 667 | $(SRCDIR)/useredit.js \ |
| 668 | $(SRCDIR)/wiki-rules.txt |
| 669 | |
| 670 | TRANS_SRC = \ |
| 671 | $(OBJDIR)/add_.c \ |
| 672 | $(OBJDIR)/ajax_.c \ |
| 673 | $(OBJDIR)/alerts_.c \ |
| 674 |
+2
-2
| --- win/Makefile.msc | ||
| +++ win/Makefile.msc | ||
| @@ -623,11 +623,11 @@ | ||
| 623 | 623 | "$(SRCDIR)\style.pikchrshow.css" \ |
| 624 | 624 | "$(SRCDIR)\style.uvlist.css" \ |
| 625 | 625 | "$(SRCDIR)\style.wikiedit.css" \ |
| 626 | 626 | "$(SRCDIR)\tree.js" \ |
| 627 | 627 | "$(SRCDIR)\useredit.js" \ |
| 628 | - "$(SRCDIR)\wiki.wiki" | |
| 628 | + "$(SRCDIR)\wiki-rules.txt" | |
| 629 | 629 | |
| 630 | 630 | OBJ = "$(OX)\add$O" \ |
| 631 | 631 | "$(OX)\ajax$O" \ |
| 632 | 632 | "$(OX)\alerts$O" \ |
| 633 | 633 | "$(OX)\allrepo$O" \ |
| @@ -1256,11 +1256,11 @@ | ||
| 1256 | 1256 | echo "$(SRCDIR)\style.pikchrshow.css" >> $@ |
| 1257 | 1257 | echo "$(SRCDIR)\style.uvlist.css" >> $@ |
| 1258 | 1258 | echo "$(SRCDIR)\style.wikiedit.css" >> $@ |
| 1259 | 1259 | echo "$(SRCDIR)\tree.js" >> $@ |
| 1260 | 1260 | echo "$(SRCDIR)\useredit.js" >> $@ |
| 1261 | - echo "$(SRCDIR)\wiki.wiki" >> $@ | |
| 1261 | + echo "$(SRCDIR)\wiki-rules.txt" >> $@ | |
| 1262 | 1262 | |
| 1263 | 1263 | "$(OX)\add$O" : "$(OX)\add_.c" "$(OX)\add.h" |
| 1264 | 1264 | $(TCC) /Fo$@ /Fd$(@D)\ -c "$(OX)\add_.c" |
| 1265 | 1265 | |
| 1266 | 1266 | "$(OX)\add_.c" : "$(SRCDIR)\add.c" |
| 1267 | 1267 |
| --- win/Makefile.msc | |
| +++ win/Makefile.msc | |
| @@ -623,11 +623,11 @@ | |
| 623 | "$(SRCDIR)\style.pikchrshow.css" \ |
| 624 | "$(SRCDIR)\style.uvlist.css" \ |
| 625 | "$(SRCDIR)\style.wikiedit.css" \ |
| 626 | "$(SRCDIR)\tree.js" \ |
| 627 | "$(SRCDIR)\useredit.js" \ |
| 628 | "$(SRCDIR)\wiki.wiki" |
| 629 | |
| 630 | OBJ = "$(OX)\add$O" \ |
| 631 | "$(OX)\ajax$O" \ |
| 632 | "$(OX)\alerts$O" \ |
| 633 | "$(OX)\allrepo$O" \ |
| @@ -1256,11 +1256,11 @@ | |
| 1256 | echo "$(SRCDIR)\style.pikchrshow.css" >> $@ |
| 1257 | echo "$(SRCDIR)\style.uvlist.css" >> $@ |
| 1258 | echo "$(SRCDIR)\style.wikiedit.css" >> $@ |
| 1259 | echo "$(SRCDIR)\tree.js" >> $@ |
| 1260 | echo "$(SRCDIR)\useredit.js" >> $@ |
| 1261 | echo "$(SRCDIR)\wiki.wiki" >> $@ |
| 1262 | |
| 1263 | "$(OX)\add$O" : "$(OX)\add_.c" "$(OX)\add.h" |
| 1264 | $(TCC) /Fo$@ /Fd$(@D)\ -c "$(OX)\add_.c" |
| 1265 | |
| 1266 | "$(OX)\add_.c" : "$(SRCDIR)\add.c" |
| 1267 |
| --- win/Makefile.msc | |
| +++ win/Makefile.msc | |
| @@ -623,11 +623,11 @@ | |
| 623 | "$(SRCDIR)\style.pikchrshow.css" \ |
| 624 | "$(SRCDIR)\style.uvlist.css" \ |
| 625 | "$(SRCDIR)\style.wikiedit.css" \ |
| 626 | "$(SRCDIR)\tree.js" \ |
| 627 | "$(SRCDIR)\useredit.js" \ |
| 628 | "$(SRCDIR)\wiki-rules.txt" |
| 629 | |
| 630 | OBJ = "$(OX)\add$O" \ |
| 631 | "$(OX)\ajax$O" \ |
| 632 | "$(OX)\alerts$O" \ |
| 633 | "$(OX)\allrepo$O" \ |
| @@ -1256,11 +1256,11 @@ | |
| 1256 | echo "$(SRCDIR)\style.pikchrshow.css" >> $@ |
| 1257 | echo "$(SRCDIR)\style.uvlist.css" >> $@ |
| 1258 | echo "$(SRCDIR)\style.wikiedit.css" >> $@ |
| 1259 | echo "$(SRCDIR)\tree.js" >> $@ |
| 1260 | echo "$(SRCDIR)\useredit.js" >> $@ |
| 1261 | echo "$(SRCDIR)\wiki-rules.txt" >> $@ |
| 1262 | |
| 1263 | "$(OX)\add$O" : "$(OX)\add_.c" "$(OX)\add.h" |
| 1264 | $(TCC) /Fo$@ /Fd$(@D)\ -c "$(OX)\add_.c" |
| 1265 | |
| 1266 | "$(OX)\add_.c" : "$(SRCDIR)\add.c" |
| 1267 |