Fossil SCM
Reverted to original version of wiki.c.
Commit
6078359f2a1c2887910d99aa48f9dea6effd9833
Parent
6d828a863004679…
1 file changed
+26
-30
+26
-30
| --- src/wiki.c | ||
| +++ src/wiki.c | ||
| @@ -138,23 +138,23 @@ | ||
| 138 | 138 | @ %h(zHomePageName)</a> wiki home page.</li> |
| 139 | 139 | } |
| 140 | 140 | } |
| 141 | 141 | @ <li> <a href="%s(g.zBaseURL)/timeline?y=w">Recent changes</a> to wiki |
| 142 | 142 | @ pages. </li> |
| 143 | - @ <li> <a href="%s(g.zBaseURL)/wiki_rules">Formatting rules</a> for | |
| 143 | + @ <li> <a href="%s(g.zBaseURL)/wiki_rules">Formatting rules</a> for | |
| 144 | 144 | @ wiki.</li> |
| 145 | 145 | @ <li> Use the <a href="%s(g.zBaseURL)/wiki?name=Sandbox">Sandbox</a> |
| 146 | 146 | @ to experiment.</li> |
| 147 | 147 | if( g.okNewWiki ){ |
| 148 | 148 | @ <li> Create a <a href="%s(g.zBaseURL)/wikinew">new wiki page</a>.</li> |
| 149 | 149 | } |
| 150 | 150 | @ <li> <a href="%s(g.zBaseURL)/wcontent">List of All Wiki Pages</a> |
| 151 | 151 | @ available on this server.</li> |
| 152 | - @ <li> <form method="GET" action="%s(g.zBaseURL)/wfind"> | |
| 153 | - @ Search wiki titles: <input type="text" name="title"/> | |
| 152 | + @ <li> <form method="GET" action="%s(g.zBaseURL)/wfind"> | |
| 153 | + @ Search wiki titles: <input type="text" name="title"/> | |
| 154 | 154 | @ <input type="submit" /> |
| 155 | - @ </li> | |
| 155 | + @ </li> | |
| 156 | 156 | @ </ul> |
| 157 | 157 | style_footer(); |
| 158 | 158 | return; |
| 159 | 159 | } |
| 160 | 160 | if( check_name(zPageName) ) return; |
| @@ -161,11 +161,11 @@ | ||
| 161 | 161 | isSandbox = is_sandbox(zPageName); |
| 162 | 162 | if( isSandbox ){ |
| 163 | 163 | zBody = db_get("sandbox",zBody); |
| 164 | 164 | }else{ |
| 165 | 165 | zTag = mprintf("wiki-%s", zPageName); |
| 166 | - rid = db_int(0, | |
| 166 | + rid = db_int(0, | |
| 167 | 167 | "SELECT rid FROM tagxref" |
| 168 | 168 | " WHERE tagid=(SELECT tagid FROM tag WHERE tagname=%Q)" |
| 169 | 169 | " ORDER BY mtime DESC", zTag |
| 170 | 170 | ); |
| 171 | 171 | free(zTag); |
| @@ -233,11 +233,11 @@ | ||
| 233 | 233 | } |
| 234 | 234 | if( cnt ){ |
| 235 | 235 | @ </ul> |
| 236 | 236 | } |
| 237 | 237 | db_finalize(&q); |
| 238 | - | |
| 238 | + | |
| 239 | 239 | if( !isSandbox ){ |
| 240 | 240 | manifest_clear(&m); |
| 241 | 241 | } |
| 242 | 242 | style_footer(); |
| 243 | 243 | } |
| @@ -273,11 +273,11 @@ | ||
| 273 | 273 | if( zBody==0 ){ |
| 274 | 274 | zBody = db_get("sandbox",""); |
| 275 | 275 | } |
| 276 | 276 | }else{ |
| 277 | 277 | zTag = mprintf("wiki-%s", zPageName); |
| 278 | - rid = db_int(0, | |
| 278 | + rid = db_int(0, | |
| 279 | 279 | "SELECT rid FROM tagxref" |
| 280 | 280 | " WHERE tagid=(SELECT tagid FROM tag WHERE tagname=%Q)" |
| 281 | 281 | " ORDER BY mtime DESC", zTag |
| 282 | 282 | ); |
| 283 | 283 | free(zTag); |
| @@ -355,11 +355,11 @@ | ||
| 355 | 355 | if( n<20 ) n = 20; |
| 356 | 356 | if( n>40 ) n = 40; |
| 357 | 357 | @ <form method="POST" action="%s(g.zBaseURL)/wikiedit"> |
| 358 | 358 | login_insert_csrf_secret(); |
| 359 | 359 | @ <input type="hidden" name="name" value="%h(zPageName)"> |
| 360 | - @ <textarea name="w" class="wikiedit" cols="80" | |
| 360 | + @ <textarea name="w" class="wikiedit" cols="80" | |
| 361 | 361 | @ rows="%d(n)" wrap="virtual">%h(zBody)</textarea> |
| 362 | 362 | @ <br> |
| 363 | 363 | @ <input type="submit" name="preview" value="Preview Your Changes"> |
| 364 | 364 | @ <input type="submit" name="submit" value="Apply These Changes"> |
| 365 | 365 | @ <input type="submit" name="cancel" value="Cancel"> |
| @@ -381,11 +381,11 @@ | ||
| 381 | 381 | const char *zName; |
| 382 | 382 | login_check_credentials(); |
| 383 | 383 | if( !g.okNewWiki ){ |
| 384 | 384 | login_needed(); |
| 385 | 385 | return; |
| 386 | - } | |
| 386 | + } | |
| 387 | 387 | zName = PD("name",""); |
| 388 | 388 | if( zName[0] && wiki_name_is_wellformed((const unsigned char *)zName) ){ |
| 389 | 389 | cgi_redirectf("wikiedit?name=%T", zName); |
| 390 | 390 | } |
| 391 | 391 | style_header("Create A New Wiki Page"); |
| @@ -414,11 +414,11 @@ | ||
| 414 | 414 | const char *zRemark; |
| 415 | 415 | char *zId; |
| 416 | 416 | |
| 417 | 417 | zDate = db_text(0, "SELECT datetime('now')"); |
| 418 | 418 | zId = db_text(0, "SELECT lower(hex(randomblob(8)))"); |
| 419 | - blob_appendf(p, "\n\n<hr><div id=\"%s\"><i>On %s UTC %h", | |
| 419 | + blob_appendf(p, "\n\n<hr><div id=\"%s\"><i>On %s UTC %h", | |
| 420 | 420 | zId, zDate, g.zLogin); |
| 421 | 421 | free(zDate); |
| 422 | 422 | zUser = PD("u",g.zLogin); |
| 423 | 423 | if( zUser[0] && strcmp(zUser,g.zLogin) ){ |
| 424 | 424 | blob_appendf(p, " (claiming to be %h)", zUser); |
| @@ -443,11 +443,11 @@ | ||
| 443 | 443 | zPageName = PD("name",""); |
| 444 | 444 | if( check_name(zPageName) ) return; |
| 445 | 445 | isSandbox = is_sandbox(zPageName); |
| 446 | 446 | if( !isSandbox ){ |
| 447 | 447 | zTag = mprintf("wiki-%s", zPageName); |
| 448 | - rid = db_int(0, | |
| 448 | + rid = db_int(0, | |
| 449 | 449 | "SELECT rid FROM tagxref" |
| 450 | 450 | " WHERE tagid=(SELECT tagid FROM tag WHERE tagname=%Q)" |
| 451 | 451 | " ORDER BY mtime DESC", zTag |
| 452 | 452 | ); |
| 453 | 453 | free(zTag); |
| @@ -530,11 +530,11 @@ | ||
| 530 | 530 | login_insert_csrf_secret(); |
| 531 | 531 | @ <input type="hidden" name="name" value="%h(zPageName)"> |
| 532 | 532 | @ Your Name: |
| 533 | 533 | @ <input type="text" name="u" size="20" value="%h(zUser)"><br> |
| 534 | 534 | @ Comment to append:<br> |
| 535 | - @ <textarea name="r" class="wikiedit" cols="80" | |
| 535 | + @ <textarea name="r" class="wikiedit" cols="80" | |
| 536 | 536 | @ rows="10" wrap="virtual">%h(PD("r",""))</textarea> |
| 537 | 537 | @ <br> |
| 538 | 538 | @ <input type="submit" name="preview" value="Preview Your Comment"> |
| 539 | 539 | @ <input type="submit" name="submit" value="Append Your Changes"> |
| 540 | 540 | @ <input type="submit" name="cancel" value="Cancel"> |
| @@ -661,11 +661,11 @@ | ||
| 661 | 661 | style_submenu_element("Active", "Only Active Pages", "%s/wcontent", g.zTop); |
| 662 | 662 | }else{ |
| 663 | 663 | style_submenu_element("All", "All", "%s/wcontent?all=1", g.zTop); |
| 664 | 664 | } |
| 665 | 665 | @ <ul> |
| 666 | - db_prepare(&q, | |
| 666 | + db_prepare(&q, | |
| 667 | 667 | "SELECT" |
| 668 | 668 | " substr(tagname, 6)," |
| 669 | 669 | " (SELECT value FROM tagxref WHERE tagid=tag.tagid ORDER BY mtime DESC)" |
| 670 | 670 | " FROM tag WHERE tagname GLOB 'wiki-*'" |
| 671 | 671 | " ORDER BY lower(tagname) /*sort*/" |
| @@ -696,14 +696,14 @@ | ||
| 696 | 696 | login_check_credentials(); |
| 697 | 697 | if( !g.okRdWiki ){ login_needed(); return; } |
| 698 | 698 | zTitle = PD("title","*"); |
| 699 | 699 | style_header("Wiki Pages Found"); |
| 700 | 700 | @ <ul> |
| 701 | - db_prepare(&q, | |
| 701 | + db_prepare(&q, | |
| 702 | 702 | "SELECT substr(tagname, 6, 1000) FROM tag WHERE tagname like 'wiki-%%%q%%'" |
| 703 | 703 | " ORDER BY lower(tagname) /*sort*/" , |
| 704 | - zTitle); | |
| 704 | + zTitle); | |
| 705 | 705 | while( db_step(&q)==SQLITE_ROW ){ |
| 706 | 706 | const char *zName = db_column_text(&q, 0); |
| 707 | 707 | @ <li><a href="%s(g.zBaseURL)/wiki?name=%T(zName)">%h(zName)</a></li> |
| 708 | 708 | } |
| 709 | 709 | db_finalize(&q); |
| @@ -747,11 +747,11 @@ | ||
| 747 | 747 | @ surrounded on both sides by two or more spaces or by a tab. Only a single |
| 748 | 748 | @ level of enumeration list is supported by wiki. For nested lists or for |
| 749 | 749 | @ enumerations that count using letters or roman numerials, use HTML.</p> |
| 750 | 750 | @ <li> <p><b>Indented Paragraphs</b>. |
| 751 | 751 | @ Any paragraph that begins with two or more spaces or a tab and |
| 752 | - @ which is not a bullet or enumeration list item is rendered | |
| 752 | + @ which is not a bullet or enumeration list item is rendered | |
| 753 | 753 | @ indented. Only a single level of indentation is supported by wiki; use |
| 754 | 754 | @ HTML for deeper indentation.</p> |
| 755 | 755 | @ <li> <p><b>Hyperlinks</b>. |
| 756 | 756 | @ Text within square brackets ("[...]") becomes a hyperlink. The |
| 757 | 757 | @ target can be a wiki page name, the artifact ID of a check-in or ticket, |
| @@ -879,11 +879,11 @@ | ||
| 879 | 879 | db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", nrid); |
| 880 | 880 | manifest_crosslink(nrid,&wiki); |
| 881 | 881 | blob_reset(&wiki); |
| 882 | 882 | content_deltify(rid,nrid,0); |
| 883 | 883 | db_end_transaction(0); |
| 884 | - autosync(AUTOSYNC_PUSH); | |
| 884 | + autosync(AUTOSYNC_PUSH); | |
| 885 | 885 | return 1; |
| 886 | 886 | } |
| 887 | 887 | |
| 888 | 888 | /* |
| 889 | 889 | ** COMMAND: wiki |
| @@ -910,21 +910,21 @@ | ||
| 910 | 910 | ** %fossil wiki list |
| 911 | 911 | ** |
| 912 | 912 | ** Lists all wiki entries, one per line, ordered |
| 913 | 913 | ** case-insentively by name. |
| 914 | 914 | ** |
| 915 | -** %fossil wiki delete WikiName | |
| 916 | -** | |
| 917 | -** The same as deleting a file entry, but i don't know if fossil | |
| 918 | -** supports a commit message for Wiki entries. | |
| 919 | -** | |
| 920 | 915 | ** TODOs: |
| 921 | 916 | ** |
| 922 | 917 | ** %fossil wiki export ?-u ARTIFACT? WikiName ?FILE? |
| 923 | 918 | ** |
| 924 | 919 | ** Outputs the selected version of WikiName. |
| 925 | 920 | ** |
| 921 | +** %fossil wiki delete ?-m MESSAGE? WikiName | |
| 922 | +** | |
| 923 | +** The same as deleting a file entry, but i don't know if fossil | |
| 924 | +** supports a commit message for Wiki entries. | |
| 925 | +** | |
| 926 | 926 | ** %fossil wiki ?-u? ?-d? ?-s=[|]? list |
| 927 | 927 | ** |
| 928 | 928 | ** Lists the artifact ID and/or Date of last change along with |
| 929 | 929 | ** each entry name, delimited by the -s char. |
| 930 | 930 | ** |
| @@ -956,11 +956,11 @@ | ||
| 956 | 956 | } |
| 957 | 957 | zPageName = g.argv[3]; |
| 958 | 958 | rid = db_int(0, "SELECT x.rid FROM tag t, tagxref x" |
| 959 | 959 | " WHERE x.tagid=t.tagid AND t.tagname='wiki-%q'" |
| 960 | 960 | " ORDER BY x.mtime DESC LIMIT 1", |
| 961 | - zPageName | |
| 961 | + zPageName | |
| 962 | 962 | ); |
| 963 | 963 | if( rid ){ |
| 964 | 964 | Blob content; |
| 965 | 965 | content_get(rid, &content); |
| 966 | 966 | manifest_parse(&m, &content); |
| @@ -986,11 +986,11 @@ | ||
| 986 | 986 | fossil_fatal("wiki export could not open output file for writing."); |
| 987 | 987 | } |
| 988 | 988 | fprintf(zF,"%.*s\n", i, zBody); |
| 989 | 989 | if( doClose ) fclose(zF); |
| 990 | 990 | }else{ |
| 991 | - printf("%.*s\n", i, zBody); | |
| 991 | + printf("%.*s\n", i, zBody); | |
| 992 | 992 | } |
| 993 | 993 | return; |
| 994 | 994 | }else |
| 995 | 995 | if( strncmp(g.argv[2],"commit",n)==0 |
| 996 | 996 | || strncmp(g.argv[2],"create",n)==0 ){ |
| @@ -1013,22 +1013,18 @@ | ||
| 1013 | 1013 | printf("Updated wiki page %s.\n", zPageName); |
| 1014 | 1014 | } |
| 1015 | 1015 | blob_reset(&content); |
| 1016 | 1016 | }else |
| 1017 | 1017 | if( strncmp(g.argv[2],"delete",n)==0 ){ |
| 1018 | - char *zPageName; | |
| 1019 | - Blob content; | |
| 1020 | - if( g.argc!=4 ){ | |
| 1018 | + if( g.argc!=5 ){ | |
| 1021 | 1019 | usage("delete PAGENAME"); |
| 1022 | 1020 | } |
| 1023 | - zPageName == g.argv[3]; | |
| 1024 | - printf("%s %s %s %s\n", g.argv[0], g.argv[1], g.argv[2], g.argv[3]); | |
| 1025 | 1021 | fossil_fatal("delete not yet implemented."); |
| 1026 | 1022 | }else |
| 1027 | 1023 | if( strncmp(g.argv[2],"list",n)==0 ){ |
| 1028 | 1024 | Stmt q; |
| 1029 | - db_prepare(&q, | |
| 1025 | + db_prepare(&q, | |
| 1030 | 1026 | "SELECT substr(tagname, 6) FROM tag WHERE tagname GLOB 'wiki-*'" |
| 1031 | 1027 | " ORDER BY lower(tagname) /*sort*/" |
| 1032 | 1028 | ); |
| 1033 | 1029 | while( db_step(&q)==SQLITE_ROW ){ |
| 1034 | 1030 | const char *zName = db_column_text(&q, 0); |
| 1035 | 1031 |
| --- src/wiki.c | |
| +++ src/wiki.c | |
| @@ -138,23 +138,23 @@ | |
| 138 | @ %h(zHomePageName)</a> wiki home page.</li> |
| 139 | } |
| 140 | } |
| 141 | @ <li> <a href="%s(g.zBaseURL)/timeline?y=w">Recent changes</a> to wiki |
| 142 | @ pages. </li> |
| 143 | @ <li> <a href="%s(g.zBaseURL)/wiki_rules">Formatting rules</a> for |
| 144 | @ wiki.</li> |
| 145 | @ <li> Use the <a href="%s(g.zBaseURL)/wiki?name=Sandbox">Sandbox</a> |
| 146 | @ to experiment.</li> |
| 147 | if( g.okNewWiki ){ |
| 148 | @ <li> Create a <a href="%s(g.zBaseURL)/wikinew">new wiki page</a>.</li> |
| 149 | } |
| 150 | @ <li> <a href="%s(g.zBaseURL)/wcontent">List of All Wiki Pages</a> |
| 151 | @ available on this server.</li> |
| 152 | @ <li> <form method="GET" action="%s(g.zBaseURL)/wfind"> |
| 153 | @ Search wiki titles: <input type="text" name="title"/> |
| 154 | @ <input type="submit" /> |
| 155 | @ </li> |
| 156 | @ </ul> |
| 157 | style_footer(); |
| 158 | return; |
| 159 | } |
| 160 | if( check_name(zPageName) ) return; |
| @@ -161,11 +161,11 @@ | |
| 161 | isSandbox = is_sandbox(zPageName); |
| 162 | if( isSandbox ){ |
| 163 | zBody = db_get("sandbox",zBody); |
| 164 | }else{ |
| 165 | zTag = mprintf("wiki-%s", zPageName); |
| 166 | rid = db_int(0, |
| 167 | "SELECT rid FROM tagxref" |
| 168 | " WHERE tagid=(SELECT tagid FROM tag WHERE tagname=%Q)" |
| 169 | " ORDER BY mtime DESC", zTag |
| 170 | ); |
| 171 | free(zTag); |
| @@ -233,11 +233,11 @@ | |
| 233 | } |
| 234 | if( cnt ){ |
| 235 | @ </ul> |
| 236 | } |
| 237 | db_finalize(&q); |
| 238 | |
| 239 | if( !isSandbox ){ |
| 240 | manifest_clear(&m); |
| 241 | } |
| 242 | style_footer(); |
| 243 | } |
| @@ -273,11 +273,11 @@ | |
| 273 | if( zBody==0 ){ |
| 274 | zBody = db_get("sandbox",""); |
| 275 | } |
| 276 | }else{ |
| 277 | zTag = mprintf("wiki-%s", zPageName); |
| 278 | rid = db_int(0, |
| 279 | "SELECT rid FROM tagxref" |
| 280 | " WHERE tagid=(SELECT tagid FROM tag WHERE tagname=%Q)" |
| 281 | " ORDER BY mtime DESC", zTag |
| 282 | ); |
| 283 | free(zTag); |
| @@ -355,11 +355,11 @@ | |
| 355 | if( n<20 ) n = 20; |
| 356 | if( n>40 ) n = 40; |
| 357 | @ <form method="POST" action="%s(g.zBaseURL)/wikiedit"> |
| 358 | login_insert_csrf_secret(); |
| 359 | @ <input type="hidden" name="name" value="%h(zPageName)"> |
| 360 | @ <textarea name="w" class="wikiedit" cols="80" |
| 361 | @ rows="%d(n)" wrap="virtual">%h(zBody)</textarea> |
| 362 | @ <br> |
| 363 | @ <input type="submit" name="preview" value="Preview Your Changes"> |
| 364 | @ <input type="submit" name="submit" value="Apply These Changes"> |
| 365 | @ <input type="submit" name="cancel" value="Cancel"> |
| @@ -381,11 +381,11 @@ | |
| 381 | const char *zName; |
| 382 | login_check_credentials(); |
| 383 | if( !g.okNewWiki ){ |
| 384 | login_needed(); |
| 385 | return; |
| 386 | } |
| 387 | zName = PD("name",""); |
| 388 | if( zName[0] && wiki_name_is_wellformed((const unsigned char *)zName) ){ |
| 389 | cgi_redirectf("wikiedit?name=%T", zName); |
| 390 | } |
| 391 | style_header("Create A New Wiki Page"); |
| @@ -414,11 +414,11 @@ | |
| 414 | const char *zRemark; |
| 415 | char *zId; |
| 416 | |
| 417 | zDate = db_text(0, "SELECT datetime('now')"); |
| 418 | zId = db_text(0, "SELECT lower(hex(randomblob(8)))"); |
| 419 | blob_appendf(p, "\n\n<hr><div id=\"%s\"><i>On %s UTC %h", |
| 420 | zId, zDate, g.zLogin); |
| 421 | free(zDate); |
| 422 | zUser = PD("u",g.zLogin); |
| 423 | if( zUser[0] && strcmp(zUser,g.zLogin) ){ |
| 424 | blob_appendf(p, " (claiming to be %h)", zUser); |
| @@ -443,11 +443,11 @@ | |
| 443 | zPageName = PD("name",""); |
| 444 | if( check_name(zPageName) ) return; |
| 445 | isSandbox = is_sandbox(zPageName); |
| 446 | if( !isSandbox ){ |
| 447 | zTag = mprintf("wiki-%s", zPageName); |
| 448 | rid = db_int(0, |
| 449 | "SELECT rid FROM tagxref" |
| 450 | " WHERE tagid=(SELECT tagid FROM tag WHERE tagname=%Q)" |
| 451 | " ORDER BY mtime DESC", zTag |
| 452 | ); |
| 453 | free(zTag); |
| @@ -530,11 +530,11 @@ | |
| 530 | login_insert_csrf_secret(); |
| 531 | @ <input type="hidden" name="name" value="%h(zPageName)"> |
| 532 | @ Your Name: |
| 533 | @ <input type="text" name="u" size="20" value="%h(zUser)"><br> |
| 534 | @ Comment to append:<br> |
| 535 | @ <textarea name="r" class="wikiedit" cols="80" |
| 536 | @ rows="10" wrap="virtual">%h(PD("r",""))</textarea> |
| 537 | @ <br> |
| 538 | @ <input type="submit" name="preview" value="Preview Your Comment"> |
| 539 | @ <input type="submit" name="submit" value="Append Your Changes"> |
| 540 | @ <input type="submit" name="cancel" value="Cancel"> |
| @@ -661,11 +661,11 @@ | |
| 661 | style_submenu_element("Active", "Only Active Pages", "%s/wcontent", g.zTop); |
| 662 | }else{ |
| 663 | style_submenu_element("All", "All", "%s/wcontent?all=1", g.zTop); |
| 664 | } |
| 665 | @ <ul> |
| 666 | db_prepare(&q, |
| 667 | "SELECT" |
| 668 | " substr(tagname, 6)," |
| 669 | " (SELECT value FROM tagxref WHERE tagid=tag.tagid ORDER BY mtime DESC)" |
| 670 | " FROM tag WHERE tagname GLOB 'wiki-*'" |
| 671 | " ORDER BY lower(tagname) /*sort*/" |
| @@ -696,14 +696,14 @@ | |
| 696 | login_check_credentials(); |
| 697 | if( !g.okRdWiki ){ login_needed(); return; } |
| 698 | zTitle = PD("title","*"); |
| 699 | style_header("Wiki Pages Found"); |
| 700 | @ <ul> |
| 701 | db_prepare(&q, |
| 702 | "SELECT substr(tagname, 6, 1000) FROM tag WHERE tagname like 'wiki-%%%q%%'" |
| 703 | " ORDER BY lower(tagname) /*sort*/" , |
| 704 | zTitle); |
| 705 | while( db_step(&q)==SQLITE_ROW ){ |
| 706 | const char *zName = db_column_text(&q, 0); |
| 707 | @ <li><a href="%s(g.zBaseURL)/wiki?name=%T(zName)">%h(zName)</a></li> |
| 708 | } |
| 709 | db_finalize(&q); |
| @@ -747,11 +747,11 @@ | |
| 747 | @ surrounded on both sides by two or more spaces or by a tab. Only a single |
| 748 | @ level of enumeration list is supported by wiki. For nested lists or for |
| 749 | @ enumerations that count using letters or roman numerials, use HTML.</p> |
| 750 | @ <li> <p><b>Indented Paragraphs</b>. |
| 751 | @ Any paragraph that begins with two or more spaces or a tab and |
| 752 | @ which is not a bullet or enumeration list item is rendered |
| 753 | @ indented. Only a single level of indentation is supported by wiki; use |
| 754 | @ HTML for deeper indentation.</p> |
| 755 | @ <li> <p><b>Hyperlinks</b>. |
| 756 | @ Text within square brackets ("[...]") becomes a hyperlink. The |
| 757 | @ target can be a wiki page name, the artifact ID of a check-in or ticket, |
| @@ -879,11 +879,11 @@ | |
| 879 | db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", nrid); |
| 880 | manifest_crosslink(nrid,&wiki); |
| 881 | blob_reset(&wiki); |
| 882 | content_deltify(rid,nrid,0); |
| 883 | db_end_transaction(0); |
| 884 | autosync(AUTOSYNC_PUSH); |
| 885 | return 1; |
| 886 | } |
| 887 | |
| 888 | /* |
| 889 | ** COMMAND: wiki |
| @@ -910,21 +910,21 @@ | |
| 910 | ** %fossil wiki list |
| 911 | ** |
| 912 | ** Lists all wiki entries, one per line, ordered |
| 913 | ** case-insentively by name. |
| 914 | ** |
| 915 | ** %fossil wiki delete WikiName |
| 916 | ** |
| 917 | ** The same as deleting a file entry, but i don't know if fossil |
| 918 | ** supports a commit message for Wiki entries. |
| 919 | ** |
| 920 | ** TODOs: |
| 921 | ** |
| 922 | ** %fossil wiki export ?-u ARTIFACT? WikiName ?FILE? |
| 923 | ** |
| 924 | ** Outputs the selected version of WikiName. |
| 925 | ** |
| 926 | ** %fossil wiki ?-u? ?-d? ?-s=[|]? list |
| 927 | ** |
| 928 | ** Lists the artifact ID and/or Date of last change along with |
| 929 | ** each entry name, delimited by the -s char. |
| 930 | ** |
| @@ -956,11 +956,11 @@ | |
| 956 | } |
| 957 | zPageName = g.argv[3]; |
| 958 | rid = db_int(0, "SELECT x.rid FROM tag t, tagxref x" |
| 959 | " WHERE x.tagid=t.tagid AND t.tagname='wiki-%q'" |
| 960 | " ORDER BY x.mtime DESC LIMIT 1", |
| 961 | zPageName |
| 962 | ); |
| 963 | if( rid ){ |
| 964 | Blob content; |
| 965 | content_get(rid, &content); |
| 966 | manifest_parse(&m, &content); |
| @@ -986,11 +986,11 @@ | |
| 986 | fossil_fatal("wiki export could not open output file for writing."); |
| 987 | } |
| 988 | fprintf(zF,"%.*s\n", i, zBody); |
| 989 | if( doClose ) fclose(zF); |
| 990 | }else{ |
| 991 | printf("%.*s\n", i, zBody); |
| 992 | } |
| 993 | return; |
| 994 | }else |
| 995 | if( strncmp(g.argv[2],"commit",n)==0 |
| 996 | || strncmp(g.argv[2],"create",n)==0 ){ |
| @@ -1013,22 +1013,18 @@ | |
| 1013 | printf("Updated wiki page %s.\n", zPageName); |
| 1014 | } |
| 1015 | blob_reset(&content); |
| 1016 | }else |
| 1017 | if( strncmp(g.argv[2],"delete",n)==0 ){ |
| 1018 | char *zPageName; |
| 1019 | Blob content; |
| 1020 | if( g.argc!=4 ){ |
| 1021 | usage("delete PAGENAME"); |
| 1022 | } |
| 1023 | zPageName == g.argv[3]; |
| 1024 | printf("%s %s %s %s\n", g.argv[0], g.argv[1], g.argv[2], g.argv[3]); |
| 1025 | fossil_fatal("delete not yet implemented."); |
| 1026 | }else |
| 1027 | if( strncmp(g.argv[2],"list",n)==0 ){ |
| 1028 | Stmt q; |
| 1029 | db_prepare(&q, |
| 1030 | "SELECT substr(tagname, 6) FROM tag WHERE tagname GLOB 'wiki-*'" |
| 1031 | " ORDER BY lower(tagname) /*sort*/" |
| 1032 | ); |
| 1033 | while( db_step(&q)==SQLITE_ROW ){ |
| 1034 | const char *zName = db_column_text(&q, 0); |
| 1035 |
| --- src/wiki.c | |
| +++ src/wiki.c | |
| @@ -138,23 +138,23 @@ | |
| 138 | @ %h(zHomePageName)</a> wiki home page.</li> |
| 139 | } |
| 140 | } |
| 141 | @ <li> <a href="%s(g.zBaseURL)/timeline?y=w">Recent changes</a> to wiki |
| 142 | @ pages. </li> |
| 143 | @ <li> <a href="%s(g.zBaseURL)/wiki_rules">Formatting rules</a> for |
| 144 | @ wiki.</li> |
| 145 | @ <li> Use the <a href="%s(g.zBaseURL)/wiki?name=Sandbox">Sandbox</a> |
| 146 | @ to experiment.</li> |
| 147 | if( g.okNewWiki ){ |
| 148 | @ <li> Create a <a href="%s(g.zBaseURL)/wikinew">new wiki page</a>.</li> |
| 149 | } |
| 150 | @ <li> <a href="%s(g.zBaseURL)/wcontent">List of All Wiki Pages</a> |
| 151 | @ available on this server.</li> |
| 152 | @ <li> <form method="GET" action="%s(g.zBaseURL)/wfind"> |
| 153 | @ Search wiki titles: <input type="text" name="title"/> |
| 154 | @ <input type="submit" /> |
| 155 | @ </li> |
| 156 | @ </ul> |
| 157 | style_footer(); |
| 158 | return; |
| 159 | } |
| 160 | if( check_name(zPageName) ) return; |
| @@ -161,11 +161,11 @@ | |
| 161 | isSandbox = is_sandbox(zPageName); |
| 162 | if( isSandbox ){ |
| 163 | zBody = db_get("sandbox",zBody); |
| 164 | }else{ |
| 165 | zTag = mprintf("wiki-%s", zPageName); |
| 166 | rid = db_int(0, |
| 167 | "SELECT rid FROM tagxref" |
| 168 | " WHERE tagid=(SELECT tagid FROM tag WHERE tagname=%Q)" |
| 169 | " ORDER BY mtime DESC", zTag |
| 170 | ); |
| 171 | free(zTag); |
| @@ -233,11 +233,11 @@ | |
| 233 | } |
| 234 | if( cnt ){ |
| 235 | @ </ul> |
| 236 | } |
| 237 | db_finalize(&q); |
| 238 | |
| 239 | if( !isSandbox ){ |
| 240 | manifest_clear(&m); |
| 241 | } |
| 242 | style_footer(); |
| 243 | } |
| @@ -273,11 +273,11 @@ | |
| 273 | if( zBody==0 ){ |
| 274 | zBody = db_get("sandbox",""); |
| 275 | } |
| 276 | }else{ |
| 277 | zTag = mprintf("wiki-%s", zPageName); |
| 278 | rid = db_int(0, |
| 279 | "SELECT rid FROM tagxref" |
| 280 | " WHERE tagid=(SELECT tagid FROM tag WHERE tagname=%Q)" |
| 281 | " ORDER BY mtime DESC", zTag |
| 282 | ); |
| 283 | free(zTag); |
| @@ -355,11 +355,11 @@ | |
| 355 | if( n<20 ) n = 20; |
| 356 | if( n>40 ) n = 40; |
| 357 | @ <form method="POST" action="%s(g.zBaseURL)/wikiedit"> |
| 358 | login_insert_csrf_secret(); |
| 359 | @ <input type="hidden" name="name" value="%h(zPageName)"> |
| 360 | @ <textarea name="w" class="wikiedit" cols="80" |
| 361 | @ rows="%d(n)" wrap="virtual">%h(zBody)</textarea> |
| 362 | @ <br> |
| 363 | @ <input type="submit" name="preview" value="Preview Your Changes"> |
| 364 | @ <input type="submit" name="submit" value="Apply These Changes"> |
| 365 | @ <input type="submit" name="cancel" value="Cancel"> |
| @@ -381,11 +381,11 @@ | |
| 381 | const char *zName; |
| 382 | login_check_credentials(); |
| 383 | if( !g.okNewWiki ){ |
| 384 | login_needed(); |
| 385 | return; |
| 386 | } |
| 387 | zName = PD("name",""); |
| 388 | if( zName[0] && wiki_name_is_wellformed((const unsigned char *)zName) ){ |
| 389 | cgi_redirectf("wikiedit?name=%T", zName); |
| 390 | } |
| 391 | style_header("Create A New Wiki Page"); |
| @@ -414,11 +414,11 @@ | |
| 414 | const char *zRemark; |
| 415 | char *zId; |
| 416 | |
| 417 | zDate = db_text(0, "SELECT datetime('now')"); |
| 418 | zId = db_text(0, "SELECT lower(hex(randomblob(8)))"); |
| 419 | blob_appendf(p, "\n\n<hr><div id=\"%s\"><i>On %s UTC %h", |
| 420 | zId, zDate, g.zLogin); |
| 421 | free(zDate); |
| 422 | zUser = PD("u",g.zLogin); |
| 423 | if( zUser[0] && strcmp(zUser,g.zLogin) ){ |
| 424 | blob_appendf(p, " (claiming to be %h)", zUser); |
| @@ -443,11 +443,11 @@ | |
| 443 | zPageName = PD("name",""); |
| 444 | if( check_name(zPageName) ) return; |
| 445 | isSandbox = is_sandbox(zPageName); |
| 446 | if( !isSandbox ){ |
| 447 | zTag = mprintf("wiki-%s", zPageName); |
| 448 | rid = db_int(0, |
| 449 | "SELECT rid FROM tagxref" |
| 450 | " WHERE tagid=(SELECT tagid FROM tag WHERE tagname=%Q)" |
| 451 | " ORDER BY mtime DESC", zTag |
| 452 | ); |
| 453 | free(zTag); |
| @@ -530,11 +530,11 @@ | |
| 530 | login_insert_csrf_secret(); |
| 531 | @ <input type="hidden" name="name" value="%h(zPageName)"> |
| 532 | @ Your Name: |
| 533 | @ <input type="text" name="u" size="20" value="%h(zUser)"><br> |
| 534 | @ Comment to append:<br> |
| 535 | @ <textarea name="r" class="wikiedit" cols="80" |
| 536 | @ rows="10" wrap="virtual">%h(PD("r",""))</textarea> |
| 537 | @ <br> |
| 538 | @ <input type="submit" name="preview" value="Preview Your Comment"> |
| 539 | @ <input type="submit" name="submit" value="Append Your Changes"> |
| 540 | @ <input type="submit" name="cancel" value="Cancel"> |
| @@ -661,11 +661,11 @@ | |
| 661 | style_submenu_element("Active", "Only Active Pages", "%s/wcontent", g.zTop); |
| 662 | }else{ |
| 663 | style_submenu_element("All", "All", "%s/wcontent?all=1", g.zTop); |
| 664 | } |
| 665 | @ <ul> |
| 666 | db_prepare(&q, |
| 667 | "SELECT" |
| 668 | " substr(tagname, 6)," |
| 669 | " (SELECT value FROM tagxref WHERE tagid=tag.tagid ORDER BY mtime DESC)" |
| 670 | " FROM tag WHERE tagname GLOB 'wiki-*'" |
| 671 | " ORDER BY lower(tagname) /*sort*/" |
| @@ -696,14 +696,14 @@ | |
| 696 | login_check_credentials(); |
| 697 | if( !g.okRdWiki ){ login_needed(); return; } |
| 698 | zTitle = PD("title","*"); |
| 699 | style_header("Wiki Pages Found"); |
| 700 | @ <ul> |
| 701 | db_prepare(&q, |
| 702 | "SELECT substr(tagname, 6, 1000) FROM tag WHERE tagname like 'wiki-%%%q%%'" |
| 703 | " ORDER BY lower(tagname) /*sort*/" , |
| 704 | zTitle); |
| 705 | while( db_step(&q)==SQLITE_ROW ){ |
| 706 | const char *zName = db_column_text(&q, 0); |
| 707 | @ <li><a href="%s(g.zBaseURL)/wiki?name=%T(zName)">%h(zName)</a></li> |
| 708 | } |
| 709 | db_finalize(&q); |
| @@ -747,11 +747,11 @@ | |
| 747 | @ surrounded on both sides by two or more spaces or by a tab. Only a single |
| 748 | @ level of enumeration list is supported by wiki. For nested lists or for |
| 749 | @ enumerations that count using letters or roman numerials, use HTML.</p> |
| 750 | @ <li> <p><b>Indented Paragraphs</b>. |
| 751 | @ Any paragraph that begins with two or more spaces or a tab and |
| 752 | @ which is not a bullet or enumeration list item is rendered |
| 753 | @ indented. Only a single level of indentation is supported by wiki; use |
| 754 | @ HTML for deeper indentation.</p> |
| 755 | @ <li> <p><b>Hyperlinks</b>. |
| 756 | @ Text within square brackets ("[...]") becomes a hyperlink. The |
| 757 | @ target can be a wiki page name, the artifact ID of a check-in or ticket, |
| @@ -879,11 +879,11 @@ | |
| 879 | db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", nrid); |
| 880 | manifest_crosslink(nrid,&wiki); |
| 881 | blob_reset(&wiki); |
| 882 | content_deltify(rid,nrid,0); |
| 883 | db_end_transaction(0); |
| 884 | autosync(AUTOSYNC_PUSH); |
| 885 | return 1; |
| 886 | } |
| 887 | |
| 888 | /* |
| 889 | ** COMMAND: wiki |
| @@ -910,21 +910,21 @@ | |
| 910 | ** %fossil wiki list |
| 911 | ** |
| 912 | ** Lists all wiki entries, one per line, ordered |
| 913 | ** case-insentively by name. |
| 914 | ** |
| 915 | ** TODOs: |
| 916 | ** |
| 917 | ** %fossil wiki export ?-u ARTIFACT? WikiName ?FILE? |
| 918 | ** |
| 919 | ** Outputs the selected version of WikiName. |
| 920 | ** |
| 921 | ** %fossil wiki delete ?-m MESSAGE? WikiName |
| 922 | ** |
| 923 | ** The same as deleting a file entry, but i don't know if fossil |
| 924 | ** supports a commit message for Wiki entries. |
| 925 | ** |
| 926 | ** %fossil wiki ?-u? ?-d? ?-s=[|]? list |
| 927 | ** |
| 928 | ** Lists the artifact ID and/or Date of last change along with |
| 929 | ** each entry name, delimited by the -s char. |
| 930 | ** |
| @@ -956,11 +956,11 @@ | |
| 956 | } |
| 957 | zPageName = g.argv[3]; |
| 958 | rid = db_int(0, "SELECT x.rid FROM tag t, tagxref x" |
| 959 | " WHERE x.tagid=t.tagid AND t.tagname='wiki-%q'" |
| 960 | " ORDER BY x.mtime DESC LIMIT 1", |
| 961 | zPageName |
| 962 | ); |
| 963 | if( rid ){ |
| 964 | Blob content; |
| 965 | content_get(rid, &content); |
| 966 | manifest_parse(&m, &content); |
| @@ -986,11 +986,11 @@ | |
| 986 | fossil_fatal("wiki export could not open output file for writing."); |
| 987 | } |
| 988 | fprintf(zF,"%.*s\n", i, zBody); |
| 989 | if( doClose ) fclose(zF); |
| 990 | }else{ |
| 991 | printf("%.*s\n", i, zBody); |
| 992 | } |
| 993 | return; |
| 994 | }else |
| 995 | if( strncmp(g.argv[2],"commit",n)==0 |
| 996 | || strncmp(g.argv[2],"create",n)==0 ){ |
| @@ -1013,22 +1013,18 @@ | |
| 1013 | printf("Updated wiki page %s.\n", zPageName); |
| 1014 | } |
| 1015 | blob_reset(&content); |
| 1016 | }else |
| 1017 | if( strncmp(g.argv[2],"delete",n)==0 ){ |
| 1018 | if( g.argc!=5 ){ |
| 1019 | usage("delete PAGENAME"); |
| 1020 | } |
| 1021 | fossil_fatal("delete not yet implemented."); |
| 1022 | }else |
| 1023 | if( strncmp(g.argv[2],"list",n)==0 ){ |
| 1024 | Stmt q; |
| 1025 | db_prepare(&q, |
| 1026 | "SELECT substr(tagname, 6) FROM tag WHERE tagname GLOB 'wiki-*'" |
| 1027 | " ORDER BY lower(tagname) /*sort*/" |
| 1028 | ); |
| 1029 | while( db_step(&q)==SQLITE_ROW ){ |
| 1030 | const char *zName = db_column_text(&q, 0); |
| 1031 |