Check-in [e75f9a2ab4]
Not logged in
Overview

SHA1 Hash:e75f9a2ab45aa3b47bb0ac6043bd42118d77f9ea
Date: 2007-10-28 21:09:32
User: drh
Comment:Fixes to the rendering of <verbatim> and <nowiki>
Timelines: ancestors | descendants | both | trunk
Other Links: files | ZIP archive | manifest

Tags And Properties
Changes
[hide diffs]

Modified src/wikiformat.c from [418172709f] to [99707514c5].

@@ -512,11 +512,11 @@
 
 /*
 ** 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 ){
       *pTokenType = TOKEN_MARKUP;
@@ -524,15 +524,15 @@
     }else{
       *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;
         return n;
@@ -539,12 +539,11 @@
       }else if( isspace(z[1]) ){
         *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;
       }
@@ -552,11 +551,11 @@
       if( n>0 ){
         *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;
       }
@@ -565,11 +564,11 @@
       *pTokenType = TOKEN_LINK;
       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
 ** structure.
@@ -824,11 +823,11 @@
   int tokenType;
   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 ){
           popStackToTag(p, p->wikiList);
@@ -950,11 +949,11 @@
           /* Do nothing */
         }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 ){
           if( markup.nAttr==1 ){