Overview
SHA1 Hash: | 47cc9dfec89c25da28bfa9ee9cfe749e31c6f04c |
---|---|
Date: | 2009-04-27 08:43:38 |
User: | robert |
Edited Comment: | Experimental - Pass < !-- --> comments through the wiki unchanged unless inside a < verbatim > block in which case it is htmlized. Also pass < span > tags, treating them as font markup. These changes make it easier to convert existing html pages and specifically allow the inclusion of license text in pages derived from copyright material. |
Original Comment: | Experimental - Pass < !-- --> comments through the wiki unchanged unless inside a < verbatim > block in which case it is htmlized. Also pass <span> tags, treating them as font markup. These changes make it easier to convert existing html pages and specifically allow the inclusion of license text in pages derived from copyright material. |
Timelines: | ancestors | descendants | both | robert-exp | pass-comments |
Other Links: | files | ZIP archive | manifest |
Tags And Properties
- bgcolor=#c0fff0 added by [ac6c7856a7] on 2009-04-27 08:47:18
- branch=robert-exp propagates to descendants
- comment=Experimental - Pass < !-- --> comments through the wiki unchanged unless inside a < verbatim > block in which case it is htmlized. Also pass < span > tags, treating them as font markup. These changes make it easier to convert existing html pages and specifically allow the inclusion of license text in pages derived from copyright material. added by [ac6c7856a7] on 2009-04-27 08:47:18
- sym-pass-comments added by [ac6c7856a7] on 2009-04-27 08:47:18
- sym-robert-exp propagates to descendants
-
sym-trunkcancelled
Changes
[hide diffs]Modified src/wikiformat.c from [0350f3f946] to [5b8cc3e643].
@@ -189,23 +189,24 @@ #define MARKUP_P 31 #define MARKUP_PRE 32 #define MARKUP_S 33 #define MARKUP_SAMP 34 #define MARKUP_SMALL 35 -#define MARKUP_STRIKE 36 -#define MARKUP_STRONG 37 -#define MARKUP_SUB 38 -#define MARKUP_SUP 39 -#define MARKUP_TABLE 40 -#define MARKUP_TD 41 -#define MARKUP_TH 42 -#define MARKUP_TR 43 -#define MARKUP_TT 44 -#define MARKUP_U 45 -#define MARKUP_UL 46 -#define MARKUP_VAR 47 -#define MARKUP_VERBATIM 48 +#define MARKUP_SPAN 36 +#define MARKUP_STRIKE 37 +#define MARKUP_STRONG 38 +#define MARKUP_SUB 39 +#define MARKUP_SUP 40 +#define MARKUP_TABLE 41 +#define MARKUP_TD 42 +#define MARKUP_TH 43 +#define MARKUP_TR 44 +#define MARKUP_TT 45 +#define MARKUP_U 46 +#define MARKUP_UL 47 +#define MARKUP_VAR 48 +#define MARKUP_VERBATIM 49 /* ** The various markup is divided into the following types: */ #define MUTYPE_SINGLE 0x0001 /* <img>, <br>, or <hr> */ @@ -276,10 +277,11 @@ { "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 }, + { "span", MARKUP_SPAN, 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, @@ -332,11 +334,12 @@ #define TOKEN_PARAGRAPH 4 /* blank lines */ #define TOKEN_NEWLINE 5 /* A single "\n" */ #define TOKEN_BULLET 6 /* " * " */ #define TOKEN_ENUM 7 /* " \(?\d+[.)]? " */ #define TOKEN_INDENT 8 /* " " */ -#define TOKEN_TEXT 9 /* None of the above */ +#define TOKEN_COMMENT 9 /* <!-- --> */ +#define TOKEN_TEXT 10 /* None of the above */ /* ** State flags */ #define AT_NEWLINE 0x001 /* At start of a line */ @@ -376,10 +379,28 @@ ** it is not well-formed markup, return 0. */ static int markupLength(const char *z){ int n = 1; int inparen = 0; + + // is a comment - if valid return n else return 0 + if( z[n]=='!' ){ + n++; + if (z[n]!='-') return 0; + n++; + if (z[n]!='-') return 0; + n++; + while (z[n]){ + while (z[n] && z[n]!='>') n++; + if (!z[n]) return 0; + n++; + if(n>3 && z[n-3]=='-' && z[n-2]=='-') + return (n>7) ? n : 0; + } + return 0; + } + if( z[n]=='/' ){ n++; } if( !isalpha(z[n]) ) return 0; while( isalnum(z[n]) ){ n++; } if( z[n]!='>' && !isspace(z[n]) ) return 0; while( z[n] && (z[n]!='>' || inparen) ){ @@ -554,13 +575,19 @@ */ static int nextToken(const char *z, Renderer *p, int *pTokenType){ int n; if( z[0]=='<' ){ n = markupLength(z); - if( n>0 ){ - *pTokenType = TOKEN_MARKUP; - return n; + + if( n>1 ){ + if (z[1]=='!'){ + *pTokenType = TOKEN_COMMENT; + return n; + } else { + *pTokenType = TOKEN_MARKUP; + return n; + } }else{ *pTokenType = TOKEN_CHARACTER; return 1; } } @@ -1022,10 +1049,19 @@ while( z[0] ){ n = nextToken(z, p, &tokenType); p->state &= ~(AT_NEWLINE|AT_PARAGRAPH); switch( tokenType ){ + + case TOKEN_COMMENT: { + if (p->inVerbatim){ + blob_append(p->pOut, htmlize(z, n), -1); + } else { + blob_append(p->pOut, z, n); + } + break; + } case TOKEN_PARAGRAPH: { if( inlineOnly ){ /* blob_append(p->pOut, " ¶ ", -1); */ blob_append(p->pOut, " ", -1); }else{