Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Initial commit of Creole Wiki Parser extension. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | creole |
| Files: | files | file ages | folders |
| SHA1: |
ecd1f0963263516b1d7983fdbdcfc9b0 |
| User & Date: | robert 2009-05-08 09:52:38.000 |
Context
|
2009-05-08
| ||
| 10:04 | Whoops - forgot to add the parser! check-in: b877d2cfcd user: robert tags: creole | |
| 09:52 | Initial commit of Creole Wiki Parser extension. check-in: ecd1f09632 user: robert tags: creole | |
|
2009-04-24
| ||
| 18:40 | There is some bug in the new HTTP transport layer. The easiest solution is to close the TCP connection after each round trip, which is what this check-in does. check-in: 767ae79c3d user: drh tags: trunk | |
Changes
src/admin.c became executable.
| ︙ | ︙ |
src/allrepo.c became executable.
| ︙ | ︙ |
src/bag.c became executable.
| ︙ | ︙ |
src/blob.c became executable.
| ︙ | ︙ |
src/branch.c became executable.
| ︙ | ︙ |
src/browse.c became executable.
| ︙ | ︙ |
src/cgi.c became executable.
| ︙ | ︙ |
src/checkin.c became executable.
| ︙ | ︙ |
src/checkout.c became executable.
| ︙ | ︙ |
src/clearsign.c became executable.
| ︙ | ︙ |
src/clone.c became executable.
| ︙ | ︙ |
src/comformat.c became executable.
| ︙ | ︙ |
src/config.h became executable.
| ︙ | ︙ |
src/configure.c became executable.
| ︙ | ︙ |
src/construct.c became executable.
| ︙ | ︙ |
src/content.c became executable.
| ︙ | ︙ |
src/db.c became executable.
| ︙ | ︙ |
src/delta.c became executable.
| ︙ | ︙ |
src/deltacmd.c became executable.
| ︙ | ︙ |
src/descendants.c became executable.
| ︙ | ︙ |
src/diff.c became executable.
| ︙ | ︙ |
src/diffcmd.c became executable.
| ︙ | ︙ |
src/doc.c became executable.
| ︙ | ︙ |
src/encode.c became executable.
| ︙ | ︙ |
src/file.c became executable.
| ︙ | ︙ |
src/http.c became executable.
| ︙ | ︙ |
src/http_socket.c became executable.
| ︙ | ︙ |
src/http_transport.c became executable.
| ︙ | ︙ |
src/info.c became executable.
| ︙ | ︙ |
src/login.c became executable.
| ︙ | ︙ |
src/main.c became executable.
| ︙ | ︙ |
Changes to src/main.mk.
| ︙ | ︙ | |||
25 26 27 28 29 30 31 32 33 34 35 36 37 38 | $(SRCDIR)/checkout.c \ $(SRCDIR)/clearsign.c \ $(SRCDIR)/clone.c \ $(SRCDIR)/comformat.c \ $(SRCDIR)/configure.c \ $(SRCDIR)/construct.c \ $(SRCDIR)/content.c \ $(SRCDIR)/db.c \ $(SRCDIR)/delta.c \ $(SRCDIR)/deltacmd.c \ $(SRCDIR)/descendants.c \ $(SRCDIR)/diff.c \ $(SRCDIR)/diffcmd.c \ $(SRCDIR)/doc.c \ | > | 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | $(SRCDIR)/checkout.c \ $(SRCDIR)/clearsign.c \ $(SRCDIR)/clone.c \ $(SRCDIR)/comformat.c \ $(SRCDIR)/configure.c \ $(SRCDIR)/construct.c \ $(SRCDIR)/content.c \ $(SRCDIR)/creoleparser.c \ $(SRCDIR)/db.c \ $(SRCDIR)/delta.c \ $(SRCDIR)/deltacmd.c \ $(SRCDIR)/descendants.c \ $(SRCDIR)/diff.c \ $(SRCDIR)/diffcmd.c \ $(SRCDIR)/doc.c \ |
| ︙ | ︙ | |||
95 96 97 98 99 100 101 102 103 104 105 106 107 108 | checkout_.c \ clearsign_.c \ clone_.c \ comformat_.c \ configure_.c \ construct_.c \ content_.c \ db_.c \ delta_.c \ deltacmd_.c \ descendants_.c \ diff_.c \ diffcmd_.c \ doc_.c \ | > | 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | checkout_.c \ clearsign_.c \ clone_.c \ comformat_.c \ configure_.c \ construct_.c \ content_.c \ creoleparser_.c \ db_.c \ delta_.c \ deltacmd_.c \ descendants_.c \ diff_.c \ diffcmd_.c \ doc_.c \ |
| ︙ | ︙ | |||
165 166 167 168 169 170 171 172 173 174 175 176 177 178 | checkout.o \ clearsign.o \ clone.o \ comformat.o \ configure.o \ construct.o \ content.o \ db.o \ delta.o \ deltacmd.o \ descendants.o \ diff.o \ diffcmd.o \ doc.o \ | > | 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 | checkout.o \ clearsign.o \ clone.o \ comformat.o \ configure.o \ construct.o \ content.o \ creoleparser.o \ db.o \ delta.o \ deltacmd.o \ descendants.o \ diff.o \ diffcmd.o \ doc.o \ |
| ︙ | ︙ | |||
253 254 255 256 257 258 259 | $(APPNAME): headers $(OBJ) sqlite3.o th.o th_lang.o $(TCC) -o $(APPNAME) $(OBJ) sqlite3.o th.o th_lang.o $(LIB) # This rule prevents make from using its default rules to try build # an executable named "manifest" out of the file named "manifest.c" # | | | | | | 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 | $(APPNAME): headers $(OBJ) sqlite3.o th.o th_lang.o $(TCC) -o $(APPNAME) $(OBJ) sqlite3.o th.o th_lang.o $(LIB) # This rule prevents make from using its default rules to try build # an executable named "manifest" out of the file named "manifest.c" # $(SRCDIR)/../manifest: # noop clean: rm -f *.o *_.c $(APPNAME) VERSION.h rm -f translate makeheaders mkindex page_index.h headers rm -f add.h admin.h allrepo.h bag.h blob.h branch.h browse.h cgi.h checkin.h checkout.h clearsign.h clone.h comformat.h configure.h construct.h content.h creoleparser.h db.h delta.h deltacmd.h descendants.h diff.h diffcmd.h doc.h encode.h file.h http.h http_socket.h http_transport.h info.h login.h main.h manifest.h md5.h merge.h merge3.h my_page.h name.h pivot.h pqueue.h printf.h rebuild.h report.h rss.h rstats.h schema.h setup.h sha1.h shun.h stat.h style.h sync.h tag.h tagview.h th_main.h timeline.h tkt.h tktsetup.h undo.h update.h url.h user.h verify.h vfile.h wiki.h wikiformat.h winhttp.h xfer.h zip.h page_index.h: $(TRANS_SRC) mkindex ./mkindex $(TRANS_SRC) >$@ headers: page_index.h makeheaders VERSION.h ./makeheaders add_.c:add.h admin_.c:admin.h allrepo_.c:allrepo.h bag_.c:bag.h blob_.c:blob.h branch_.c:branch.h browse_.c:browse.h cgi_.c:cgi.h checkin_.c:checkin.h checkout_.c:checkout.h clearsign_.c:clearsign.h clone_.c:clone.h comformat_.c:comformat.h configure_.c:configure.h construct_.c:construct.h content_.c:content.h creoleparser_.c:creoleparser.h db_.c:db.h delta_.c:delta.h deltacmd_.c:deltacmd.h descendants_.c:descendants.h diff_.c:diff.h diffcmd_.c:diffcmd.h doc_.c:doc.h encode_.c:encode.h file_.c:file.h http_.c:http.h http_socket_.c:http_socket.h http_transport_.c:http_transport.h info_.c:info.h login_.c:login.h main_.c:main.h manifest_.c:manifest.h md5_.c:md5.h merge_.c:merge.h merge3_.c:merge3.h my_page_.c:my_page.h name_.c:name.h pivot_.c:pivot.h pqueue_.c:pqueue.h printf_.c:printf.h rebuild_.c:rebuild.h report_.c:report.h rss_.c:rss.h rstats_.c:rstats.h schema_.c:schema.h setup_.c:setup.h sha1_.c:sha1.h shun_.c:shun.h stat_.c:stat.h style_.c:style.h sync_.c:sync.h tag_.c:tag.h tagview_.c:tagview.h th_main_.c:th_main.h timeline_.c:timeline.h tkt_.c:tkt.h tktsetup_.c:tktsetup.h undo_.c:undo.h update_.c:update.h url_.c:url.h user_.c:user.h verify_.c:verify.h vfile_.c:vfile.h wiki_.c:wiki.h wikiformat_.c:wikiformat.h winhttp_.c:winhttp.h xfer_.c:xfer.h zip_.c:zip.h $(SRCDIR)/sqlite3.h $(SRCDIR)/th.h VERSION.h touch headers headers: Makefile Makefile: add_.c: $(SRCDIR)/add.c $(SRCDIR)/VERSION translate ./translate $(SRCDIR)/add.c | sed -f $(SRCDIR)/VERSION >add_.c add.o: add_.c add.h $(SRCDIR)/config.h |
| ︙ | ︙ | |||
380 381 382 383 384 385 386 387 388 389 390 391 392 393 | content_.c: $(SRCDIR)/content.c $(SRCDIR)/VERSION translate ./translate $(SRCDIR)/content.c | sed -f $(SRCDIR)/VERSION >content_.c content.o: content_.c content.h $(SRCDIR)/config.h $(XTCC) -o content.o -c content_.c content.h: headers db_.c: $(SRCDIR)/db.c $(SRCDIR)/VERSION translate ./translate $(SRCDIR)/db.c | sed -f $(SRCDIR)/VERSION >db_.c db.o: db_.c db.h $(SRCDIR)/config.h $(XTCC) -o db.o -c db_.c db.h: headers | > > > > > > > | 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 | content_.c: $(SRCDIR)/content.c $(SRCDIR)/VERSION translate ./translate $(SRCDIR)/content.c | sed -f $(SRCDIR)/VERSION >content_.c content.o: content_.c content.h $(SRCDIR)/config.h $(XTCC) -o content.o -c content_.c content.h: headers creoleparser_.c: $(SRCDIR)/creoleparser.c $(SRCDIR)/VERSION translate ./translate $(SRCDIR)/creoleparser.c | sed -f $(SRCDIR)/VERSION >creoleparser_.c creoleparser.o: creoleparser_.c creoleparser.h $(SRCDIR)/config.h $(XTCC) -o creoleparser.o -c creoleparser_.c creoleparser.h: headers db_.c: $(SRCDIR)/db.c $(SRCDIR)/VERSION translate ./translate $(SRCDIR)/db.c | sed -f $(SRCDIR)/VERSION >db_.c db.o: db_.c db.h $(SRCDIR)/config.h $(XTCC) -o db.o -c db_.c db.h: headers |
| ︙ | ︙ |
src/makeheaders.c became executable.
| ︙ | ︙ |
src/makeheaders.html became executable.
| ︙ | ︙ |
Changes to src/makemake.tcl.
| ︙ | ︙ | |||
19 20 21 22 23 24 25 26 27 28 29 30 31 32 | checkout clearsign clone comformat configure construct content db delta deltacmd descendants diff diffcmd doc | > | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | checkout clearsign clone comformat configure construct content creoleparser db delta deltacmd descendants diff diffcmd doc |
| ︙ | ︙ | |||
145 146 147 148 149 150 151 | $(APPNAME): headers $(OBJ) sqlite3.o th.o th_lang.o $(TCC) -o $(APPNAME) $(OBJ) sqlite3.o th.o th_lang.o $(LIB) # This rule prevents make from using its default rules to try build # an executable named "manifest" out of the file named "manifest.c" # | | | | 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 |
$(APPNAME): headers $(OBJ) sqlite3.o th.o th_lang.o
$(TCC) -o $(APPNAME) $(OBJ) sqlite3.o th.o th_lang.o $(LIB)
# This rule prevents make from using its default rules to try build
# an executable named "manifest" out of the file named "manifest.c"
#
$(SRCDIR)/../manifest:
# noop
clean:
rm -f *.o *_.c $(APPNAME) VERSION.h
rm -f translate makeheaders mkindex page_index.h headers}
set hfiles {}
foreach s [lsort $src] {lappend hfiles $s.h}
puts "\trm -f $hfiles\n"
|
| ︙ | ︙ |
src/manifest.c became executable.
| ︙ | ︙ |
src/md5.c became executable.
| ︙ | ︙ |
src/merge.c became executable.
| ︙ | ︙ |
src/merge3.c became executable.
| ︙ | ︙ |
src/mkindex.c became executable.
| ︙ | ︙ |
src/my_page.c became executable.
| ︙ | ︙ |
src/name.c became executable.
| ︙ | ︙ |
src/pivot.c became executable.
| ︙ | ︙ |
src/pqueue.c became executable.
| ︙ | ︙ |
src/printf.c became executable.
| ︙ | ︙ |
src/rebuild.c became executable.
| ︙ | ︙ |
src/report.c became executable.
| ︙ | ︙ |
src/rss.c became executable.
| ︙ | ︙ |
src/rstats.c became executable.
| ︙ | ︙ |
src/schema.c became executable.
| ︙ | ︙ |
src/setup.c became executable.
| ︙ | ︙ |
src/sha1.c became executable.
| ︙ | ︙ |
src/shun.c became executable.
| ︙ | ︙ |
src/sqlite3.c became executable.
| ︙ | ︙ |
src/sqlite3.h became executable.
| ︙ | ︙ |
src/stat.c became executable.
| ︙ | ︙ |
src/style.c became executable.
| ︙ | ︙ |
src/sync.c became executable.
| ︙ | ︙ |
src/tag.c became executable.
| ︙ | ︙ |
src/tagview.c became executable.
| ︙ | ︙ |
src/th.c became executable.
| ︙ | ︙ |
src/th.h became executable.
| ︙ | ︙ |
src/th_lang.c became executable.
| ︙ | ︙ |
src/th_main.c became executable.
| ︙ | ︙ |
src/timeline.c became executable.
| ︙ | ︙ |
src/tkt.c became executable.
| ︙ | ︙ |
src/tktsetup.c became executable.
| ︙ | ︙ |
src/translate.c became executable.
| ︙ | ︙ |
src/undo.c became executable.
| ︙ | ︙ |
src/update.c became executable.
| ︙ | ︙ |
src/url.c became executable.
| ︙ | ︙ |
src/user.c became executable.
| ︙ | ︙ |
src/verify.c became executable.
| ︙ | ︙ |
src/vfile.c became executable.
| ︙ | ︙ |
Changes to src/wiki.c.
1 2 3 4 5 6 7 8 9 10 11 12 | /* ** Copyright (c) 2007 D. Richard Hipp ** Copyright (c) 2008 Stephan Beal ** ** This program is free software; you can redistribute it and/or ** modify it under the terms of the GNU General Public ** License version 2 as published by the Free Software Foundation. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | /* ** Copyright (c) 2007 D. Richard Hipp ** Copyright (c) 2008 Stephan Beal ** ** This program is free software; you can redistribute it and/or ** modify it under the terms of the GNU General Public ** License version 2 as published by the Free Software Foundation. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** You should have received a copy of the GNU General Public ** License along with this library; if not, write to the ** Free Software Foundation, Inc., 59 Temple Place - Suite 330, ** Boston, MA 02111-1307, USA. ** ** Author contact information: ** drh@hwaci.com |
| ︙ | ︙ | |||
134 135 136 137 138 139 140 |
if( zHomePageName ){
@ <li> <a href="%s(g.zBaseURL)/wiki?name=%s(zHomePageName)">
@ %s(zHomePageName)</a> wiki home page.</li>
}
}
@ <li> <a href="%s(g.zBaseURL)/timeline?y=w">Recent changes</a> to wiki
@ pages. </li>
| | | | 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 |
if( zHomePageName ){
@ <li> <a href="%s(g.zBaseURL)/wiki?name=%s(zHomePageName)">
@ %s(zHomePageName)</a> wiki home page.</li>
}
}
@ <li> <a href="%s(g.zBaseURL)/timeline?y=w">Recent changes</a> to wiki
@ pages. </li>
@ <li> <a href="%s(g.zBaseURL)/wiki_rules">Formatting rules</a> for
@ wiki.</li>
@ <li> Use the <a href="%s(g.zBaseURL)/wiki?name=Sandbox">Sandbox</a>
@ to experiment.</li>
@ <li> <a href="%s(g.zBaseURL)/wcontent">List of All Wiki Pages</a>
@ available on this server.</li>
@ </ul>
style_footer();
return;
}
if( check_name(zPageName) ) return;
isSandbox = is_sandbox(zPageName);
if( isSandbox ){
zBody = db_get("sandbox",zBody);
}else{
zTag = mprintf("wiki-%s", zPageName);
rid = db_int(0,
"SELECT rid FROM tagxref"
" WHERE tagid=(SELECT tagid FROM tag WHERE tagname=%Q)"
" ORDER BY mtime DESC", zTag
);
free(zTag);
memset(&m, 0, sizeof(m));
blob_zero(&m.content);
|
| ︙ | ︙ | |||
225 226 227 228 229 230 231 |
return;
}
if( zBody==0 ){
zBody = db_get("sandbox","");
}
}else{
zTag = mprintf("wiki-%s", zPageName);
| | | 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 |
return;
}
if( zBody==0 ){
zBody = db_get("sandbox","");
}
}else{
zTag = mprintf("wiki-%s", zPageName);
rid = db_int(0,
"SELECT rid FROM tagxref"
" WHERE tagid=(SELECT tagid FROM tag WHERE tagname=%Q)"
" ORDER BY mtime DESC", zTag
);
free(zTag);
if( (rid && !g.okWrWiki) || (!rid && !g.okNewWiki) ){
login_needed();
|
| ︙ | ︙ | |||
307 308 309 310 311 312 313 |
if( z[0]=='\n' ) n++;
}
if( n<20 ) n = 20;
if( n>40 ) n = 40;
@ <form method="POST" action="%s(g.zBaseURL)/wikiedit">
login_insert_csrf_secret();
@ <input type="hidden" name="name" value="%h(zPageName)">
| | | 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 |
if( z[0]=='\n' ) n++;
}
if( n<20 ) n = 20;
if( n>40 ) n = 40;
@ <form method="POST" action="%s(g.zBaseURL)/wikiedit">
login_insert_csrf_secret();
@ <input type="hidden" name="name" value="%h(zPageName)">
@ <textarea name="w" class="wikiedit" cols="80"
@ rows="%d(n)" wrap="virtual">%h(zBody)</textarea>
@ <br>
@ <input type="submit" name="preview" value="Preview Your Changes">
@ <input type="submit" name="submit" value="Apply These Changes">
@ <input type="submit" name="cancel" value="Cancel">
@ </form>
if( !isSandbox ){
|
| ︙ | ︙ | |||
331 332 333 334 335 336 337 |
char *zDate;
const char *zUser;
const char *zRemark;
char *zId;
zDate = db_text(0, "SELECT datetime('now')");
zId = db_text(0, "SELECT lower(hex(randomblob(8)))");
| > | | | | 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 |
char *zDate;
const char *zUser;
const char *zRemark;
char *zId;
zDate = db_text(0, "SELECT datetime('now')");
zId = db_text(0, "SELECT lower(hex(randomblob(8)))");
blob_append(p, "\n<<fossil>>\n", -1);
blob_appendf(p, "\n\n<hr><div id=\"%s\"><i>On %s UTC %h",
zId, zDate, g.zLogin);
free(zDate);
zUser = PD("u",g.zLogin);
if( zUser[0] && strcmp(zUser,g.zLogin) ){
blob_appendf(p, " (claiming to be %h)", zUser);
}
zRemark = PD("r","");
blob_appendf(p, " added:</i><br />\n%s\n<<fossil>>\n</div id=\"%s\">", zRemark, zId);
}
/*
** WEBPAGE: wikiappend
** URL: /wikiappend?name=PAGENAME
*/
void wikiappend_page(void){
char *zTag;
int rid = 0;
int isSandbox;
const char *zPageName;
char *zHtmlPageName;
const char *zUser;
login_check_credentials();
zPageName = PD("name","");
if( check_name(zPageName) ) return;
isSandbox = is_sandbox(zPageName);
if( !isSandbox ){
zTag = mprintf("wiki-%s", zPageName);
rid = db_int(0,
"SELECT rid FROM tagxref"
" WHERE tagid=(SELECT tagid FROM tag WHERE tagname=%Q)"
" ORDER BY mtime DESC", zTag
);
free(zTag);
if( !rid ){
fossil_redirect_home();
|
| ︙ | ︙ | |||
447 448 449 450 451 452 453 |
zUser = PD("u", g.zLogin);
@ <form method="POST" action="%s(g.zBaseURL)/wikiappend">
login_insert_csrf_secret();
@ <input type="hidden" name="name" value="%h(zPageName)">
@ Your Name:
@ <input type="text" name="u" size="20" value="%h(zUser)"><br>
@ Comment to append:<br>
| | | 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 |
zUser = PD("u", g.zLogin);
@ <form method="POST" action="%s(g.zBaseURL)/wikiappend">
login_insert_csrf_secret();
@ <input type="hidden" name="name" value="%h(zPageName)">
@ Your Name:
@ <input type="text" name="u" size="20" value="%h(zUser)"><br>
@ Comment to append:<br>
@ <textarea name="r" class="wikiedit" cols="80"
@ rows="10" wrap="virtual">%h(PD("r",""))</textarea>
@ <br>
@ <input type="submit" name="preview" value="Preview Your Comment">
@ <input type="submit" name="submit" value="Append Your Changes">
@ <input type="submit" name="cancel" value="Cancel">
@ </form>
style_footer();
|
| ︙ | ︙ | |||
498 499 500 501 502 503 504 |
*/
void wcontent_page(void){
Stmt q;
login_check_credentials();
if( !g.okRdWiki ){ login_needed(); return; }
style_header("Available Wiki Pages");
@ <ul>
| | | 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 |
*/
void wcontent_page(void){
Stmt q;
login_check_credentials();
if( !g.okRdWiki ){ login_needed(); return; }
style_header("Available Wiki Pages");
@ <ul>
db_prepare(&q,
"SELECT substr(tagname, 6, 1000) FROM tag WHERE tagname GLOB 'wiki-*'"
" ORDER BY lower(tagname)"
);
while( db_step(&q)==SQLITE_ROW ){
const char *zName = db_column_text(&q, 0);
@ <li><a href="%s(g.zBaseURL)/wiki?name=%T(zName)">%h(zName)</a></li>
}
|
| ︙ | ︙ | |||
550 551 552 553 554 555 556 | @ followed by a "." and is surrounded on both sides by two or more spaces or @ by a tab. The number is significant and becomes the number shown @ in the rendered enumeration item. Only a single level of enumeration @ list is supported by wiki. For nested enumerations or for @ enumerations that count using letters or roman numerials, use HTML.</p> @ <li> <p><b>Indented Paragraphs</b>. @ Any paragraph that begins with two or more spaces or a tab and | | | 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 |
@ followed by a "." and is surrounded on both sides by two or more spaces or
@ by a tab. The number is significant and becomes the number shown
@ in the rendered enumeration item. Only a single level of enumeration
@ list is supported by wiki. For nested enumerations or for
@ enumerations that count using letters or roman numerials, use HTML.</p>
@ <li> <p><b>Indented Paragraphs</b>.
@ Any paragraph that begins with two or more spaces or a tab and
@ which is not a bullet or enumeration list item is rendered
@ indented. Only a single level of indentation is supported by wiki; use
@ HTML for deeper indentation.</p>
@ <li> <p><b>Hyperlinks</b>.
@ Text within square brackets ("[...]") becomes a hyperlink. The
@ target can be a wiki page name, the artifact ID of a check-in or ticket,
@ the name of an image, or a URL. By default, the target is displayed
@ as the text of the hyperlink. But you can specify alternative text
|
| ︙ | ︙ | |||
679 680 681 682 683 684 685 |
db_begin_transaction();
nrid = content_put( &wiki, 0, 0 );
db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", nrid);
manifest_crosslink(nrid,&wiki);
blob_reset(&wiki);
content_deltify(rid,nrid,0);
db_end_transaction(0);
| | | 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 |
db_begin_transaction();
nrid = content_put( &wiki, 0, 0 );
db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", nrid);
manifest_crosslink(nrid,&wiki);
blob_reset(&wiki);
content_deltify(rid,nrid,0);
db_end_transaction(0);
autosync(AUTOSYNC_PUSH);
return 1;
}
/*
** COMMAND: wiki
**
** Usage: %fossil wiki (export|create|commit|list) WikiName
|
| ︙ | ︙ | |||
755 756 757 758 759 760 761 |
if( (g.argc!=4) && (g.argc!=5) ){
usage("export PAGENAME ?FILE?");
}
zPageName = g.argv[3];
rid = db_int(0, "SELECT x.rid FROM tag t, tagxref x"
" WHERE x.tagid=t.tagid AND t.tagname='wiki-%q'"
" ORDER BY x.mtime DESC LIMIT 1",
| | | 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 |
if( (g.argc!=4) && (g.argc!=5) ){
usage("export PAGENAME ?FILE?");
}
zPageName = g.argv[3];
rid = db_int(0, "SELECT x.rid FROM tag t, tagxref x"
" WHERE x.tagid=t.tagid AND t.tagname='wiki-%q'"
" ORDER BY x.mtime DESC LIMIT 1",
zPageName
);
if( rid ){
Blob content;
content_get(rid, &content);
manifest_parse(&m, &content);
if( m.type==CFTYPE_WIKI ){
zBody = m.zWiki;
|
| ︙ | ︙ | |||
819 820 821 822 823 824 825 |
if( g.argc!=5 ){
usage("delete PAGENAME");
}
fossil_fatal("delete not yet implemented.");
}else
if( strncmp(g.argv[2],"list",n)==0 ){
Stmt q;
| | | 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 |
if( g.argc!=5 ){
usage("delete PAGENAME");
}
fossil_fatal("delete not yet implemented.");
}else
if( strncmp(g.argv[2],"list",n)==0 ){
Stmt q;
db_prepare(&q,
"SELECT substr(tagname, 6) FROM tag WHERE tagname GLOB 'wiki-*'"
" ORDER BY lower(tagname)"
);
while( db_step(&q)==SQLITE_ROW ){
const char *zName = db_column_text(&q, 0);
printf( "%s\n",zName);
}
|
| ︙ | ︙ |
Changes to src/wikiformat.c.
1 2 3 4 5 6 7 8 9 10 11 | /* ** Copyright (c) 2007 D. Richard Hipp ** ** This program is free software; you can redistribute it and/or ** modify it under the terms of the GNU General Public ** License version 2 as published by the Free Software Foundation. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | /* ** Copyright (c) 2007 D. Richard Hipp ** ** This program is free software; you can redistribute it and/or ** modify it under the terms of the GNU General Public ** License version 2 as published by the Free Software Foundation. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** You should have received a copy of the GNU General Public ** License along with this library; if not, write to the ** Free Software Foundation, Inc., 59 Temple Place - Suite 330, ** Boston, MA 02111-1307, USA. ** ** Author contact information: ** drh@hwaci.com |
| ︙ | ︙ | |||
148 149 150 151 152 153 154 | /* ** Allowed markup. ** ** Except for MARKUP_INVALID, this must all be in alphabetical order ** and in numerical sequence. The first markup type must be zero. | | | 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 | /* ** Allowed markup. ** ** Except for MARKUP_INVALID, this must all be in alphabetical order ** and in numerical sequence. The first markup type must be zero. ** The value for MARKUP_XYZ must correspond to the <xyz> entry ** in aAllowedMarkup[]. */ #define MARKUP_INVALID 0 #define MARKUP_A 1 #define MARKUP_ADDRESS 2 #define MARKUP_B 3 #define MARKUP_BIG 4 |
| ︙ | ︙ | |||
256 257 258 259 260 261 262 |
AMSK_COLOR|AMSK_FACE|AMSK_SIZE },
{ "h1", MARKUP_H1, MUTYPE_BLOCK, AMSK_ALIGN },
{ "h2", MARKUP_H2, MUTYPE_BLOCK, AMSK_ALIGN },
{ "h3", MARKUP_H3, MUTYPE_BLOCK, AMSK_ALIGN },
{ "h4", MARKUP_H4, MUTYPE_BLOCK, AMSK_ALIGN },
{ "h5", MARKUP_H5, MUTYPE_BLOCK, AMSK_ALIGN },
{ "h6", MARKUP_H6, MUTYPE_BLOCK, AMSK_ALIGN },
| | | | | | | | | | 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 |
AMSK_COLOR|AMSK_FACE|AMSK_SIZE },
{ "h1", MARKUP_H1, MUTYPE_BLOCK, AMSK_ALIGN },
{ "h2", MARKUP_H2, MUTYPE_BLOCK, AMSK_ALIGN },
{ "h3", MARKUP_H3, MUTYPE_BLOCK, AMSK_ALIGN },
{ "h4", MARKUP_H4, MUTYPE_BLOCK, AMSK_ALIGN },
{ "h5", MARKUP_H5, MUTYPE_BLOCK, AMSK_ALIGN },
{ "h6", MARKUP_H6, MUTYPE_BLOCK, AMSK_ALIGN },
{ "hr", MARKUP_HR, MUTYPE_SINGLE,
AMSK_ALIGN|AMSK_COLOR|AMSK_SIZE|AMSK_WIDTH },
{ "i", MARKUP_I, MUTYPE_FONT, 0 },
{ "img", MARKUP_IMG, MUTYPE_SINGLE,
AMSK_ALIGN|AMSK_ALT|AMSK_BORDER|AMSK_HEIGHT|
AMSK_HSPACE|AMSK_SRC|AMSK_VSPACE|AMSK_WIDTH },
{ "kbd", MARKUP_KBD, MUTYPE_FONT, 0 },
{ "li", MARKUP_LI, MUTYPE_LI,
AMSK_TYPE|AMSK_VALUE },
{ "nobr", MARKUP_NOBR, MUTYPE_FONT, 0 },
{ "nowiki", MARKUP_NOWIKI, MUTYPE_SPECIAL, 0 },
{ "ol", MARKUP_OL, MUTYPE_LIST,
AMSK_START|AMSK_TYPE|AMSK_COMPACT },
{ "p", MARKUP_P, MUTYPE_BLOCK, AMSK_ALIGN },
{ "pre", MARKUP_PRE, MUTYPE_BLOCK, 0 },
{ "s", MARKUP_S, MUTYPE_FONT, 0 },
{ "samp", MARKUP_SAMP, MUTYPE_FONT, 0 },
{ "small", MARKUP_SMALL, MUTYPE_FONT, 0 },
{ "strike", MARKUP_STRIKE, MUTYPE_FONT, 0 },
{ "strong", MARKUP_STRONG, MUTYPE_FONT, 0 },
{ "sub", MARKUP_SUB, MUTYPE_FONT, 0 },
{ "sup", MARKUP_SUP, MUTYPE_FONT, 0 },
{ "table", MARKUP_TABLE, MUTYPE_TABLE,
AMSK_ALIGN|AMSK_BGCOLOR|AMSK_BORDER|AMSK_CELLPADDING|
AMSK_CELLSPACING|AMSK_HSPACE|AMSK_VSPACE },
{ "td", MARKUP_TD, MUTYPE_TD,
AMSK_ALIGN|AMSK_BGCOLOR|AMSK_COLSPAN|
AMSK_ROWSPAN|AMSK_VALIGN },
{ "th", MARKUP_TH, MUTYPE_TD,
AMSK_ALIGN|AMSK_BGCOLOR|AMSK_COLSPAN|
AMSK_ROWSPAN|AMSK_VALIGN },
{ "tr", MARKUP_TR, MUTYPE_TR,
AMSK_ALIGN|AMSK_BGCOLOR||AMSK_VALIGN },
{ "tt", MARKUP_TT, MUTYPE_FONT, 0 },
{ "u", MARKUP_U, MUTYPE_FONT, 0 },
{ "ul", MARKUP_UL, MUTYPE_LIST,
AMSK_TYPE|AMSK_COMPACT },
{ "var", MARKUP_VAR, MUTYPE_FONT, 0 },
{ "verbatim", MARKUP_VERBATIM, MUTYPE_SPECIAL, AMSK_ID },
};
/*
** Use binary search to locate a tag in the aMarkup[] table.
|
| ︙ | ︙ | |||
345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 |
#define FONT_MARKUP_ONLY 0x008 /* Only allow MUTYPE_FONT markup */
#define INLINE_MARKUP_ONLY 0x010 /* Allow only "inline" markup */
#define IN_LIST 0x020 /* Within wiki <ul> or <ol> */
/*
** Current state of the rendering engine
*/
typedef struct Renderer Renderer;
struct Renderer {
Blob *pOut; /* Output appended to this blob */
int state; /* Flag that govern rendering */
int wikiList; /* Current wiki list type */
int inVerbatim; /* True in <verbatim> mode */
int preVerbState; /* Value of state prior to verbatim */
int wantAutoParagraph; /* True if a <p> is desired */
int inAutoParagraph; /* True if within an automatic paragraph */
const char *zVerbatimId; /* The id= attribute of <verbatim> */
int nStack; /* Number of elements on the stack */
int nAlloc; /* Space allocated for aStack */
struct sStack {
short iCode; /* Markup code */
short allowWiki; /* ALLOW_WIKI if wiki allowed before tag */
const char *zId; /* ID attribute or NULL */
} *aStack;
};
| > | | 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 |
#define FONT_MARKUP_ONLY 0x008 /* Only allow MUTYPE_FONT markup */
#define INLINE_MARKUP_ONLY 0x010 /* Allow only "inline" markup */
#define IN_LIST 0x020 /* Within wiki <ul> or <ol> */
/*
** Current state of the rendering engine
*/
#if INTERFACE
typedef struct Renderer Renderer;
struct Renderer {
Blob *pOut; /* Output appended to this blob */
int state; /* Flag that govern rendering */
int wikiList; /* Current wiki list type */
int inVerbatim; /* True in <verbatim> mode */
int preVerbState; /* Value of state prior to verbatim */
int wantAutoParagraph; /* True if a <p> is desired */
int inAutoParagraph; /* True if within an automatic paragraph */
const char *zVerbatimId; /* The id= attribute of <verbatim> */
int nStack; /* Number of elements on the stack */
int nAlloc; /* Space allocated for aStack */
struct sStack {
short iCode; /* Markup code */
short allowWiki; /* ALLOW_WIKI if wiki allowed before tag */
const char *zId; /* ID attribute or NULL */
} *aStack;
};
#endif
/*
** z points to a "<" character. Check to see if this is the start of
** a valid markup. If it is, return the total number of characters in
** the markup including the initial "<" and the terminating ">". If
** it is not well-formed markup, return 0.
*/
|
| ︙ | ︙ | |||
431 432 433 434 435 436 437 |
int n = 0;
int c;
while( (c = z[0])!=0 && c!='<' && c!='&' &&
(useWiki==0 || (c!='[' && c!='\n')) ){
n++;
z++;
}
| | | 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 |
int n = 0;
int c;
while( (c = z[0])!=0 && c!='<' && c!='&' &&
(useWiki==0 || (c!='[' && c!='\n')) ){
n++;
z++;
}
return n;
}
/*
** Return true if z[] begins with an HTML character element.
*/
static int isElement(const char *z){
int i;
|
| ︙ | ︙ | |||
624 625 626 627 628 629 630 | } aAttr[10]; }; /* ** z[] is an HTML markup element - something that begins with '<'. ** Parse this element into the p structure. ** | | | | | 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 |
} aAttr[10];
};
/*
** z[] is an HTML markup element - something that begins with '<'.
** Parse this element into the p structure.
**
** The content of z[] might be modified by converting characters
** to lowercase and by inserting some "\000" characters.
*/
static void parseMarkup(ParsedMarkup *p, char *z){
int i, j, c;
int iACode;
char *zValue;
int seen = 0;
char zTag[100];
if( z[1]=='/' ){
p->endTag = 1;
i = 2;
}else{
p->endTag = 0;
i = 1;
}
j = 0;
while( isalnum(z[i]) ){
if( j<sizeof(zTag)-1 ) zTag[j++] = tolower(z[i]);
i++;
}
zTag[j] = 0;
p->iCode = findTag(zTag);
p->iType = aMarkup[p->iCode].iType;
p->nAttr = 0;
while( isspace(z[i]) ){ i++; }
while( p->nAttr<8 && isalpha(z[i]) ){
int attrOk; /* True to preserver attribute. False to ignore it */
j = 0;
while( isalnum(z[i]) ){
if( j<sizeof(zTag)-1 ) zTag[j++] = tolower(z[i]);
i++;
}
zTag[j] = 0;
p->aAttr[p->nAttr].iACode = iACode = findAttr(zTag);
attrOk = iACode!=0 && (seen & aAttribute[iACode].iMask)==0;
while( isspace(z[i]) ){ z++; }
|
| ︙ | ︙ | |||
797 798 799 800 801 802 803 |
while( p->nStack>i ){
popStack(p);
}
}
/*
** Attempt to find a find a tag of type iTag with id zId. Return -1
| | | 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 |
while( p->nStack>i ){
popStack(p);
}
}
/*
** Attempt to find a find a tag of type iTag with id zId. Return -1
** if not found. If found, return its stack level.
*/
static int findTagWithId(Renderer *p, int iTag, const char *zId){
int i;
assert( zId!=0 );
for(i=p->nStack-1; i>=0; i--){
if( p->aStack[i].iCode!=iTag ) continue;
if( p->aStack[i].zId==0 ) continue;
|
| ︙ | ︙ | |||
887 888 889 890 891 892 893 |
n = strlen(zTarget);
memcpy(zLower, zTarget, n+1);
canonical16(zLower, n+1);
memcpy(zUpper, zLower, n+1);
zUpper[n-1]++;
if( once ){
const char *zClosedExpr = db_get("ticket-closed-expr", "status='Closed'");
| | | 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 |
n = strlen(zTarget);
memcpy(zLower, zTarget, n+1);
canonical16(zLower, n+1);
memcpy(zUpper, zLower, n+1);
zUpper[n-1]++;
if( once ){
const char *zClosedExpr = db_get("ticket-closed-expr", "status='Closed'");
db_static_prepare(&q,
"SELECT %s FROM ticket "
" WHERE tkt_uuid>=:lwr AND tkt_uuid<:upr",
zClosedExpr
);
once = 0;
}
db_bind_text(&q, ":lwr", zLower);
|
| ︙ | ︙ | |||
925 926 927 928 929 930 931 |
const char *zTarget, /* Hyperlink traget; text within [...] */
char *zClose, /* Write hyperlink closing text here */
int nClose /* Bytes available in zClose[] */
){
const char *zTerm = "</a>";
assert( nClose>10 );
| | | | 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 |
const char *zTarget, /* Hyperlink traget; text within [...] */
char *zClose, /* Write hyperlink closing text here */
int nClose /* Bytes available in zClose[] */
){
const char *zTerm = "</a>";
assert( nClose>10 );
if( strncmp(zTarget, "http:", 5)==0
|| strncmp(zTarget, "https:", 6)==0
|| strncmp(zTarget, "ftp:", 4)==0
|| strncmp(zTarget, "mailto:", 7)==0
){
blob_appendf(p->pOut, "<a href=\"%s\">", zTarget);
}else if( zTarget[0]=='/' ){
if( 1 /* g.okHistory */ ){
blob_appendf(p->pOut, "<a href=\"%s%h\">", g.zBaseURL, zTarget);
}else{
|
| ︙ | ︙ | |||
1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 |
/*
** Return the MUTYPE for the top of the stack.
*/
static int stackTopType(Renderer *p){
if( p->nStack<=0 ) return 0;
return aMarkup[p->aStack[p->nStack-1].iCode].iType;
}
/*
** Convert the wiki in z[] into html in the renderer p. The
** renderer has already been initialized.
**
** This routine will probably modify the content of z[].
*/
static void wiki_render(Renderer *p, char *z){
int tokenType;
ParsedMarkup markup;
int n;
int inlineOnly = (p->state & INLINE_MARKUP_ONLY)!=0;
while( z[0] ){
n = nextToken(z, p, &tokenType);
p->state &= ~(AT_NEWLINE|AT_PARAGRAPH);
switch( tokenType ){
case TOKEN_PARAGRAPH: {
if( inlineOnly ){
/* blob_append(p->pOut, " ¶ ", -1); */
blob_append(p->pOut, " ", -1);
}else{
if( p->wikiList ){
popStackToTag(p, p->wikiList);
| > > > > > > > > > > > > > > | 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 |
/*
** Return the MUTYPE for the top of the stack.
*/
static int stackTopType(Renderer *p){
if( p->nStack<=0 ) return 0;
return aMarkup[p->aStack[p->nStack-1].iCode].iType;
}
/*
** Convert the wiki in z[] into html in the renderer p. The
** renderer has already been initialized.
**
** This routine will probably modify the content of z[].
*/
static void wiki_render(Renderer *p, char *z){
int tokenType;
ParsedMarkup markup;
int n;
int inlineOnly = (p->state & INLINE_MARKUP_ONLY)!=0;
while( z[0] ){
/*
** Additions to support creole parser
*/
if (!p->inVerbatim && z[0]=='<' && z[1] == '<') {
z = wiki_render_macro(p, z, &tokenType);
if (tokenType) continue;
}
//
n = nextToken(z, p, &tokenType);
p->state &= ~(AT_NEWLINE|AT_PARAGRAPH);
switch( tokenType ){
case TOKEN_PARAGRAPH: {
if( inlineOnly ){
/* blob_append(p->pOut, " ¶ ", -1); */
blob_append(p->pOut, " ", -1);
}else{
if( p->wikiList ){
popStackToTag(p, p->wikiList);
|
| ︙ | ︙ | |||
1141 1142 1143 1144 1145 1146 1147 |
case TOKEN_MARKUP: {
const char *zId;
int iDiv;
parseMarkup(&markup, z);
/* Markup of the form </div id=ID> where there is a matching
** ID somewhere on the stack. Exit the verbatim if were are in
| | | 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 |
case TOKEN_MARKUP: {
const char *zId;
int iDiv;
parseMarkup(&markup, z);
/* Markup of the form </div id=ID> where there is a matching
** ID somewhere on the stack. Exit the verbatim if were are in
** it. Pop the stack up to the matching <div>. Discard the
** </div>
*/
if( markup.iCode==MARKUP_DIV && markup.endTag &&
(zId = markupId(&markup))!=0 &&
(iDiv = findTagWithId(p, MARKUP_DIV, zId))>=0
){
if( p->inVerbatim ){
|
| ︙ | ︙ | |||
1165 1166 1167 1168 1169 1170 1171 |
}
assert( p->nStack==iDiv+1 );
p->nStack--;
}else
/* If within <verbatim id=ID> ignore everything other than
** </verbatim id=ID> and the </dev id=ID2> above.
| | | 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 |
}
assert( p->nStack==iDiv+1 );
p->nStack--;
}else
/* If within <verbatim id=ID> ignore everything other than
** </verbatim id=ID> and the </dev id=ID2> above.
*/
if( p->inVerbatim ){
if( endVerbatim(p, &markup) ){
p->inVerbatim = 0;
p->state = p->preVerbState;
blob_append(p->pOut, "</pre>", 6);
}else{
unparseMarkup(&markup);
|
| ︙ | ︙ | |||
1223 1224 1225 1226 1227 1228 1229 |
if( markup.iCode==MARKUP_DIV ){
pushStackWithId(p, markup.iCode, markupId(&markup),
(p->state & ALLOW_WIKI)!=0);
}else
/* Enter <verbatim> processing. With verbatim enabled, all other
** markup other than the corresponding end-tag with the same ID is
| | | 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 |
if( markup.iCode==MARKUP_DIV ){
pushStackWithId(p, markup.iCode, markupId(&markup),
(p->state & ALLOW_WIKI)!=0);
}else
/* Enter <verbatim> processing. With verbatim enabled, all other
** markup other than the corresponding end-tag with the same ID is
** ignored.
*/
if( markup.iCode==MARKUP_VERBATIM ){
if( markup.nAttr==1 ){
p->zVerbatimId = markup.aAttr[0].zValue;
}else{
p->zVerbatimId = 0;
}
|
| ︙ | ︙ | |||
1296 1297 1298 1299 1300 1301 1302 |
** initialized. The output is merely appended to pOut.
** If pOut is NULL, then the output is appended to the CGI
** reply.
*/
void wiki_convert(Blob *pIn, Blob *pOut, int flags){
char *z;
Renderer renderer;
| | | 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 |
** initialized. The output is merely appended to pOut.
** If pOut is NULL, then the output is appended to the CGI
** reply.
*/
void wiki_convert(Blob *pIn, Blob *pOut, int flags){
char *z;
Renderer renderer;
memset(&renderer, 0, sizeof(renderer));
renderer.state = ALLOW_WIKI|AT_NEWLINE|AT_PARAGRAPH;
if( flags & WIKI_NOBLOCK ){
renderer.state |= INLINE_MARKUP_ONLY;
}
if( flags & WIKI_INLINE ){
renderer.wantAutoParagraph = 0;
|
| ︙ | ︙ | |||
1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 |
endAutoParagraph(&renderer);
while( renderer.nStack ){
popStack(&renderer);
}
blob_append(renderer.pOut, "\n", 1);
free(renderer.aStack);
}
/*
** COMMAND: test-wiki-render
*/
void test_wiki_render(void){
Blob in, out;
if( g.argc!=3 ) usage("FILE");
blob_zero(&out);
blob_read_from_file(&in, g.argv[2]);
wiki_convert(&in, &out, 0);
blob_write_to_file(&out, "-");
}
| > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 |
endAutoParagraph(&renderer);
while( renderer.nStack ){
popStack(&renderer);
}
blob_append(renderer.pOut, "\n", 1);
free(renderer.aStack);
}
/*
** COMMAND: test-wiki-render
*/
void test_wiki_render(void){
Blob in, out;
if( g.argc!=3 ) usage("FILE");
blob_zero(&out);
blob_read_from_file(&in, g.argv[2]);
wiki_convert(&in, &out, 0);
blob_write_to_file(&out, "-");
}
/*
** Additions to support creole parser
*/
#ifndef HAVE_MACRO_EXTENSIONS
char *wiki_render_macro(Renderer *p, char *z, int *tokenType) {
*tokenType = 0;
return z;
}
#endif
int wf_linkLength(const char *z){
return linkLength(z);
}
void wf_openHyperlink(
Renderer *p, /* Rendering context */
const char *zTarget, /* Hyperlink traget; text within [...] */
char *zClose, /* Write hyperlink closing text here */
int nClose /* Bytes available in zClose[] */
){
return openHyperlink(p, zTarget, zClose, nClose);
}
|
src/winhttp.c became executable.
| ︙ | ︙ |
src/xfer.c became executable.
| ︙ | ︙ |
src/zip.c became executable.
| ︙ | ︙ |