Fossil SCM

If a wiki page begins with <title> then render that as <h1 align='center'> when rendering the whole page. For the "doc" URI, continue to extract the title and use it as the overall page title, as we have always done. This only effects wiki rendered in pages like "artifact".

drh 2014-03-15 15:03 trunk
Commit d8586b5670c31482d11fc9cc6362538bd35d19ef
1 file changed +21 -8
+21 -8
--- src/wikiformat.c
+++ src/wikiformat.c
@@ -216,16 +216,17 @@
216216
#define MARKUP_TBODY 50
217217
#define MARKUP_TD 51
218218
#define MARKUP_TFOOT 52
219219
#define MARKUP_TH 53
220220
#define MARKUP_THEAD 54
221
-#define MARKUP_TR 55
222
-#define MARKUP_TT 56
223
-#define MARKUP_U 57
224
-#define MARKUP_UL 58
225
-#define MARKUP_VAR 59
226
-#define MARKUP_VERBATIM 60
221
+#define MARKUP_TITLE 55
222
+#define MARKUP_TR 56
223
+#define MARKUP_TT 57
224
+#define MARKUP_U 58
225
+#define MARKUP_UL 59
226
+#define MARKUP_VAR 60
227
+#define MARKUP_VERBATIM 61
227228
228229
/*
229230
** The various markup is divided into the following types:
230231
*/
231232
#define MUTYPE_SINGLE 0x0001 /* <img>, <br>, or <hr> */
@@ -348,10 +349,11 @@
348349
{ "th", MARKUP_TH, MUTYPE_TD,
349350
AMSK_ALIGN|AMSK_BGCOLOR|AMSK_COLSPAN|
350351
AMSK_ROWSPAN|AMSK_VALIGN|AMSK_CLASS|AMSK_STYLE },
351352
{ "thead", MARKUP_THEAD, MUTYPE_BLOCK,
352353
AMSK_ALIGN|AMSK_CLASS|AMSK_STYLE },
354
+ { "title", MARKUP_TITLE, MUTYPE_BLOCK, 0 },
353355
{ "tr", MARKUP_TR, MUTYPE_TR,
354356
AMSK_ALIGN|AMSK_BGCOLOR|AMSK_VALIGN|AMSK_CLASS|AMSK_STYLE },
355357
{ "tt", MARKUP_TT, MUTYPE_FONT, AMSK_STYLE },
356358
{ "u", MARKUP_U, MUTYPE_FONT, AMSK_STYLE },
357359
{ "ul", MARKUP_UL, MUTYPE_LIST,
@@ -869,12 +871,14 @@
869871
static void unparseMarkup(ParsedMarkup *p){
870872
int i, n;
871873
for(i=0; i<p->nAttr; i++){
872874
char *z = p->aAttr[i].zValue;
873875
if( z==0 ) continue;
874
- n = strlen(z);
875
- z[n] = p->aAttr[i].cTerm;
876
+ if( p->aAttr[i].cTerm ){
877
+ n = strlen(z);
878
+ z[n] = p->aAttr[i].cTerm;
879
+ }
876880
}
877881
}
878882
879883
/*
880884
** Return the value of attribute attrId. Return NULL if there is no
@@ -1468,10 +1472,19 @@
14681472
}
14691473
case TOKEN_MARKUP: {
14701474
const char *zId;
14711475
int iDiv;
14721476
parseMarkup(&markup, z);
1477
+
1478
+ /* Convert <title> to <h1 align='center'> */
1479
+ if( markup.iCode==MARKUP_TITLE && !p->inVerbatim ){
1480
+ markup.iCode = MARKUP_H1;
1481
+ markup.nAttr = 1;
1482
+ markup.aAttr[0].iACode = AMSK_ALIGN;
1483
+ markup.aAttr[0].zValue = "center";
1484
+ markup.aAttr[0].cTerm = 0;
1485
+ }
14731486
14741487
/* Markup of the form </div id=ID> where there is a matching
14751488
** ID somewhere on the stack. Exit any contained verbatim.
14761489
** Pop the stack up to the matching <div>. Discard the </div>
14771490
*/
14781491
--- src/wikiformat.c
+++ src/wikiformat.c
@@ -216,16 +216,17 @@
216 #define MARKUP_TBODY 50
217 #define MARKUP_TD 51
218 #define MARKUP_TFOOT 52
219 #define MARKUP_TH 53
220 #define MARKUP_THEAD 54
221 #define MARKUP_TR 55
222 #define MARKUP_TT 56
223 #define MARKUP_U 57
224 #define MARKUP_UL 58
225 #define MARKUP_VAR 59
226 #define MARKUP_VERBATIM 60
 
227
228 /*
229 ** The various markup is divided into the following types:
230 */
231 #define MUTYPE_SINGLE 0x0001 /* <img>, <br>, or <hr> */
@@ -348,10 +349,11 @@
348 { "th", MARKUP_TH, MUTYPE_TD,
349 AMSK_ALIGN|AMSK_BGCOLOR|AMSK_COLSPAN|
350 AMSK_ROWSPAN|AMSK_VALIGN|AMSK_CLASS|AMSK_STYLE },
351 { "thead", MARKUP_THEAD, MUTYPE_BLOCK,
352 AMSK_ALIGN|AMSK_CLASS|AMSK_STYLE },
 
353 { "tr", MARKUP_TR, MUTYPE_TR,
354 AMSK_ALIGN|AMSK_BGCOLOR|AMSK_VALIGN|AMSK_CLASS|AMSK_STYLE },
355 { "tt", MARKUP_TT, MUTYPE_FONT, AMSK_STYLE },
356 { "u", MARKUP_U, MUTYPE_FONT, AMSK_STYLE },
357 { "ul", MARKUP_UL, MUTYPE_LIST,
@@ -869,12 +871,14 @@
869 static void unparseMarkup(ParsedMarkup *p){
870 int i, n;
871 for(i=0; i<p->nAttr; i++){
872 char *z = p->aAttr[i].zValue;
873 if( z==0 ) continue;
874 n = strlen(z);
875 z[n] = p->aAttr[i].cTerm;
 
 
876 }
877 }
878
879 /*
880 ** Return the value of attribute attrId. Return NULL if there is no
@@ -1468,10 +1472,19 @@
1468 }
1469 case TOKEN_MARKUP: {
1470 const char *zId;
1471 int iDiv;
1472 parseMarkup(&markup, z);
 
 
 
 
 
 
 
 
 
1473
1474 /* Markup of the form </div id=ID> where there is a matching
1475 ** ID somewhere on the stack. Exit any contained verbatim.
1476 ** Pop the stack up to the matching <div>. Discard the </div>
1477 */
1478
--- src/wikiformat.c
+++ src/wikiformat.c
@@ -216,16 +216,17 @@
216 #define MARKUP_TBODY 50
217 #define MARKUP_TD 51
218 #define MARKUP_TFOOT 52
219 #define MARKUP_TH 53
220 #define MARKUP_THEAD 54
221 #define MARKUP_TITLE 55
222 #define MARKUP_TR 56
223 #define MARKUP_TT 57
224 #define MARKUP_U 58
225 #define MARKUP_UL 59
226 #define MARKUP_VAR 60
227 #define MARKUP_VERBATIM 61
228
229 /*
230 ** The various markup is divided into the following types:
231 */
232 #define MUTYPE_SINGLE 0x0001 /* <img>, <br>, or <hr> */
@@ -348,10 +349,11 @@
349 { "th", MARKUP_TH, MUTYPE_TD,
350 AMSK_ALIGN|AMSK_BGCOLOR|AMSK_COLSPAN|
351 AMSK_ROWSPAN|AMSK_VALIGN|AMSK_CLASS|AMSK_STYLE },
352 { "thead", MARKUP_THEAD, MUTYPE_BLOCK,
353 AMSK_ALIGN|AMSK_CLASS|AMSK_STYLE },
354 { "title", MARKUP_TITLE, MUTYPE_BLOCK, 0 },
355 { "tr", MARKUP_TR, MUTYPE_TR,
356 AMSK_ALIGN|AMSK_BGCOLOR|AMSK_VALIGN|AMSK_CLASS|AMSK_STYLE },
357 { "tt", MARKUP_TT, MUTYPE_FONT, AMSK_STYLE },
358 { "u", MARKUP_U, MUTYPE_FONT, AMSK_STYLE },
359 { "ul", MARKUP_UL, MUTYPE_LIST,
@@ -869,12 +871,14 @@
871 static void unparseMarkup(ParsedMarkup *p){
872 int i, n;
873 for(i=0; i<p->nAttr; i++){
874 char *z = p->aAttr[i].zValue;
875 if( z==0 ) continue;
876 if( p->aAttr[i].cTerm ){
877 n = strlen(z);
878 z[n] = p->aAttr[i].cTerm;
879 }
880 }
881 }
882
883 /*
884 ** Return the value of attribute attrId. Return NULL if there is no
@@ -1468,10 +1472,19 @@
1472 }
1473 case TOKEN_MARKUP: {
1474 const char *zId;
1475 int iDiv;
1476 parseMarkup(&markup, z);
1477
1478 /* Convert <title> to <h1 align='center'> */
1479 if( markup.iCode==MARKUP_TITLE && !p->inVerbatim ){
1480 markup.iCode = MARKUP_H1;
1481 markup.nAttr = 1;
1482 markup.aAttr[0].iACode = AMSK_ALIGN;
1483 markup.aAttr[0].zValue = "center";
1484 markup.aAttr[0].cTerm = 0;
1485 }
1486
1487 /* Markup of the form </div id=ID> where there is a matching
1488 ** ID somewhere on the stack. Exit any contained verbatim.
1489 ** Pop the stack up to the matching <div>. Discard the </div>
1490 */
1491

Keyboard Shortcuts

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