Fossil SCM
Simple changes that allows embedded documentation *.wiki files to contain unrestricted HTML. This is on a branch because I don't believe we want to go this way, but I might change my mind later.
Commit
463df97c06e408b2224fea53f8e902da9067699e
Parent
2116906fb1b1ae0…
2 files changed
+2
-2
+6
-1
+2
-2
| --- src/doc.c | ||
| +++ src/doc.c | ||
| @@ -489,14 +489,14 @@ | ||
| 489 | 489 | " WHERE objid=%d AND type='ci'", vid)); |
| 490 | 490 | if( fossil_strcmp(zMime, "application/x-fossil-wiki")==0 ){ |
| 491 | 491 | Blob title, tail; |
| 492 | 492 | if( wiki_find_title(&filebody, &title, &tail) ){ |
| 493 | 493 | style_header(blob_str(&title)); |
| 494 | - wiki_convert(&tail, 0, 0); | |
| 494 | + wiki_convert(&tail, 0, WIKI_FULL_HTML); | |
| 495 | 495 | }else{ |
| 496 | 496 | style_header("Documentation"); |
| 497 | - wiki_convert(&filebody, 0, 0); | |
| 497 | + wiki_convert(&filebody, 0, WIKI_FULL_HTML); | |
| 498 | 498 | } |
| 499 | 499 | style_footer(); |
| 500 | 500 | }else if( fossil_strcmp(zMime, "text/plain")==0 ){ |
| 501 | 501 | style_header("Documentation"); |
| 502 | 502 | @ <blockquote><pre> |
| 503 | 503 |
| --- src/doc.c | |
| +++ src/doc.c | |
| @@ -489,14 +489,14 @@ | |
| 489 | " WHERE objid=%d AND type='ci'", vid)); |
| 490 | if( fossil_strcmp(zMime, "application/x-fossil-wiki")==0 ){ |
| 491 | Blob title, tail; |
| 492 | if( wiki_find_title(&filebody, &title, &tail) ){ |
| 493 | style_header(blob_str(&title)); |
| 494 | wiki_convert(&tail, 0, 0); |
| 495 | }else{ |
| 496 | style_header("Documentation"); |
| 497 | wiki_convert(&filebody, 0, 0); |
| 498 | } |
| 499 | style_footer(); |
| 500 | }else if( fossil_strcmp(zMime, "text/plain")==0 ){ |
| 501 | style_header("Documentation"); |
| 502 | @ <blockquote><pre> |
| 503 |
| --- src/doc.c | |
| +++ src/doc.c | |
| @@ -489,14 +489,14 @@ | |
| 489 | " WHERE objid=%d AND type='ci'", vid)); |
| 490 | if( fossil_strcmp(zMime, "application/x-fossil-wiki")==0 ){ |
| 491 | Blob title, tail; |
| 492 | if( wiki_find_title(&filebody, &title, &tail) ){ |
| 493 | style_header(blob_str(&title)); |
| 494 | wiki_convert(&tail, 0, WIKI_FULL_HTML); |
| 495 | }else{ |
| 496 | style_header("Documentation"); |
| 497 | wiki_convert(&filebody, 0, WIKI_FULL_HTML); |
| 498 | } |
| 499 | style_footer(); |
| 500 | }else if( fossil_strcmp(zMime, "text/plain")==0 ){ |
| 501 | style_header("Documentation"); |
| 502 | @ <blockquote><pre> |
| 503 |
+6
-1
| --- src/wikiformat.c | ||
| +++ src/wikiformat.c | ||
| @@ -24,11 +24,11 @@ | ||
| 24 | 24 | #if INTERFACE |
| 25 | 25 | /* |
| 26 | 26 | ** Allowed wiki transformation operations |
| 27 | 27 | */ |
| 28 | 28 | #define WIKI_NOFOLLOW 0x001 |
| 29 | -#define WIKI_HTML 0x002 | |
| 29 | +#define WIKI_FULL_HTML 0x002 /* Allow unrestricted HTML */ | |
| 30 | 30 | #define WIKI_INLINE 0x004 /* Do not surround with <p>..</p> */ |
| 31 | 31 | #define WIKI_NOBLOCK 0x008 /* No block markup of any kind */ |
| 32 | 32 | #endif |
| 33 | 33 | |
| 34 | 34 | |
| @@ -1159,10 +1159,11 @@ | ||
| 1159 | 1159 | int tokenType; |
| 1160 | 1160 | ParsedMarkup markup; |
| 1161 | 1161 | int n; |
| 1162 | 1162 | int inlineOnly = (p->state & INLINE_MARKUP_ONLY)!=0; |
| 1163 | 1163 | int wikiUseHtml = (p->state & WIKI_USE_HTML)!=0; |
| 1164 | + int fullHtml = (p->state & WIKI_FULL_HTML)!=0; | |
| 1164 | 1165 | char *zOrig = z; |
| 1165 | 1166 | |
| 1166 | 1167 | /* Make sure the attribute constants and names still align |
| 1167 | 1168 | ** following changes in the attribute list. */ |
| 1168 | 1169 | assert( fossil_strcmp(aAttribute[ATTR_WIDTH].zName, "width")==0 ); |
| @@ -1318,10 +1319,14 @@ | ||
| 1318 | 1319 | break; |
| 1319 | 1320 | } |
| 1320 | 1321 | case TOKEN_MARKUP: { |
| 1321 | 1322 | const char *zId; |
| 1322 | 1323 | int iDiv; |
| 1324 | + if( fullHtml ){ | |
| 1325 | + blob_append(p->pOut, z, n); | |
| 1326 | + break; | |
| 1327 | + } | |
| 1323 | 1328 | parseMarkup(&markup, z); |
| 1324 | 1329 | |
| 1325 | 1330 | /* Markup of the form </div id=ID> where there is a matching |
| 1326 | 1331 | ** ID somewhere on the stack. Exit the verbatim if were are in |
| 1327 | 1332 | ** it. Pop the stack up to the matching <div>. Discard the |
| 1328 | 1333 |
| --- src/wikiformat.c | |
| +++ src/wikiformat.c | |
| @@ -24,11 +24,11 @@ | |
| 24 | #if INTERFACE |
| 25 | /* |
| 26 | ** Allowed wiki transformation operations |
| 27 | */ |
| 28 | #define WIKI_NOFOLLOW 0x001 |
| 29 | #define WIKI_HTML 0x002 |
| 30 | #define WIKI_INLINE 0x004 /* Do not surround with <p>..</p> */ |
| 31 | #define WIKI_NOBLOCK 0x008 /* No block markup of any kind */ |
| 32 | #endif |
| 33 | |
| 34 | |
| @@ -1159,10 +1159,11 @@ | |
| 1159 | int tokenType; |
| 1160 | ParsedMarkup markup; |
| 1161 | int n; |
| 1162 | int inlineOnly = (p->state & INLINE_MARKUP_ONLY)!=0; |
| 1163 | int wikiUseHtml = (p->state & WIKI_USE_HTML)!=0; |
| 1164 | char *zOrig = z; |
| 1165 | |
| 1166 | /* Make sure the attribute constants and names still align |
| 1167 | ** following changes in the attribute list. */ |
| 1168 | assert( fossil_strcmp(aAttribute[ATTR_WIDTH].zName, "width")==0 ); |
| @@ -1318,10 +1319,14 @@ | |
| 1318 | break; |
| 1319 | } |
| 1320 | case TOKEN_MARKUP: { |
| 1321 | const char *zId; |
| 1322 | int iDiv; |
| 1323 | parseMarkup(&markup, z); |
| 1324 | |
| 1325 | /* Markup of the form </div id=ID> where there is a matching |
| 1326 | ** ID somewhere on the stack. Exit the verbatim if were are in |
| 1327 | ** it. Pop the stack up to the matching <div>. Discard the |
| 1328 |
| --- src/wikiformat.c | |
| +++ src/wikiformat.c | |
| @@ -24,11 +24,11 @@ | |
| 24 | #if INTERFACE |
| 25 | /* |
| 26 | ** Allowed wiki transformation operations |
| 27 | */ |
| 28 | #define WIKI_NOFOLLOW 0x001 |
| 29 | #define WIKI_FULL_HTML 0x002 /* Allow unrestricted HTML */ |
| 30 | #define WIKI_INLINE 0x004 /* Do not surround with <p>..</p> */ |
| 31 | #define WIKI_NOBLOCK 0x008 /* No block markup of any kind */ |
| 32 | #endif |
| 33 | |
| 34 | |
| @@ -1159,10 +1159,11 @@ | |
| 1159 | int tokenType; |
| 1160 | ParsedMarkup markup; |
| 1161 | int n; |
| 1162 | int inlineOnly = (p->state & INLINE_MARKUP_ONLY)!=0; |
| 1163 | int wikiUseHtml = (p->state & WIKI_USE_HTML)!=0; |
| 1164 | int fullHtml = (p->state & WIKI_FULL_HTML)!=0; |
| 1165 | char *zOrig = z; |
| 1166 | |
| 1167 | /* Make sure the attribute constants and names still align |
| 1168 | ** following changes in the attribute list. */ |
| 1169 | assert( fossil_strcmp(aAttribute[ATTR_WIDTH].zName, "width")==0 ); |
| @@ -1318,10 +1319,14 @@ | |
| 1319 | break; |
| 1320 | } |
| 1321 | case TOKEN_MARKUP: { |
| 1322 | const char *zId; |
| 1323 | int iDiv; |
| 1324 | if( fullHtml ){ |
| 1325 | blob_append(p->pOut, z, n); |
| 1326 | break; |
| 1327 | } |
| 1328 | parseMarkup(&markup, z); |
| 1329 | |
| 1330 | /* Markup of the form </div id=ID> where there is a matching |
| 1331 | ** ID somewhere on the stack. Exit the verbatim if were are in |
| 1332 | ** it. Pop the stack up to the matching <div>. Discard the |
| 1333 |