Fossil SCM

Change the "/wiki_rules" page so that it displays a wiki source file, either formatted or plain-text, just like /md_rules does.

drh 2017-11-04 14:56 trunk
Commit bf69c6ebc998fe2c646af24eeaf1f280f4f819e9937e9aceb3977dc699fb90e7
+2 -1
--- src/main.mk
+++ src/main.mk
@@ -193,11 +193,12 @@
193193
$(SRCDIR)/../skins/xekri/css.txt \
194194
$(SRCDIR)/../skins/xekri/details.txt \
195195
$(SRCDIR)/../skins/xekri/footer.txt \
196196
$(SRCDIR)/../skins/xekri/header.txt \
197197
$(SRCDIR)/diff.tcl \
198
- $(SRCDIR)/markdown.md
198
+ $(SRCDIR)/markdown.md \
199
+ $(SRCDIR)/wiki.wiki
199200
200201
TRANS_SRC = \
201202
$(OBJDIR)/add_.c \
202203
$(OBJDIR)/allrepo_.c \
203204
$(OBJDIR)/attach_.c \
204205
--- src/main.mk
+++ src/main.mk
@@ -193,11 +193,12 @@
193 $(SRCDIR)/../skins/xekri/css.txt \
194 $(SRCDIR)/../skins/xekri/details.txt \
195 $(SRCDIR)/../skins/xekri/footer.txt \
196 $(SRCDIR)/../skins/xekri/header.txt \
197 $(SRCDIR)/diff.tcl \
198 $(SRCDIR)/markdown.md
 
199
200 TRANS_SRC = \
201 $(OBJDIR)/add_.c \
202 $(OBJDIR)/allrepo_.c \
203 $(OBJDIR)/attach_.c \
204
--- src/main.mk
+++ src/main.mk
@@ -193,11 +193,12 @@
193 $(SRCDIR)/../skins/xekri/css.txt \
194 $(SRCDIR)/../skins/xekri/details.txt \
195 $(SRCDIR)/../skins/xekri/footer.txt \
196 $(SRCDIR)/../skins/xekri/header.txt \
197 $(SRCDIR)/diff.tcl \
198 $(SRCDIR)/markdown.md \
199 $(SRCDIR)/wiki.wiki
200
201 TRANS_SRC = \
202 $(OBJDIR)/add_.c \
203 $(OBJDIR)/allrepo_.c \
204 $(OBJDIR)/attach_.c \
205
--- src/makemake.tcl
+++ src/makemake.tcl
@@ -152,10 +152,11 @@
152152
# Additional resource files that get built into the executable.
153153
#
154154
set extra_files {
155155
diff.tcl
156156
markdown.md
157
+ wiki.wiki
157158
../skins/*/*.txt
158159
}
159160
160161
# Options used to compile the included SQLite library.
161162
#
162163
--- src/makemake.tcl
+++ src/makemake.tcl
@@ -152,10 +152,11 @@
152 # Additional resource files that get built into the executable.
153 #
154 set extra_files {
155 diff.tcl
156 markdown.md
 
157 ../skins/*/*.txt
158 }
159
160 # Options used to compile the included SQLite library.
161 #
162
--- src/makemake.tcl
+++ src/makemake.tcl
@@ -152,10 +152,11 @@
152 # Additional resource files that get built into the executable.
153 #
154 set extra_files {
155 diff.tcl
156 markdown.md
157 wiki.wiki
158 ../skins/*/*.txt
159 }
160
161 # Options used to compile the included SQLite library.
162 #
163
+20 -73
--- src/wiki.c
+++ src/wiki.c
@@ -192,10 +192,30 @@
192192
blob_init(&x, builtin_text("markdown.md"), -1);
193193
wiki_render_by_mimetype(&x, fTxt ? "text/plain" : "text/x-markdown");
194194
blob_reset(&x);
195195
style_footer();
196196
}
197
+
198
+/*
199
+** WEBPAGE: wiki_rules
200
+**
201
+** Show a summary of the wiki formatting rules.
202
+*/
203
+void wiki_rules_page(void){
204
+ Blob x;
205
+ int fTxt = P("txt")!=0;
206
+ style_header("Wiki Formatting Rules");
207
+ if( fTxt ){
208
+ style_submenu_element("Formatted", "%R/wiki_rules");
209
+ }else{
210
+ style_submenu_element("Plain-Text", "%R/wiki_rules?txt=1");
211
+ }
212
+ blob_init(&x, builtin_text("wiki.wiki"), -1);
213
+ wiki_render_by_mimetype(&x, fTxt ? "text/plain" : "text/x-fossil-wiki");
214
+ blob_reset(&x);
215
+ style_footer();
216
+}
197217
198218
/*
199219
** Returns non-zero if moderation is required for wiki changes and wiki
200220
** attachments.
201221
*/
@@ -990,83 +1010,10 @@
9901010
const char *zName = db_column_text(&q, 0);
9911011
@ <li>%z(href("%R/wiki?name=%T",zName))%h(zName)</a></li>
9921012
}
9931013
db_finalize(&q);
9941014
@ </ul>
995
- style_footer();
996
-}
997
-
998
-/*
999
-** WEBPAGE: wiki_rules
1000
-**
1001
-** Show the formatting rules for Fossil wiki.
1002
-*/
1003
-void wikirules_page(void){
1004
- style_header("Wiki Formatting Rules");
1005
- @ <h2>Formatting Rule Summary</h2>
1006
- @ <ol>
1007
- @ <li>Blank lines are paragraph breaks</li>
1008
- @ <li>Bullets are "*" surrounded by two spaces at the beginning of the
1009
- @ line.</li>
1010
- @ <li>Enumeration items are "#" surrounded by two spaces at the beginning of
1011
- @ a line.</li>
1012
- @ <li>Indented paragraphs begin with a tab or two spaces.</li>
1013
- @ <li>Hyperlinks are contained with square brackets: "[target]" or
1014
- @ "[target|name]".</li>
1015
- @ <li>Most ordinary HTML works.</li>
1016
- @ <li>&lt;verbatim&gt; and &lt;nowiki&gt;.</li>
1017
- @ </ol>
1018
- @ <p>We call the first five rules above "wiki" formatting rules. The
1019
- @ last two rules are the HTML formatting rule.</p>
1020
- @ <h2>Formatting Rule Details</h2>
1021
- @ <ol>
1022
- @ <li> <p><span class="wikiruleHead">Paragraphs</span>.
1023
- @ Any sequence of one or more blank lines forms
1024
- @ a paragraph break. Centered or right-justified paragraphs are not
1025
- @ supported by wiki markup, but you can do these things if you need them
1026
- @ using HTML.</p></li>
1027
- @ <li> <p><span class="wikiruleHead">Bullet Lists</span>.
1028
- @ A bullet list item is a line that begins with a single "*" character
1029
- @ surrounded on
1030
- @ both sides by two or more spaces or by a tab. Only a single level
1031
- @ of bullet list is supported by wiki. For nested lists, use HTML.</p></li>
1032
- @ <li> <p><span class="wikiruleHead">Enumeration Lists</span>.
1033
- @ An enumeration list item is a line that begins with a single "#" character
1034
- @ surrounded on both sides by two or more spaces or by a tab. Only a single
1035
- @ level of enumeration list is supported by wiki. For nested lists or for
1036
- @ enumerations that count using letters or roman numerials, use HTML.</p></li>
1037
- @ <li> <p><span class="wikiruleHead">Indented Paragraphs</span>.
1038
- @ Any paragraph that begins with two or more spaces or a tab and
1039
- @ which is not a bullet or enumeration list item is rendered
1040
- @ indented. Only a single level of indentation is supported by wiki; use
1041
- @ HTML for deeper indentation.</p></li>
1042
- @ <li> <p><span class="wikiruleHead">Hyperlinks</span>.
1043
- @ Text within square brackets ("[...]") becomes a hyperlink. The
1044
- @ target can be a wiki page name, the artifact ID of a check-in or ticket,
1045
- @ the name of an image, or a URL. By default, the target is displayed
1046
- @ as the text of the hyperlink. But you can specify alternative text
1047
- @ after the target name separated by a "|" character.</p>
1048
- @ <p>You can also link to internal anchor names using [#anchor-name],
1049
- @ providing
1050
- @ you have added the necessary "&lt;a name='anchor-name'&gt;&lt;/a&gt;"
1051
- @ tag to your wiki page.</p></li>
1052
- @ <li> <p><span class="wikiruleHead">HTML</span>.
1053
- @ The following standard HTML elements may be used:
1054
- show_allowed_wiki_markup();
1055
- @ . There are two non-standard elements available:
1056
- @ &lt;verbatim&gt; and &lt;nowiki&gt;.
1057
- @ No other elements are allowed. All attributes are checked and
1058
- @ only a few benign attributes are allowed on each element.
1059
- @ In particular, any attributes that specify javascript or CSS
1060
- @ are elided.</p></li>
1061
- @ <li><p><span class="wikiruleHead">Special Markup.</span>
1062
- @ The &lt;nowiki&gt; tag disables all wiki formatting rules
1063
- @ through the matching &lt;/nowiki&gt; element.
1064
- @ The &lt;verbatim&gt; tag works like &lt;pre&gt; with the addition
1065
- @ that it also disables all wiki and HTML markup
1066
- @ through the matching &lt;/verbatim&gt;.</p></li>
1067
- @ </ol>
10681015
style_footer();
10691016
}
10701017
10711018
/*
10721019
** Add a new wiki page to the repository. The page name is
10731020
10741021
ADDED src/wiki.wiki
--- src/wiki.c
+++ src/wiki.c
@@ -192,10 +192,30 @@
192 blob_init(&x, builtin_text("markdown.md"), -1);
193 wiki_render_by_mimetype(&x, fTxt ? "text/plain" : "text/x-markdown");
194 blob_reset(&x);
195 style_footer();
196 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
197
198 /*
199 ** Returns non-zero if moderation is required for wiki changes and wiki
200 ** attachments.
201 */
@@ -990,83 +1010,10 @@
990 const char *zName = db_column_text(&q, 0);
991 @ <li>%z(href("%R/wiki?name=%T",zName))%h(zName)</a></li>
992 }
993 db_finalize(&q);
994 @ </ul>
995 style_footer();
996 }
997
998 /*
999 ** WEBPAGE: wiki_rules
1000 **
1001 ** Show the formatting rules for Fossil wiki.
1002 */
1003 void wikirules_page(void){
1004 style_header("Wiki Formatting Rules");
1005 @ <h2>Formatting Rule Summary</h2>
1006 @ <ol>
1007 @ <li>Blank lines are paragraph breaks</li>
1008 @ <li>Bullets are "*" surrounded by two spaces at the beginning of the
1009 @ line.</li>
1010 @ <li>Enumeration items are "#" surrounded by two spaces at the beginning of
1011 @ a line.</li>
1012 @ <li>Indented paragraphs begin with a tab or two spaces.</li>
1013 @ <li>Hyperlinks are contained with square brackets: "[target]" or
1014 @ "[target|name]".</li>
1015 @ <li>Most ordinary HTML works.</li>
1016 @ <li>&lt;verbatim&gt; and &lt;nowiki&gt;.</li>
1017 @ </ol>
1018 @ <p>We call the first five rules above "wiki" formatting rules. The
1019 @ last two rules are the HTML formatting rule.</p>
1020 @ <h2>Formatting Rule Details</h2>
1021 @ <ol>
1022 @ <li> <p><span class="wikiruleHead">Paragraphs</span>.
1023 @ Any sequence of one or more blank lines forms
1024 @ a paragraph break. Centered or right-justified paragraphs are not
1025 @ supported by wiki markup, but you can do these things if you need them
1026 @ using HTML.</p></li>
1027 @ <li> <p><span class="wikiruleHead">Bullet Lists</span>.
1028 @ A bullet list item is a line that begins with a single "*" character
1029 @ surrounded on
1030 @ both sides by two or more spaces or by a tab. Only a single level
1031 @ of bullet list is supported by wiki. For nested lists, use HTML.</p></li>
1032 @ <li> <p><span class="wikiruleHead">Enumeration Lists</span>.
1033 @ An enumeration list item is a line that begins with a single "#" character
1034 @ surrounded on both sides by two or more spaces or by a tab. Only a single
1035 @ level of enumeration list is supported by wiki. For nested lists or for
1036 @ enumerations that count using letters or roman numerials, use HTML.</p></li>
1037 @ <li> <p><span class="wikiruleHead">Indented Paragraphs</span>.
1038 @ Any paragraph that begins with two or more spaces or a tab and
1039 @ which is not a bullet or enumeration list item is rendered
1040 @ indented. Only a single level of indentation is supported by wiki; use
1041 @ HTML for deeper indentation.</p></li>
1042 @ <li> <p><span class="wikiruleHead">Hyperlinks</span>.
1043 @ Text within square brackets ("[...]") becomes a hyperlink. The
1044 @ target can be a wiki page name, the artifact ID of a check-in or ticket,
1045 @ the name of an image, or a URL. By default, the target is displayed
1046 @ as the text of the hyperlink. But you can specify alternative text
1047 @ after the target name separated by a "|" character.</p>
1048 @ <p>You can also link to internal anchor names using [#anchor-name],
1049 @ providing
1050 @ you have added the necessary "&lt;a name='anchor-name'&gt;&lt;/a&gt;"
1051 @ tag to your wiki page.</p></li>
1052 @ <li> <p><span class="wikiruleHead">HTML</span>.
1053 @ The following standard HTML elements may be used:
1054 show_allowed_wiki_markup();
1055 @ . There are two non-standard elements available:
1056 @ &lt;verbatim&gt; and &lt;nowiki&gt;.
1057 @ No other elements are allowed. All attributes are checked and
1058 @ only a few benign attributes are allowed on each element.
1059 @ In particular, any attributes that specify javascript or CSS
1060 @ are elided.</p></li>
1061 @ <li><p><span class="wikiruleHead">Special Markup.</span>
1062 @ The &lt;nowiki&gt; tag disables all wiki formatting rules
1063 @ through the matching &lt;/nowiki&gt; element.
1064 @ The &lt;verbatim&gt; tag works like &lt;pre&gt; with the addition
1065 @ that it also disables all wiki and HTML markup
1066 @ through the matching &lt;/verbatim&gt;.</p></li>
1067 @ </ol>
1068 style_footer();
1069 }
1070
1071 /*
1072 ** Add a new wiki page to the repository. The page name is
1073
1074 DDED src/wiki.wiki
--- src/wiki.c
+++ src/wiki.c
@@ -192,10 +192,30 @@
192 blob_init(&x, builtin_text("markdown.md"), -1);
193 wiki_render_by_mimetype(&x, fTxt ? "text/plain" : "text/x-markdown");
194 blob_reset(&x);
195 style_footer();
196 }
197
198 /*
199 ** WEBPAGE: wiki_rules
200 **
201 ** Show a summary of the wiki formatting rules.
202 */
203 void wiki_rules_page(void){
204 Blob x;
205 int fTxt = P("txt")!=0;
206 style_header("Wiki Formatting Rules");
207 if( fTxt ){
208 style_submenu_element("Formatted", "%R/wiki_rules");
209 }else{
210 style_submenu_element("Plain-Text", "%R/wiki_rules?txt=1");
211 }
212 blob_init(&x, builtin_text("wiki.wiki"), -1);
213 wiki_render_by_mimetype(&x, fTxt ? "text/plain" : "text/x-fossil-wiki");
214 blob_reset(&x);
215 style_footer();
216 }
217
218 /*
219 ** Returns non-zero if moderation is required for wiki changes and wiki
220 ** attachments.
221 */
@@ -990,83 +1010,10 @@
1010 const char *zName = db_column_text(&q, 0);
1011 @ <li>%z(href("%R/wiki?name=%T",zName))%h(zName)</a></li>
1012 }
1013 db_finalize(&q);
1014 @ </ul>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1015 style_footer();
1016 }
1017
1018 /*
1019 ** Add a new wiki page to the repository. The page name is
1020
1021 DDED src/wiki.wiki
--- a/src/wiki.wiki
+++ b/src/wiki.wiki
@@ -0,0 +1 @@
1
+[target]" or "[target|label]
--- a/src/wiki.wiki
+++ b/src/wiki.wiki
@@ -0,0 +1 @@
 
--- a/src/wiki.wiki
+++ b/src/wiki.wiki
@@ -0,0 +1 @@
1 [target]" or "[target|label]
--- win/Makefile.mingw
+++ win/Makefile.mingw
@@ -602,11 +602,12 @@
602602
$(SRCDIR)/../skins/xekri/css.txt \
603603
$(SRCDIR)/../skins/xekri/details.txt \
604604
$(SRCDIR)/../skins/xekri/footer.txt \
605605
$(SRCDIR)/../skins/xekri/header.txt \
606606
$(SRCDIR)/diff.tcl \
607
- $(SRCDIR)/markdown.md
607
+ $(SRCDIR)/markdown.md \
608
+ $(SRCDIR)/wiki.wiki
608609
609610
TRANS_SRC = \
610611
$(OBJDIR)/add_.c \
611612
$(OBJDIR)/allrepo_.c \
612613
$(OBJDIR)/attach_.c \
613614
--- win/Makefile.mingw
+++ win/Makefile.mingw
@@ -602,11 +602,12 @@
602 $(SRCDIR)/../skins/xekri/css.txt \
603 $(SRCDIR)/../skins/xekri/details.txt \
604 $(SRCDIR)/../skins/xekri/footer.txt \
605 $(SRCDIR)/../skins/xekri/header.txt \
606 $(SRCDIR)/diff.tcl \
607 $(SRCDIR)/markdown.md
 
608
609 TRANS_SRC = \
610 $(OBJDIR)/add_.c \
611 $(OBJDIR)/allrepo_.c \
612 $(OBJDIR)/attach_.c \
613
--- win/Makefile.mingw
+++ win/Makefile.mingw
@@ -602,11 +602,12 @@
602 $(SRCDIR)/../skins/xekri/css.txt \
603 $(SRCDIR)/../skins/xekri/details.txt \
604 $(SRCDIR)/../skins/xekri/footer.txt \
605 $(SRCDIR)/../skins/xekri/header.txt \
606 $(SRCDIR)/diff.tcl \
607 $(SRCDIR)/markdown.md \
608 $(SRCDIR)/wiki.wiki
609
610 TRANS_SRC = \
611 $(OBJDIR)/add_.c \
612 $(OBJDIR)/allrepo_.c \
613 $(OBJDIR)/attach_.c \
614
--- win/Makefile.msc
+++ win/Makefile.msc
@@ -528,11 +528,12 @@
528528
$(SRCDIR)\../skins/xekri/css.txt \
529529
$(SRCDIR)\../skins/xekri/details.txt \
530530
$(SRCDIR)\../skins/xekri/footer.txt \
531531
$(SRCDIR)\../skins/xekri/header.txt \
532532
$(SRCDIR)\diff.tcl \
533
- $(SRCDIR)\markdown.md
533
+ $(SRCDIR)\markdown.md \
534
+ $(SRCDIR)\wiki.wiki
534535
535536
OBJ = $(OX)\add$O \
536537
$(OX)\allrepo$O \
537538
$(OX)\attach$O \
538539
$(OX)\bag$O \
539540
--- win/Makefile.msc
+++ win/Makefile.msc
@@ -528,11 +528,12 @@
528 $(SRCDIR)\../skins/xekri/css.txt \
529 $(SRCDIR)\../skins/xekri/details.txt \
530 $(SRCDIR)\../skins/xekri/footer.txt \
531 $(SRCDIR)\../skins/xekri/header.txt \
532 $(SRCDIR)\diff.tcl \
533 $(SRCDIR)\markdown.md
 
534
535 OBJ = $(OX)\add$O \
536 $(OX)\allrepo$O \
537 $(OX)\attach$O \
538 $(OX)\bag$O \
539
--- win/Makefile.msc
+++ win/Makefile.msc
@@ -528,11 +528,12 @@
528 $(SRCDIR)\../skins/xekri/css.txt \
529 $(SRCDIR)\../skins/xekri/details.txt \
530 $(SRCDIR)\../skins/xekri/footer.txt \
531 $(SRCDIR)\../skins/xekri/header.txt \
532 $(SRCDIR)\diff.tcl \
533 $(SRCDIR)\markdown.md \
534 $(SRCDIR)\wiki.wiki
535
536 OBJ = $(OX)\add$O \
537 $(OX)\allrepo$O \
538 $(OX)\attach$O \
539 $(OX)\bag$O \
540

Keyboard Shortcuts

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