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".
Commit
d8586b5670c31482d11fc9cc6362538bd35d19ef
Parent
60019ce7d9b8d39…
1 file changed
+21
-8
+21
-8
| --- src/wikiformat.c | ||
| +++ src/wikiformat.c | ||
| @@ -216,16 +216,17 @@ | ||
| 216 | 216 | #define MARKUP_TBODY 50 |
| 217 | 217 | #define MARKUP_TD 51 |
| 218 | 218 | #define MARKUP_TFOOT 52 |
| 219 | 219 | #define MARKUP_TH 53 |
| 220 | 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 | |
| 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 | |
| 227 | 228 | |
| 228 | 229 | /* |
| 229 | 230 | ** The various markup is divided into the following types: |
| 230 | 231 | */ |
| 231 | 232 | #define MUTYPE_SINGLE 0x0001 /* <img>, <br>, or <hr> */ |
| @@ -348,10 +349,11 @@ | ||
| 348 | 349 | { "th", MARKUP_TH, MUTYPE_TD, |
| 349 | 350 | AMSK_ALIGN|AMSK_BGCOLOR|AMSK_COLSPAN| |
| 350 | 351 | AMSK_ROWSPAN|AMSK_VALIGN|AMSK_CLASS|AMSK_STYLE }, |
| 351 | 352 | { "thead", MARKUP_THEAD, MUTYPE_BLOCK, |
| 352 | 353 | AMSK_ALIGN|AMSK_CLASS|AMSK_STYLE }, |
| 354 | + { "title", MARKUP_TITLE, MUTYPE_BLOCK, 0 }, | |
| 353 | 355 | { "tr", MARKUP_TR, MUTYPE_TR, |
| 354 | 356 | AMSK_ALIGN|AMSK_BGCOLOR|AMSK_VALIGN|AMSK_CLASS|AMSK_STYLE }, |
| 355 | 357 | { "tt", MARKUP_TT, MUTYPE_FONT, AMSK_STYLE }, |
| 356 | 358 | { "u", MARKUP_U, MUTYPE_FONT, AMSK_STYLE }, |
| 357 | 359 | { "ul", MARKUP_UL, MUTYPE_LIST, |
| @@ -869,12 +871,14 @@ | ||
| 869 | 871 | static void unparseMarkup(ParsedMarkup *p){ |
| 870 | 872 | int i, n; |
| 871 | 873 | for(i=0; i<p->nAttr; i++){ |
| 872 | 874 | char *z = p->aAttr[i].zValue; |
| 873 | 875 | 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 | + } | |
| 876 | 880 | } |
| 877 | 881 | } |
| 878 | 882 | |
| 879 | 883 | /* |
| 880 | 884 | ** Return the value of attribute attrId. Return NULL if there is no |
| @@ -1468,10 +1472,19 @@ | ||
| 1468 | 1472 | } |
| 1469 | 1473 | case TOKEN_MARKUP: { |
| 1470 | 1474 | const char *zId; |
| 1471 | 1475 | int iDiv; |
| 1472 | 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 | + } | |
| 1473 | 1486 | |
| 1474 | 1487 | /* Markup of the form </div id=ID> where there is a matching |
| 1475 | 1488 | ** ID somewhere on the stack. Exit any contained verbatim. |
| 1476 | 1489 | ** Pop the stack up to the matching <div>. Discard the </div> |
| 1477 | 1490 | */ |
| 1478 | 1491 |
| --- 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 |