Check-in [ecd1f09632]
Not logged in
Overview

SHA1 Hash:ecd1f0963263516b1d7983fdbdcfc9b0b157ec30
Date: 2009-05-08 09:52:38
User: robert
Comment:Initial commit of Creole Wiki Parser extension.
Timelines: ancestors | descendants | both | creole
Other Links: files | ZIP archive | manifest

Tags And Properties
Changes
[hide diffs]

Modified src/main.mk from [9bd0c8cb97] to [6c3a053810].

@@ -27,10 +27,11 @@
   $(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 \
@@ -97,10 +98,11 @@
   clone_.c \
   comformat_.c \
   configure_.c \
   construct_.c \
   content_.c \
+  creoleparser_.c \
   db_.c \
   delta_.c \
   deltacmd_.c \
   descendants_.c \
   diff_.c \
@@ -167,10 +169,11 @@
   clone.o \
   comformat.o \
   configure.o \
   construct.o \
   content.o \
+  creoleparser.o \
   db.o \
   delta.o \
   deltacmd.o \
   descendants.o \
   diff.o \
@@ -261,16 +264,16 @@
 	# 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 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
+	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 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
+	./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
@@ -382,10 +385,17 @@
 
 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

Modified src/makemake.tcl from [263645557b] to [f6bd7d70e3].

@@ -21,10 +21,11 @@
   clone
   comformat
   configure
   construct
   content
+  creoleparser
   db
   delta
   deltacmd
   descendants
   diff

Modified src/wiki.c from [ad80e67405] to [2ebc00b129].

@@ -333,19 +333,20 @@
   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</div id=\"%s\">", zRemark, zId);
+  blob_appendf(p, " added:</i><br />\n%s\n<<fossil>>\n</div id=\"%s\">", zRemark, zId);
 }
 
 /*
 ** WEBPAGE: wikiappend
 ** URL: /wikiappend?name=PAGENAME

Modified src/wikiformat.c from [0350f3f946] to [7abff38b1d].

@@ -347,10 +347,11 @@
 #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 */
@@ -365,11 +366,11 @@
     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
@@ -1006,10 +1007,11 @@
 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[].
@@ -1019,13 +1021,26 @@
   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, " &para; ", -1); */
           blob_append(p->pOut, " &nbsp;&nbsp; ", -1);
         }else{
@@ -1325,10 +1340,11 @@
   }
   blob_append(renderer.pOut, "\n", 1);
   free(renderer.aStack);
 }
 
+
 /*
 ** COMMAND: test-wiki-render
 */
 void test_wiki_render(void){
   Blob in, out;
@@ -1336,5 +1352,31 @@
   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);
+}
+
+