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.

drh 2012-10-19 17:34 UTC trunk
Commit 463df97c06e408b2224fea53f8e902da9067699e
2 files changed +2 -2 +6 -1
+2 -2
--- src/doc.c
+++ src/doc.c
@@ -489,14 +489,14 @@
489489
" WHERE objid=%d AND type='ci'", vid));
490490
if( fossil_strcmp(zMime, "application/x-fossil-wiki")==0 ){
491491
Blob title, tail;
492492
if( wiki_find_title(&filebody, &title, &tail) ){
493493
style_header(blob_str(&title));
494
- wiki_convert(&tail, 0, 0);
494
+ wiki_convert(&tail, 0, WIKI_FULL_HTML);
495495
}else{
496496
style_header("Documentation");
497
- wiki_convert(&filebody, 0, 0);
497
+ wiki_convert(&filebody, 0, WIKI_FULL_HTML);
498498
}
499499
style_footer();
500500
}else if( fossil_strcmp(zMime, "text/plain")==0 ){
501501
style_header("Documentation");
502502
@ <blockquote><pre>
503503
--- 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
--- src/wikiformat.c
+++ src/wikiformat.c
@@ -24,11 +24,11 @@
2424
#if INTERFACE
2525
/*
2626
** Allowed wiki transformation operations
2727
*/
2828
#define WIKI_NOFOLLOW 0x001
29
-#define WIKI_HTML 0x002
29
+#define WIKI_FULL_HTML 0x002 /* Allow unrestricted HTML */
3030
#define WIKI_INLINE 0x004 /* Do not surround with <p>..</p> */
3131
#define WIKI_NOBLOCK 0x008 /* No block markup of any kind */
3232
#endif
3333
3434
@@ -1159,10 +1159,11 @@
11591159
int tokenType;
11601160
ParsedMarkup markup;
11611161
int n;
11621162
int inlineOnly = (p->state & INLINE_MARKUP_ONLY)!=0;
11631163
int wikiUseHtml = (p->state & WIKI_USE_HTML)!=0;
1164
+ int fullHtml = (p->state & WIKI_FULL_HTML)!=0;
11641165
char *zOrig = z;
11651166
11661167
/* Make sure the attribute constants and names still align
11671168
** following changes in the attribute list. */
11681169
assert( fossil_strcmp(aAttribute[ATTR_WIDTH].zName, "width")==0 );
@@ -1318,10 +1319,14 @@
13181319
break;
13191320
}
13201321
case TOKEN_MARKUP: {
13211322
const char *zId;
13221323
int iDiv;
1324
+ if( fullHtml ){
1325
+ blob_append(p->pOut, z, n);
1326
+ break;
1327
+ }
13231328
parseMarkup(&markup, z);
13241329
13251330
/* Markup of the form </div id=ID> where there is a matching
13261331
** ID somewhere on the stack. Exit the verbatim if were are in
13271332
** it. Pop the stack up to the matching <div>. Discard the
13281333
--- 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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button