Differences From:
File
src/wikiformat.c
part of check-in
[7a2c37063a]
- merge trunk into creole branch
by
bob on
2009-09-22 07:49:39.
[view]
To:
File
src/wikiformat.c
part of check-in
[7a39dde24b]
- Clean up and merge updates from trunk
by
robert on
2009-09-26 08:17:33.
[view]
@@ -1023,9 +1023,8 @@
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.
**
@@ -1039,22 +1038,20 @@
while( z[0] ){
/*
- ** Additions to support creole parser
+ ** Additions to support macro extensions
*/
if (!p->inVerbatim && z[0]=='<' && z[1] == '<') {
z = wiki_render_macro(p, z, &tokenType);
if (tokenType) continue;
}
- //
+ /* end additions */
n = nextToken(z, p, &tokenType);
p->state &= ~(AT_NEWLINE|AT_PARAGRAPH);
-
- switch( tokenType ){
-
+ switch( tokenType ){
case TOKEN_PARAGRAPH: {
if( inlineOnly ){
/* blob_append(p->pOut, " ¶ ", -1); */
blob_append(p->pOut, " ", -1);
@@ -1228,20 +1225,20 @@
if( (markup.iType&MUTYPE_FONT)==0 && (p->state & FONT_MARKUP_ONLY)!=0 ){
/* Do nothing */
}else
- /* Ignore block markup for in-line rendering.
- */
- if( inlineOnly && (markup.iType&MUTYPE_INLINE)==0 ){
- /* Do nothing */
- }else
-
if( markup.iCode==MARKUP_NOWIKI ){
if( markup.endTag ){
p->state |= ALLOW_WIKI;
}else{
p->state &= ~ALLOW_WIKI;
}
+ }else
+
+ /* Ignore block markup for in-line rendering.
+ */
+ if( inlineOnly && (markup.iType&MUTYPE_INLINE)==0 ){
+ /* Do nothing */
}else
/* Generate end-tags */
if( markup.endTag ){
@@ -1356,9 +1353,8 @@
blob_append(renderer.pOut, "\n", 1);
free(renderer.aStack);
}
-
/*
** COMMAND: test-wiki-render
*/
void test_wiki_render(void){
@@ -1395,19 +1391,33 @@
blob_init(pTail, &z[i+8], -1);
return 1;
}
-
/*
-** Additions to support creole parser
+** Additions to support macro extensions
+**
+** This only allows block level macros, not inline macros
+**
+** All macros must recognize '<<fossil>>' in the input
+** stream and return control to fossil.
*/
-#ifndef HAVE_MACRO_EXTENSIONS
-char *wiki_render_macro(Renderer *p, char *z, int *tokenType) {
+char *wiki_render_macro(Renderer *p, char *z, int *tokenType){
+ if (!memcmp(z, "<<fossil>>", 10)){
+ *tokenType = 1;
+ return z + 10;
+ }
+
+#ifdef HAVE_CREOLE_MACRO
+ if (!memcmp(z, "<<creole>>", 10)) {
+ *tokenType = 1;
+ return wiki_render_creole(p, z+10);
+ }
+#endif
+
*tokenType = 0;
return z;
}
-#endif
int wf_linkLength(const char *z){
return linkLength(z);
}
@@ -1418,6 +1428,5 @@
int nClose /* Bytes available in zClose[] */
){
return openHyperlink(p, zTarget, zClose, nClose);
}
-
-
+/* end additions */