Fossil SCM

Allow <div style='...'> markup in Fossil Wiki pages.

drh 2015-02-18 18:37 trunk
Commit a6e4dcb08546d2b46a7f9be3d9aa055abe569e4a
--- src/wikiformat.c
+++ src/wikiformat.c
@@ -762,11 +762,11 @@
762762
** Parse this element into the p structure.
763763
**
764764
** The content of z[] might be modified by converting characters
765765
** to lowercase and by inserting some "\000" characters.
766766
*/
767
-static void parseMarkup(ParsedMarkup *p, char *z){
767
+static int parseMarkup(ParsedMarkup *p, char *z){
768768
int i, j, c;
769769
int iACode;
770770
char *zValue;
771771
int seen = 0;
772772
char zTag[100];
@@ -794,11 +794,11 @@
794794
p->aAttr[0].zValue = &z[i];
795795
while( fossil_isalnum(z[i]) ){ i++; }
796796
p->aAttr[0].cTerm = c = z[i];
797797
z[i++] = 0;
798798
p->nAttr = 1;
799
- if( c=='>' ) return;
799
+ if( c=='>' ) return 0;
800800
}
801801
while( fossil_isspace(z[i]) ){ i++; }
802802
while( c!='>' && p->nAttr<8 && fossil_isalpha(z[i]) ){
803803
int attrOk; /* True to preserve attribute. False to ignore it */
804804
j = 0;
@@ -841,10 +841,11 @@
841841
p->nAttr++;
842842
}
843843
while( fossil_isspace(z[i]) ){ i++; }
844844
if( z[i]=='>' || (z[i]=='/' && z[i+1]=='>') ) break;
845845
}
846
+ return seen;
846847
}
847848
848849
/*
849850
** Render markup on the given blob.
850851
*/
@@ -960,11 +961,11 @@
960961
static void popStack(Renderer *p){
961962
if( p->nStack ){
962963
int iCode;
963964
p->nStack--;
964965
iCode = p->aStack[p->nStack].iCode;
965
- if( iCode!=MARKUP_DIV && p->pOut ){
966
+ if( (iCode!=MARKUP_DIV || p->aStack[p->nStack].zId==0) && p->pOut ){
966967
blob_appendf(p->pOut, "</%s>", aMarkup[iCode].zName);
967968
}
968969
}
969970
}
970971
@@ -1480,11 +1481,11 @@
14801481
break;
14811482
}
14821483
case TOKEN_MARKUP: {
14831484
const char *zId;
14841485
int iDiv;
1485
- parseMarkup(&markup, z);
1486
+ int mAttr = parseMarkup(&markup, z);
14861487
14871488
/* Convert <title> to <h1 align='center'> */
14881489
if( markup.iCode==MARKUP_TITLE && !p->inVerbatim ){
14891490
markup.iCode = MARKUP_H1;
14901491
markup.nAttr = 1;
@@ -1567,11 +1568,11 @@
15671568
popStackToTag(p, markup.iCode);
15681569
}else
15691570
15701571
/* Push <div> markup onto the stack together with the id=ID attribute.
15711572
*/
1572
- if( markup.iCode==MARKUP_DIV ){
1573
+ if( markup.iCode==MARKUP_DIV && (mAttr & ATTR_ID)!=0 ){
15731574
pushStackWithId(p, markup.iCode, markupId(&markup),
15741575
(p->state & ALLOW_WIKI)!=0);
15751576
}else
15761577
15771578
/* Enter <verbatim> processing. With verbatim enabled, all other
15781579
--- src/wikiformat.c
+++ src/wikiformat.c
@@ -762,11 +762,11 @@
762 ** Parse this element into the p structure.
763 **
764 ** The content of z[] might be modified by converting characters
765 ** to lowercase and by inserting some "\000" characters.
766 */
767 static void parseMarkup(ParsedMarkup *p, char *z){
768 int i, j, c;
769 int iACode;
770 char *zValue;
771 int seen = 0;
772 char zTag[100];
@@ -794,11 +794,11 @@
794 p->aAttr[0].zValue = &z[i];
795 while( fossil_isalnum(z[i]) ){ i++; }
796 p->aAttr[0].cTerm = c = z[i];
797 z[i++] = 0;
798 p->nAttr = 1;
799 if( c=='>' ) return;
800 }
801 while( fossil_isspace(z[i]) ){ i++; }
802 while( c!='>' && p->nAttr<8 && fossil_isalpha(z[i]) ){
803 int attrOk; /* True to preserve attribute. False to ignore it */
804 j = 0;
@@ -841,10 +841,11 @@
841 p->nAttr++;
842 }
843 while( fossil_isspace(z[i]) ){ i++; }
844 if( z[i]=='>' || (z[i]=='/' && z[i+1]=='>') ) break;
845 }
 
846 }
847
848 /*
849 ** Render markup on the given blob.
850 */
@@ -960,11 +961,11 @@
960 static void popStack(Renderer *p){
961 if( p->nStack ){
962 int iCode;
963 p->nStack--;
964 iCode = p->aStack[p->nStack].iCode;
965 if( iCode!=MARKUP_DIV && p->pOut ){
966 blob_appendf(p->pOut, "</%s>", aMarkup[iCode].zName);
967 }
968 }
969 }
970
@@ -1480,11 +1481,11 @@
1480 break;
1481 }
1482 case TOKEN_MARKUP: {
1483 const char *zId;
1484 int iDiv;
1485 parseMarkup(&markup, z);
1486
1487 /* Convert <title> to <h1 align='center'> */
1488 if( markup.iCode==MARKUP_TITLE && !p->inVerbatim ){
1489 markup.iCode = MARKUP_H1;
1490 markup.nAttr = 1;
@@ -1567,11 +1568,11 @@
1567 popStackToTag(p, markup.iCode);
1568 }else
1569
1570 /* Push <div> markup onto the stack together with the id=ID attribute.
1571 */
1572 if( markup.iCode==MARKUP_DIV ){
1573 pushStackWithId(p, markup.iCode, markupId(&markup),
1574 (p->state & ALLOW_WIKI)!=0);
1575 }else
1576
1577 /* Enter <verbatim> processing. With verbatim enabled, all other
1578
--- src/wikiformat.c
+++ src/wikiformat.c
@@ -762,11 +762,11 @@
762 ** Parse this element into the p structure.
763 **
764 ** The content of z[] might be modified by converting characters
765 ** to lowercase and by inserting some "\000" characters.
766 */
767 static int parseMarkup(ParsedMarkup *p, char *z){
768 int i, j, c;
769 int iACode;
770 char *zValue;
771 int seen = 0;
772 char zTag[100];
@@ -794,11 +794,11 @@
794 p->aAttr[0].zValue = &z[i];
795 while( fossil_isalnum(z[i]) ){ i++; }
796 p->aAttr[0].cTerm = c = z[i];
797 z[i++] = 0;
798 p->nAttr = 1;
799 if( c=='>' ) return 0;
800 }
801 while( fossil_isspace(z[i]) ){ i++; }
802 while( c!='>' && p->nAttr<8 && fossil_isalpha(z[i]) ){
803 int attrOk; /* True to preserve attribute. False to ignore it */
804 j = 0;
@@ -841,10 +841,11 @@
841 p->nAttr++;
842 }
843 while( fossil_isspace(z[i]) ){ i++; }
844 if( z[i]=='>' || (z[i]=='/' && z[i+1]=='>') ) break;
845 }
846 return seen;
847 }
848
849 /*
850 ** Render markup on the given blob.
851 */
@@ -960,11 +961,11 @@
961 static void popStack(Renderer *p){
962 if( p->nStack ){
963 int iCode;
964 p->nStack--;
965 iCode = p->aStack[p->nStack].iCode;
966 if( (iCode!=MARKUP_DIV || p->aStack[p->nStack].zId==0) && p->pOut ){
967 blob_appendf(p->pOut, "</%s>", aMarkup[iCode].zName);
968 }
969 }
970 }
971
@@ -1480,11 +1481,11 @@
1481 break;
1482 }
1483 case TOKEN_MARKUP: {
1484 const char *zId;
1485 int iDiv;
1486 int mAttr = parseMarkup(&markup, z);
1487
1488 /* Convert <title> to <h1 align='center'> */
1489 if( markup.iCode==MARKUP_TITLE && !p->inVerbatim ){
1490 markup.iCode = MARKUP_H1;
1491 markup.nAttr = 1;
@@ -1567,11 +1568,11 @@
1568 popStackToTag(p, markup.iCode);
1569 }else
1570
1571 /* Push <div> markup onto the stack together with the id=ID attribute.
1572 */
1573 if( markup.iCode==MARKUP_DIV && (mAttr & ATTR_ID)!=0 ){
1574 pushStackWithId(p, markup.iCode, markupId(&markup),
1575 (p->state & ALLOW_WIKI)!=0);
1576 }else
1577
1578 /* Enter <verbatim> processing. With verbatim enabled, all other
1579
--- www/hacker-howto.wiki
+++ www/hacker-howto.wiki
@@ -2,10 +2,11 @@
22
33
The following links are of interest to programmers who want to modify
44
or enhance Fossil. Ordinary users can safely ignore this information.
55
66
* [./build.wiki | How To Compile And Install Fossil]
7
+ * [./customskin.md | Theming Fossil]
78
* [./makefile.wiki | The Fossil Build Process]
89
* [./tech_overview.wiki | A Technical Overview of Fossil]
910
* [./adding_code.wiki | Adding Features To Fossil]
1011
* [./contribute.wiki|Contributing Code Or Enhancements To The Fossil Project]
1112
* [./style.wiki | Coding Style Guidelines]
1213
--- www/hacker-howto.wiki
+++ www/hacker-howto.wiki
@@ -2,10 +2,11 @@
2
3 The following links are of interest to programmers who want to modify
4 or enhance Fossil. Ordinary users can safely ignore this information.
5
6 * [./build.wiki | How To Compile And Install Fossil]
 
7 * [./makefile.wiki | The Fossil Build Process]
8 * [./tech_overview.wiki | A Technical Overview of Fossil]
9 * [./adding_code.wiki | Adding Features To Fossil]
10 * [./contribute.wiki|Contributing Code Or Enhancements To The Fossil Project]
11 * [./style.wiki | Coding Style Guidelines]
12
--- www/hacker-howto.wiki
+++ www/hacker-howto.wiki
@@ -2,10 +2,11 @@
2
3 The following links are of interest to programmers who want to modify
4 or enhance Fossil. Ordinary users can safely ignore this information.
5
6 * [./build.wiki | How To Compile And Install Fossil]
7 * [./customskin.md | Theming Fossil]
8 * [./makefile.wiki | The Fossil Build Process]
9 * [./tech_overview.wiki | A Technical Overview of Fossil]
10 * [./adding_code.wiki | Adding Features To Fossil]
11 * [./contribute.wiki|Contributing Code Or Enhancements To The Fossil Project]
12 * [./style.wiki | Coding Style Guidelines]
13
+1 -1
--- www/index.wiki
+++ www/index.wiki
@@ -29,11 +29,11 @@
2929
<li> [http://www.fossil-scm.org/schimpf-book/home | Jim Schimpf's book]
3030
<li> Mailing list
3131
<ul>
3232
<li> [http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users | sign-up]
3333
<li> [http://www.mail-archive.com/[email protected] | archives]
34
- <ul>
34
+ </ul>
3535
</ul>
3636
</td></tr>
3737
<tr><td>
3838
<center><img src="fossil3.gif"></center>
3939
</td></tr>
4040
--- www/index.wiki
+++ www/index.wiki
@@ -29,11 +29,11 @@
29 <li> [http://www.fossil-scm.org/schimpf-book/home | Jim Schimpf's book]
30 <li> Mailing list
31 <ul>
32 <li> [http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users | sign-up]
33 <li> [http://www.mail-archive.com/[email protected] | archives]
34 <ul>
35 </ul>
36 </td></tr>
37 <tr><td>
38 <center><img src="fossil3.gif"></center>
39 </td></tr>
40
--- www/index.wiki
+++ www/index.wiki
@@ -29,11 +29,11 @@
29 <li> [http://www.fossil-scm.org/schimpf-book/home | Jim Schimpf's book]
30 <li> Mailing list
31 <ul>
32 <li> [http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users | sign-up]
33 <li> [http://www.mail-archive.com/[email protected] | archives]
34 </ul>
35 </ul>
36 </td></tr>
37 <tr><td>
38 <center><img src="fossil3.gif"></center>
39 </td></tr>
40

Keyboard Shortcuts

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