Diff
Not logged in

Differences From:

File src/wikiformat.c part of check-in [421a1e1fa4] - Fix the hyperlink to wiki so that it uses a query parameter for the wiki page name. by drh on 2007-10-27 13:52:17. [view]

To:

File src/wikiformat.c part of check-in [e75f9a2ab4] - Fixes to the rendering of <verbatim> and <nowiki> by drh on 2007-10-28 21:09:32. [view]

@@ -513,9 +513,9 @@
 /*
 ** z points to the start of a token.  Return the number of
 ** characters in that token.  Write the token type into *pTokenType.
 */
-static int nextToken(const char *z, int state, int *pTokenType){
+static int nextToken(const char *z, Renderer *p, int *pTokenType){
   int n;
   if( z[0]=='<' ){
     n = markupLength(z);
     if( n>0 ){
@@ -525,13 +525,13 @@
       *pTokenType = TOKEN_CHARACTER;
       return 1;
     }
   }
-  if( z[0]=='&' && !isElement(z) ){
+  if( z[0]=='&' && (p->inVerbatim || !isElement(z)) ){
     *pTokenType = TOKEN_CHARACTER;
     return 1;
   }
-  if( (state & ALLOW_WIKI)!=0 ){
+  if( (p->state & ALLOW_WIKI)!=0 ){
     if( z[0]=='\n' ){
       n = paragraphBreakLength(z);
       if( n>0 ){
         *pTokenType = TOKEN_PARAGRAPH;
@@ -540,10 +540,9 @@
         *pTokenType = TOKEN_NEWLINE;
         return 1;
       }
     }
-    if( (state & AT_NEWLINE)!=0 /* && (state & (AT_PARAGRAPH|IN_LIST))!=0 */
-             && isspace(z[0]) ){
+    if( (p->state & AT_NEWLINE)!=0 && isspace(z[0]) ){
       n = bulletLength(z);
       if( n>0 ){
         *pTokenType = TOKEN_BULLET;
         return n;
@@ -553,9 +552,9 @@
         *pTokenType = TOKEN_ENUM;
         return n;
       }
     }
-    if( (state & AT_PARAGRAPH)!=0 && isspace(z[0]) ){
+    if( (p->state & AT_PARAGRAPH)!=0 && isspace(z[0]) ){
       n = indentLength(z);
       if( n>0 ){
         *pTokenType = TOKEN_INDENT;
         return n;
@@ -566,9 +565,9 @@
       return n;
     }
   }
   *pTokenType = TOKEN_TEXT;
-  return 1 + textLength(z+1, state & ALLOW_WIKI);
+  return 1 + textLength(z+1, p->state & ALLOW_WIKI);
 }
 
 /*
 ** A single markup is parsed into an instance of the following
@@ -825,9 +824,9 @@
   ParsedMarkup markup;
   int n;
 
   while( z[0] ){
-    n = nextToken(z, p->state, &tokenType);
+    n = nextToken(z, p, &tokenType);
     p->state &= ~(AT_NEWLINE|AT_PARAGRAPH);
     switch( tokenType ){
       case TOKEN_PARAGRAPH: {
         if( p->wikiList ){
@@ -951,9 +950,9 @@
         }else if( markup.iCode==MARKUP_NOWIKI ){
           if( markup.endTag ){
             p->state |= ALLOW_WIKI;
           }else{
-            p->state &= ALLOW_WIKI;
+            p->state &= ~ALLOW_WIKI;
           }
         }else if( markup.endTag ){
           popStackToTag(p, markup.iCode);
         }else if( markup.iCode==MARKUP_VERBATIM ){