Fossil SCM
Merge enhancements from trunk.
Commit
3f1b8862cbe97fbf328c317edd9953b4835088fd8784eb42d9738fded3e523f8
Parent
b46175c56fff782…
7 files changed
+2
-2
+3
-2
+8
-1
+20
+63
-6
+16
-5
+8
+2
-2
| --- src/markdown_html.c | ||
| +++ src/markdown_html.c | ||
| @@ -328,11 +328,11 @@ | ||
| 328 | 328 | |
| 329 | 329 | /* |
| 330 | 330 | ** The nSrc bytes at zSrc[] are Pikchr input text (allegedly). Process that |
| 331 | 331 | ** text and insert the result in place of the original. |
| 332 | 332 | */ |
| 333 | -static void fenced_code_pikchr_to_html( | |
| 333 | +void pikchr_to_html( | |
| 334 | 334 | Blob *ob, /* Write the generated SVG here */ |
| 335 | 335 | const char *zSrc, int nSrc, /* The Pikchr source text */ |
| 336 | 336 | const char *zArg, int nArg /* Addition arguments */ |
| 337 | 337 | ){ |
| 338 | 338 | int w = 0, h = 0; |
| @@ -412,11 +412,11 @@ | ||
| 412 | 412 | blob_appendf(ob, "<pre><code>%#h</code></pre>", n-i, z+i); |
| 413 | 413 | }else{ |
| 414 | 414 | for(j=k+1; j<i && !fossil_isspace(z[j]); j++){} |
| 415 | 415 | if( j-k==6 && strncmp(z+k,"pikchr",6)==0 ){ |
| 416 | 416 | while( j<i && fossil_isspace(z[j]) ){ j++; } |
| 417 | - fenced_code_pikchr_to_html(ob, z+i, n-i, z+j, i-j); | |
| 417 | + pikchr_to_html(ob, z+i, n-i, z+j, i-j); | |
| 418 | 418 | }else{ |
| 419 | 419 | blob_appendf(ob, "<pre><code class='language-%#h'>%#h</code></pre>", |
| 420 | 420 | j-k, z+k, n-i, z+i); |
| 421 | 421 | } |
| 422 | 422 | } |
| 423 | 423 |
| --- src/markdown_html.c | |
| +++ src/markdown_html.c | |
| @@ -328,11 +328,11 @@ | |
| 328 | |
| 329 | /* |
| 330 | ** The nSrc bytes at zSrc[] are Pikchr input text (allegedly). Process that |
| 331 | ** text and insert the result in place of the original. |
| 332 | */ |
| 333 | static void fenced_code_pikchr_to_html( |
| 334 | Blob *ob, /* Write the generated SVG here */ |
| 335 | const char *zSrc, int nSrc, /* The Pikchr source text */ |
| 336 | const char *zArg, int nArg /* Addition arguments */ |
| 337 | ){ |
| 338 | int w = 0, h = 0; |
| @@ -412,11 +412,11 @@ | |
| 412 | blob_appendf(ob, "<pre><code>%#h</code></pre>", n-i, z+i); |
| 413 | }else{ |
| 414 | for(j=k+1; j<i && !fossil_isspace(z[j]); j++){} |
| 415 | if( j-k==6 && strncmp(z+k,"pikchr",6)==0 ){ |
| 416 | while( j<i && fossil_isspace(z[j]) ){ j++; } |
| 417 | fenced_code_pikchr_to_html(ob, z+i, n-i, z+j, i-j); |
| 418 | }else{ |
| 419 | blob_appendf(ob, "<pre><code class='language-%#h'>%#h</code></pre>", |
| 420 | j-k, z+k, n-i, z+i); |
| 421 | } |
| 422 | } |
| 423 |
| --- src/markdown_html.c | |
| +++ src/markdown_html.c | |
| @@ -328,11 +328,11 @@ | |
| 328 | |
| 329 | /* |
| 330 | ** The nSrc bytes at zSrc[] are Pikchr input text (allegedly). Process that |
| 331 | ** text and insert the result in place of the original. |
| 332 | */ |
| 333 | void pikchr_to_html( |
| 334 | Blob *ob, /* Write the generated SVG here */ |
| 335 | const char *zSrc, int nSrc, /* The Pikchr source text */ |
| 336 | const char *zArg, int nArg /* Addition arguments */ |
| 337 | ){ |
| 338 | int w = 0, h = 0; |
| @@ -412,11 +412,11 @@ | |
| 412 | blob_appendf(ob, "<pre><code>%#h</code></pre>", n-i, z+i); |
| 413 | }else{ |
| 414 | for(j=k+1; j<i && !fossil_isspace(z[j]); j++){} |
| 415 | if( j-k==6 && strncmp(z+k,"pikchr",6)==0 ){ |
| 416 | while( j<i && fossil_isspace(z[j]) ){ j++; } |
| 417 | pikchr_to_html(ob, z+i, n-i, z+j, i-j); |
| 418 | }else{ |
| 419 | blob_appendf(ob, "<pre><code class='language-%#h'>%#h</code></pre>", |
| 420 | j-k, z+k, n-i, z+i); |
| 421 | } |
| 422 | } |
| 423 |
+3
-2
| --- src/pikchr.c | ||
| +++ src/pikchr.c | ||
| @@ -5114,11 +5114,11 @@ | ||
| 5114 | 5114 | ** |
| 5115 | 5115 | ** Special color names "None" and "Off" return -1.0 without causing |
| 5116 | 5116 | ** an error. |
| 5117 | 5117 | */ |
| 5118 | 5118 | static PNum pik_lookup_color(Pik *p, PToken *pId){ |
| 5119 | - int first, last, mid, c; | |
| 5119 | + int first, last, mid, c = 0; | |
| 5120 | 5120 | first = 0; |
| 5121 | 5121 | last = count(aColor)-1; |
| 5122 | 5122 | while( first<=last ){ |
| 5123 | 5123 | const char *zClr; |
| 5124 | 5124 | int c1, c2, i; |
| @@ -5479,10 +5479,11 @@ | ||
| 5479 | 5479 | ** Search for object located at *pCenter that has an xChop method. |
| 5480 | 5480 | ** Return a pointer to the object, or NULL if not found. |
| 5481 | 5481 | */ |
| 5482 | 5482 | static PElem *pik_find_chopper(PEList *pList, PPoint *pCenter){ |
| 5483 | 5483 | int i; |
| 5484 | + if( pList==0 ) return 0; | |
| 5484 | 5485 | for(i=pList->n-1; i>=0; i--){ |
| 5485 | 5486 | PElem *pElem = pList->a[i]; |
| 5486 | 5487 | if( pElem->type->xChop!=0 |
| 5487 | 5488 | && pElem->ptAt.x==pCenter->x |
| 5488 | 5489 | && pElem->ptAt.y==pCenter->y |
| @@ -6330,6 +6331,6 @@ | ||
| 6330 | 6331 | printf("</body></html>\n"); |
| 6331 | 6332 | return 0; |
| 6332 | 6333 | } |
| 6333 | 6334 | #endif /* PIKCHR_SHELL */ |
| 6334 | 6335 | |
| 6335 | -#line 6360 "pikchr.c" | |
| 6336 | +#line 6361 "pikchr.c" | |
| 6336 | 6337 |
| --- src/pikchr.c | |
| +++ src/pikchr.c | |
| @@ -5114,11 +5114,11 @@ | |
| 5114 | ** |
| 5115 | ** Special color names "None" and "Off" return -1.0 without causing |
| 5116 | ** an error. |
| 5117 | */ |
| 5118 | static PNum pik_lookup_color(Pik *p, PToken *pId){ |
| 5119 | int first, last, mid, c; |
| 5120 | first = 0; |
| 5121 | last = count(aColor)-1; |
| 5122 | while( first<=last ){ |
| 5123 | const char *zClr; |
| 5124 | int c1, c2, i; |
| @@ -5479,10 +5479,11 @@ | |
| 5479 | ** Search for object located at *pCenter that has an xChop method. |
| 5480 | ** Return a pointer to the object, or NULL if not found. |
| 5481 | */ |
| 5482 | static PElem *pik_find_chopper(PEList *pList, PPoint *pCenter){ |
| 5483 | int i; |
| 5484 | for(i=pList->n-1; i>=0; i--){ |
| 5485 | PElem *pElem = pList->a[i]; |
| 5486 | if( pElem->type->xChop!=0 |
| 5487 | && pElem->ptAt.x==pCenter->x |
| 5488 | && pElem->ptAt.y==pCenter->y |
| @@ -6330,6 +6331,6 @@ | |
| 6330 | printf("</body></html>\n"); |
| 6331 | return 0; |
| 6332 | } |
| 6333 | #endif /* PIKCHR_SHELL */ |
| 6334 | |
| 6335 | #line 6360 "pikchr.c" |
| 6336 |
| --- src/pikchr.c | |
| +++ src/pikchr.c | |
| @@ -5114,11 +5114,11 @@ | |
| 5114 | ** |
| 5115 | ** Special color names "None" and "Off" return -1.0 without causing |
| 5116 | ** an error. |
| 5117 | */ |
| 5118 | static PNum pik_lookup_color(Pik *p, PToken *pId){ |
| 5119 | int first, last, mid, c = 0; |
| 5120 | first = 0; |
| 5121 | last = count(aColor)-1; |
| 5122 | while( first<=last ){ |
| 5123 | const char *zClr; |
| 5124 | int c1, c2, i; |
| @@ -5479,10 +5479,11 @@ | |
| 5479 | ** Search for object located at *pCenter that has an xChop method. |
| 5480 | ** Return a pointer to the object, or NULL if not found. |
| 5481 | */ |
| 5482 | static PElem *pik_find_chopper(PEList *pList, PPoint *pCenter){ |
| 5483 | int i; |
| 5484 | if( pList==0 ) return 0; |
| 5485 | for(i=pList->n-1; i>=0; i--){ |
| 5486 | PElem *pElem = pList->a[i]; |
| 5487 | if( pElem->type->xChop!=0 |
| 5488 | && pElem->ptAt.x==pCenter->x |
| 5489 | && pElem->ptAt.y==pCenter->y |
| @@ -6330,6 +6331,6 @@ | |
| 6331 | printf("</body></html>\n"); |
| 6332 | return 0; |
| 6333 | } |
| 6334 | #endif /* PIKCHR_SHELL */ |
| 6335 | |
| 6336 | #line 6361 "pikchr.c" |
| 6337 |
+8
-1
| --- src/style.c | ||
| +++ src/style.c | ||
| @@ -552,11 +552,11 @@ | ||
| 552 | 552 | /* |
| 553 | 553 | ** Default HTML page header text through <body>. If the repository-specific |
| 554 | 554 | ** header template lacks a <body> tag, then all of the following is |
| 555 | 555 | ** prepended. |
| 556 | 556 | */ |
| 557 | -static char zDfltHeader[] = | |
| 557 | +static const char zDfltHeader[] = | |
| 558 | 558 | @ <html> |
| 559 | 559 | @ <head> |
| 560 | 560 | @ <base href="$baseurl/$current_page" /> |
| 561 | 561 | @ <meta http-equiv="Content-Security-Policy" content="$default_csp" /> |
| 562 | 562 | @ <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| @@ -565,10 +565,17 @@ | ||
| 565 | 565 | @ href="$home/timeline.rss" /> |
| 566 | 566 | @ <link rel="stylesheet" href="$stylesheet_url" type="text/css" /> |
| 567 | 567 | @ </head> |
| 568 | 568 | @ <body> |
| 569 | 569 | ; |
| 570 | + | |
| 571 | +/* | |
| 572 | +** Returns the default page header. | |
| 573 | +*/ | |
| 574 | +const char *get_default_header(){ | |
| 575 | + return zDfltHeader; | |
| 576 | +} | |
| 570 | 577 | |
| 571 | 578 | /* |
| 572 | 579 | ** Initialize all the default TH1 variables |
| 573 | 580 | */ |
| 574 | 581 | static void style_init_th1_vars(const char *zTitle){ |
| 575 | 582 |
| --- src/style.c | |
| +++ src/style.c | |
| @@ -552,11 +552,11 @@ | |
| 552 | /* |
| 553 | ** Default HTML page header text through <body>. If the repository-specific |
| 554 | ** header template lacks a <body> tag, then all of the following is |
| 555 | ** prepended. |
| 556 | */ |
| 557 | static char zDfltHeader[] = |
| 558 | @ <html> |
| 559 | @ <head> |
| 560 | @ <base href="$baseurl/$current_page" /> |
| 561 | @ <meta http-equiv="Content-Security-Policy" content="$default_csp" /> |
| 562 | @ <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| @@ -565,10 +565,17 @@ | |
| 565 | @ href="$home/timeline.rss" /> |
| 566 | @ <link rel="stylesheet" href="$stylesheet_url" type="text/css" /> |
| 567 | @ </head> |
| 568 | @ <body> |
| 569 | ; |
| 570 | |
| 571 | /* |
| 572 | ** Initialize all the default TH1 variables |
| 573 | */ |
| 574 | static void style_init_th1_vars(const char *zTitle){ |
| 575 |
| --- src/style.c | |
| +++ src/style.c | |
| @@ -552,11 +552,11 @@ | |
| 552 | /* |
| 553 | ** Default HTML page header text through <body>. If the repository-specific |
| 554 | ** header template lacks a <body> tag, then all of the following is |
| 555 | ** prepended. |
| 556 | */ |
| 557 | static const char zDfltHeader[] = |
| 558 | @ <html> |
| 559 | @ <head> |
| 560 | @ <base href="$baseurl/$current_page" /> |
| 561 | @ <meta http-equiv="Content-Security-Policy" content="$default_csp" /> |
| 562 | @ <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| @@ -565,10 +565,17 @@ | |
| 565 | @ href="$home/timeline.rss" /> |
| 566 | @ <link rel="stylesheet" href="$stylesheet_url" type="text/css" /> |
| 567 | @ </head> |
| 568 | @ <body> |
| 569 | ; |
| 570 | |
| 571 | /* |
| 572 | ** Returns the default page header. |
| 573 | */ |
| 574 | const char *get_default_header(){ |
| 575 | return zDfltHeader; |
| 576 | } |
| 577 | |
| 578 | /* |
| 579 | ** Initialize all the default TH1 variables |
| 580 | */ |
| 581 | static void style_init_th1_vars(const char *zTitle){ |
| 582 |
+20
| --- src/th_main.c | ||
| +++ src/th_main.c | ||
| @@ -1345,10 +1345,29 @@ | ||
| 1345 | 1345 | } |
| 1346 | 1346 | rc = Th_Render(argv[1]); |
| 1347 | 1347 | Th_SetResult(interp, 0, 0); |
| 1348 | 1348 | return rc; |
| 1349 | 1349 | } |
| 1350 | + | |
| 1351 | +/* | |
| 1352 | +** TH1 command: defHeader TITLE | |
| 1353 | +** | |
| 1354 | +** Returns the default page header. | |
| 1355 | +*/ | |
| 1356 | +static int defHeaderCmd( | |
| 1357 | + Th_Interp *interp, | |
| 1358 | + void *p, | |
| 1359 | + int argc, | |
| 1360 | + const char **argv, | |
| 1361 | + int *argl | |
| 1362 | +){ | |
| 1363 | + if( argc!=1 ){ | |
| 1364 | + return Th_WrongNumArgs(interp, "defHeader"); | |
| 1365 | + } | |
| 1366 | + Th_SetResult(interp, get_default_header(), -1); | |
| 1367 | + return TH_OK; | |
| 1368 | +} | |
| 1350 | 1369 | |
| 1351 | 1370 | /* |
| 1352 | 1371 | ** TH1 command: styleHeader TITLE |
| 1353 | 1372 | ** |
| 1354 | 1373 | ** Render the configured style header for the selected skin. |
| @@ -2112,10 +2131,11 @@ | ||
| 2112 | 2131 | {"checkout", checkoutCmd, 0}, |
| 2113 | 2132 | {"combobox", comboboxCmd, 0}, |
| 2114 | 2133 | {"copybtn", copybtnCmd, 0}, |
| 2115 | 2134 | {"date", dateCmd, 0}, |
| 2116 | 2135 | {"decorate", wikiCmd, (void*)&aFlags[2]}, |
| 2136 | + {"defHeader", defHeaderCmd, 0}, | |
| 2117 | 2137 | {"dir", dirCmd, 0}, |
| 2118 | 2138 | {"enable_output", enableOutputCmd, 0}, |
| 2119 | 2139 | {"encode64", encode64Cmd, 0}, |
| 2120 | 2140 | {"getParameter", getParameterCmd, 0}, |
| 2121 | 2141 | {"glob_match", globMatchCmd, 0}, |
| 2122 | 2142 |
| --- src/th_main.c | |
| +++ src/th_main.c | |
| @@ -1345,10 +1345,29 @@ | |
| 1345 | } |
| 1346 | rc = Th_Render(argv[1]); |
| 1347 | Th_SetResult(interp, 0, 0); |
| 1348 | return rc; |
| 1349 | } |
| 1350 | |
| 1351 | /* |
| 1352 | ** TH1 command: styleHeader TITLE |
| 1353 | ** |
| 1354 | ** Render the configured style header for the selected skin. |
| @@ -2112,10 +2131,11 @@ | |
| 2112 | {"checkout", checkoutCmd, 0}, |
| 2113 | {"combobox", comboboxCmd, 0}, |
| 2114 | {"copybtn", copybtnCmd, 0}, |
| 2115 | {"date", dateCmd, 0}, |
| 2116 | {"decorate", wikiCmd, (void*)&aFlags[2]}, |
| 2117 | {"dir", dirCmd, 0}, |
| 2118 | {"enable_output", enableOutputCmd, 0}, |
| 2119 | {"encode64", encode64Cmd, 0}, |
| 2120 | {"getParameter", getParameterCmd, 0}, |
| 2121 | {"glob_match", globMatchCmd, 0}, |
| 2122 |
| --- src/th_main.c | |
| +++ src/th_main.c | |
| @@ -1345,10 +1345,29 @@ | |
| 1345 | } |
| 1346 | rc = Th_Render(argv[1]); |
| 1347 | Th_SetResult(interp, 0, 0); |
| 1348 | return rc; |
| 1349 | } |
| 1350 | |
| 1351 | /* |
| 1352 | ** TH1 command: defHeader TITLE |
| 1353 | ** |
| 1354 | ** Returns the default page header. |
| 1355 | */ |
| 1356 | static int defHeaderCmd( |
| 1357 | Th_Interp *interp, |
| 1358 | void *p, |
| 1359 | int argc, |
| 1360 | const char **argv, |
| 1361 | int *argl |
| 1362 | ){ |
| 1363 | if( argc!=1 ){ |
| 1364 | return Th_WrongNumArgs(interp, "defHeader"); |
| 1365 | } |
| 1366 | Th_SetResult(interp, get_default_header(), -1); |
| 1367 | return TH_OK; |
| 1368 | } |
| 1369 | |
| 1370 | /* |
| 1371 | ** TH1 command: styleHeader TITLE |
| 1372 | ** |
| 1373 | ** Render the configured style header for the selected skin. |
| @@ -2112,10 +2131,11 @@ | |
| 2131 | {"checkout", checkoutCmd, 0}, |
| 2132 | {"combobox", comboboxCmd, 0}, |
| 2133 | {"copybtn", copybtnCmd, 0}, |
| 2134 | {"date", dateCmd, 0}, |
| 2135 | {"decorate", wikiCmd, (void*)&aFlags[2]}, |
| 2136 | {"defHeader", defHeaderCmd, 0}, |
| 2137 | {"dir", dirCmd, 0}, |
| 2138 | {"enable_output", enableOutputCmd, 0}, |
| 2139 | {"encode64", encode64Cmd, 0}, |
| 2140 | {"getParameter", getParameterCmd, 0}, |
| 2141 | {"glob_match", globMatchCmd, 0}, |
| 2142 |
+63
-6
| --- src/wikiformat.c | ||
| +++ src/wikiformat.c | ||
| @@ -1358,10 +1358,60 @@ | ||
| 1358 | 1358 | if( p->zVerbatimId==0 ) return 1; |
| 1359 | 1359 | if( pMarkup->nAttr!=1 ) return 0; |
| 1360 | 1360 | z = pMarkup->aAttr[0].zValue; |
| 1361 | 1361 | return fossil_strcmp(z, p->zVerbatimId)==0; |
| 1362 | 1362 | } |
| 1363 | + | |
| 1364 | +/* | |
| 1365 | +** z[] points to the text that immediately follows markup of the form: | |
| 1366 | +** | |
| 1367 | +** <verbatim type='pikchr ...'> | |
| 1368 | +** | |
| 1369 | +** zClass is the argument to "type". This routine will process the | |
| 1370 | +** Pikchr text through the next matching </verbatim> (or until end-of-file) | |
| 1371 | +** and append the resulting SVG output onto p. It then returns the | |
| 1372 | +** number of bytes of text processed, including the closing </verbatim>. | |
| 1373 | +*/ | |
| 1374 | +static int wiki_process_pikchr(Renderer *p, char *z, const char *zClass){ | |
| 1375 | + ParsedMarkup m; /* Parsed closing tag */ | |
| 1376 | + int i = 0; /* For looping over z[] in search of </verbatim> */ | |
| 1377 | + int iRet = 0; /* Value to return */ | |
| 1378 | + int atEnd = 0; /* True if se have found the </verbatim> */ | |
| 1379 | + int nMarkup = 0; /* Length of a markup we are checking */ | |
| 1380 | + | |
| 1381 | + /* Search for the closing </verbatim> tag */ | |
| 1382 | + while( z[i]!=0 ){ | |
| 1383 | + char *zEnd = strchr(z+i, '<'); | |
| 1384 | + if( zEnd==0 ){ | |
| 1385 | + i += (int)strlen(z+i); | |
| 1386 | + iRet = i; | |
| 1387 | + break; | |
| 1388 | + } | |
| 1389 | + nMarkup = html_tag_length(zEnd); | |
| 1390 | + if( nMarkup<11 || fossil_strnicmp(zEnd, "</verbatim", 10)!=0 ){ | |
| 1391 | + i = (int)(zEnd - z) + 1; | |
| 1392 | + continue; | |
| 1393 | + } | |
| 1394 | + (void)parseMarkup(&m, z+i); | |
| 1395 | + atEnd = endVerbatim(p, &m); | |
| 1396 | + unparseMarkup(&m); | |
| 1397 | + if( atEnd ){ | |
| 1398 | + iRet = i + nMarkup; | |
| 1399 | + break; | |
| 1400 | + } | |
| 1401 | + i++; | |
| 1402 | + } | |
| 1403 | + | |
| 1404 | + /* The Pikchr source text should be i character in length and iRet is | |
| 1405 | + ** i plus the number of bytes in the </verbatim>. Generate the reply. | |
| 1406 | + */ | |
| 1407 | + assert( strncmp(zClass,"pikchr",6)==0 ); | |
| 1408 | + zClass += 6; | |
| 1409 | + while( fossil_isspace(zClass[0]) ) zClass++; | |
| 1410 | + pikchr_to_html(p->pOut, z, i, zClass, (int)strlen(zClass)); | |
| 1411 | + return iRet; | |
| 1412 | +} | |
| 1363 | 1413 | |
| 1364 | 1414 | /* |
| 1365 | 1415 | ** Return the MUTYPE for the top of the stack. |
| 1366 | 1416 | */ |
| 1367 | 1417 | static int stackTopType(Renderer *p){ |
| @@ -1658,30 +1708,37 @@ | ||
| 1658 | 1708 | /* Enter <verbatim> processing. With verbatim enabled, all other |
| 1659 | 1709 | ** markup other than the corresponding end-tag with the same ID is |
| 1660 | 1710 | ** ignored. |
| 1661 | 1711 | */ |
| 1662 | 1712 | if( markup.iCode==MARKUP_VERBATIM ){ |
| 1663 | - int ii, vAttrDidAppend=0; | |
| 1713 | + int ii; //, vAttrDidAppend=0; | |
| 1714 | + const char *zClass = 0; | |
| 1664 | 1715 | p->zVerbatimId = 0; |
| 1665 | 1716 | p->inVerbatim = 1; |
| 1666 | 1717 | p->preVerbState = p->state; |
| 1667 | 1718 | p->state &= ~ALLOW_WIKI; |
| 1668 | 1719 | for(ii=0; ii<markup.nAttr; ii++){ |
| 1669 | 1720 | if( markup.aAttr[ii].iACode == ATTR_ID ){ |
| 1670 | 1721 | p->zVerbatimId = markup.aAttr[ii].zValue; |
| 1671 | 1722 | }else if( markup.aAttr[ii].iACode==ATTR_TYPE ){ |
| 1672 | - blob_appendf(p->pOut, "<pre name='code' class='%s'>", | |
| 1673 | - markup.aAttr[ii].zValue); | |
| 1674 | - vAttrDidAppend=1; | |
| 1723 | + zClass = markup.aAttr[ii].zValue; | |
| 1675 | 1724 | }else if( markup.aAttr[ii].iACode==ATTR_LINKS |
| 1676 | 1725 | && !is_false(markup.aAttr[ii].zValue) ){ |
| 1677 | 1726 | p->state |= ALLOW_LINKS; |
| 1678 | 1727 | } |
| 1679 | 1728 | } |
| 1680 | - if( !vAttrDidAppend ) { | |
| 1681 | - endAutoParagraph(p); | |
| 1729 | + endAutoParagraph(p); | |
| 1730 | + if( zClass==0 ){ | |
| 1682 | 1731 | blob_append_string(p->pOut, "<pre class='verbatim'>"); |
| 1732 | + }else if( strncmp(zClass,"pikchr",6)==0 && | |
| 1733 | + (fossil_isspace(zClass[6]) || zClass[6]==0) ){ | |
| 1734 | + n += wiki_process_pikchr(p, z+n, zClass); | |
| 1735 | + p->inVerbatim = 0; | |
| 1736 | + p->state = p->preVerbState; | |
| 1737 | + }else{ | |
| 1738 | + blob_appendf(p->pOut, "<pre name='code' class='%h'>", | |
| 1739 | + zClass); | |
| 1683 | 1740 | } |
| 1684 | 1741 | p->wantAutoParagraph = 0; |
| 1685 | 1742 | }else |
| 1686 | 1743 | if( markup.iType==MUTYPE_LI ){ |
| 1687 | 1744 | if( backupToType(p, MUTYPE_LIST)==0 ){ |
| 1688 | 1745 |
| --- src/wikiformat.c | |
| +++ src/wikiformat.c | |
| @@ -1358,10 +1358,60 @@ | |
| 1358 | if( p->zVerbatimId==0 ) return 1; |
| 1359 | if( pMarkup->nAttr!=1 ) return 0; |
| 1360 | z = pMarkup->aAttr[0].zValue; |
| 1361 | return fossil_strcmp(z, p->zVerbatimId)==0; |
| 1362 | } |
| 1363 | |
| 1364 | /* |
| 1365 | ** Return the MUTYPE for the top of the stack. |
| 1366 | */ |
| 1367 | static int stackTopType(Renderer *p){ |
| @@ -1658,30 +1708,37 @@ | |
| 1658 | /* Enter <verbatim> processing. With verbatim enabled, all other |
| 1659 | ** markup other than the corresponding end-tag with the same ID is |
| 1660 | ** ignored. |
| 1661 | */ |
| 1662 | if( markup.iCode==MARKUP_VERBATIM ){ |
| 1663 | int ii, vAttrDidAppend=0; |
| 1664 | p->zVerbatimId = 0; |
| 1665 | p->inVerbatim = 1; |
| 1666 | p->preVerbState = p->state; |
| 1667 | p->state &= ~ALLOW_WIKI; |
| 1668 | for(ii=0; ii<markup.nAttr; ii++){ |
| 1669 | if( markup.aAttr[ii].iACode == ATTR_ID ){ |
| 1670 | p->zVerbatimId = markup.aAttr[ii].zValue; |
| 1671 | }else if( markup.aAttr[ii].iACode==ATTR_TYPE ){ |
| 1672 | blob_appendf(p->pOut, "<pre name='code' class='%s'>", |
| 1673 | markup.aAttr[ii].zValue); |
| 1674 | vAttrDidAppend=1; |
| 1675 | }else if( markup.aAttr[ii].iACode==ATTR_LINKS |
| 1676 | && !is_false(markup.aAttr[ii].zValue) ){ |
| 1677 | p->state |= ALLOW_LINKS; |
| 1678 | } |
| 1679 | } |
| 1680 | if( !vAttrDidAppend ) { |
| 1681 | endAutoParagraph(p); |
| 1682 | blob_append_string(p->pOut, "<pre class='verbatim'>"); |
| 1683 | } |
| 1684 | p->wantAutoParagraph = 0; |
| 1685 | }else |
| 1686 | if( markup.iType==MUTYPE_LI ){ |
| 1687 | if( backupToType(p, MUTYPE_LIST)==0 ){ |
| 1688 |
| --- src/wikiformat.c | |
| +++ src/wikiformat.c | |
| @@ -1358,10 +1358,60 @@ | |
| 1358 | if( p->zVerbatimId==0 ) return 1; |
| 1359 | if( pMarkup->nAttr!=1 ) return 0; |
| 1360 | z = pMarkup->aAttr[0].zValue; |
| 1361 | return fossil_strcmp(z, p->zVerbatimId)==0; |
| 1362 | } |
| 1363 | |
| 1364 | /* |
| 1365 | ** z[] points to the text that immediately follows markup of the form: |
| 1366 | ** |
| 1367 | ** <verbatim type='pikchr ...'> |
| 1368 | ** |
| 1369 | ** zClass is the argument to "type". This routine will process the |
| 1370 | ** Pikchr text through the next matching </verbatim> (or until end-of-file) |
| 1371 | ** and append the resulting SVG output onto p. It then returns the |
| 1372 | ** number of bytes of text processed, including the closing </verbatim>. |
| 1373 | */ |
| 1374 | static int wiki_process_pikchr(Renderer *p, char *z, const char *zClass){ |
| 1375 | ParsedMarkup m; /* Parsed closing tag */ |
| 1376 | int i = 0; /* For looping over z[] in search of </verbatim> */ |
| 1377 | int iRet = 0; /* Value to return */ |
| 1378 | int atEnd = 0; /* True if se have found the </verbatim> */ |
| 1379 | int nMarkup = 0; /* Length of a markup we are checking */ |
| 1380 | |
| 1381 | /* Search for the closing </verbatim> tag */ |
| 1382 | while( z[i]!=0 ){ |
| 1383 | char *zEnd = strchr(z+i, '<'); |
| 1384 | if( zEnd==0 ){ |
| 1385 | i += (int)strlen(z+i); |
| 1386 | iRet = i; |
| 1387 | break; |
| 1388 | } |
| 1389 | nMarkup = html_tag_length(zEnd); |
| 1390 | if( nMarkup<11 || fossil_strnicmp(zEnd, "</verbatim", 10)!=0 ){ |
| 1391 | i = (int)(zEnd - z) + 1; |
| 1392 | continue; |
| 1393 | } |
| 1394 | (void)parseMarkup(&m, z+i); |
| 1395 | atEnd = endVerbatim(p, &m); |
| 1396 | unparseMarkup(&m); |
| 1397 | if( atEnd ){ |
| 1398 | iRet = i + nMarkup; |
| 1399 | break; |
| 1400 | } |
| 1401 | i++; |
| 1402 | } |
| 1403 | |
| 1404 | /* The Pikchr source text should be i character in length and iRet is |
| 1405 | ** i plus the number of bytes in the </verbatim>. Generate the reply. |
| 1406 | */ |
| 1407 | assert( strncmp(zClass,"pikchr",6)==0 ); |
| 1408 | zClass += 6; |
| 1409 | while( fossil_isspace(zClass[0]) ) zClass++; |
| 1410 | pikchr_to_html(p->pOut, z, i, zClass, (int)strlen(zClass)); |
| 1411 | return iRet; |
| 1412 | } |
| 1413 | |
| 1414 | /* |
| 1415 | ** Return the MUTYPE for the top of the stack. |
| 1416 | */ |
| 1417 | static int stackTopType(Renderer *p){ |
| @@ -1658,30 +1708,37 @@ | |
| 1708 | /* Enter <verbatim> processing. With verbatim enabled, all other |
| 1709 | ** markup other than the corresponding end-tag with the same ID is |
| 1710 | ** ignored. |
| 1711 | */ |
| 1712 | if( markup.iCode==MARKUP_VERBATIM ){ |
| 1713 | int ii; //, vAttrDidAppend=0; |
| 1714 | const char *zClass = 0; |
| 1715 | p->zVerbatimId = 0; |
| 1716 | p->inVerbatim = 1; |
| 1717 | p->preVerbState = p->state; |
| 1718 | p->state &= ~ALLOW_WIKI; |
| 1719 | for(ii=0; ii<markup.nAttr; ii++){ |
| 1720 | if( markup.aAttr[ii].iACode == ATTR_ID ){ |
| 1721 | p->zVerbatimId = markup.aAttr[ii].zValue; |
| 1722 | }else if( markup.aAttr[ii].iACode==ATTR_TYPE ){ |
| 1723 | zClass = markup.aAttr[ii].zValue; |
| 1724 | }else if( markup.aAttr[ii].iACode==ATTR_LINKS |
| 1725 | && !is_false(markup.aAttr[ii].zValue) ){ |
| 1726 | p->state |= ALLOW_LINKS; |
| 1727 | } |
| 1728 | } |
| 1729 | endAutoParagraph(p); |
| 1730 | if( zClass==0 ){ |
| 1731 | blob_append_string(p->pOut, "<pre class='verbatim'>"); |
| 1732 | }else if( strncmp(zClass,"pikchr",6)==0 && |
| 1733 | (fossil_isspace(zClass[6]) || zClass[6]==0) ){ |
| 1734 | n += wiki_process_pikchr(p, z+n, zClass); |
| 1735 | p->inVerbatim = 0; |
| 1736 | p->state = p->preVerbState; |
| 1737 | }else{ |
| 1738 | blob_appendf(p->pOut, "<pre name='code' class='%h'>", |
| 1739 | zClass); |
| 1740 | } |
| 1741 | p->wantAutoParagraph = 0; |
| 1742 | }else |
| 1743 | if( markup.iType==MUTYPE_LI ){ |
| 1744 | if( backupToType(p, MUTYPE_LIST)==0 ){ |
| 1745 |
+16
-5
| --- test/th1.test | ||
| +++ test/th1.test | ||
| @@ -771,10 +771,21 @@ | ||
| 771 | 771 | ------------------- END TRACE LOG -------------------}} |
| 772 | 772 | } |
| 773 | 773 | |
| 774 | 774 | ############################################################################### |
| 775 | 775 | |
| 776 | +fossil test-th-eval "defHeader {Page Title Here}" | |
| 777 | +test th1-defHeader-1 {$RESULT eq \ | |
| 778 | + {TH_ERROR: wrong # args: should be "defHeader"}} | |
| 779 | + | |
| 780 | +############################################################################### | |
| 781 | + | |
| 782 | +fossil test-th-eval "defHeader" | |
| 783 | +test th1-defHeader-2 {[string match *<body> [normalize_result]]} | |
| 784 | + | |
| 785 | +############################################################################### | |
| 786 | + | |
| 776 | 787 | fossil test-th-eval "styleHeader {Page Title Here}" |
| 777 | 788 | test th1-header-1 {$RESULT eq {TH_ERROR: repository unavailable}} |
| 778 | 789 | |
| 779 | 790 | ############################################################################### |
| 780 | 791 | |
| @@ -1036,15 +1047,15 @@ | ||
| 1036 | 1047 | # |
| 1037 | 1048 | fossil test-th-eval "info commands" |
| 1038 | 1049 | set sorted_result [lsort $RESULT] |
| 1039 | 1050 | protOut "Sorted: $sorted_result" |
| 1040 | 1051 | set base_commands {anoncap anycap array artifact break breakpoint catch\ |
| 1041 | - cgiHeaderLine checkout combobox continue copybtn date decorate dir \ | |
| 1042 | - enable_output encode64 error expr for getParameter glob_match \ | |
| 1043 | - globalState hascap hasfeature html htmlize http httpize if info \ | |
| 1044 | - insertCsrf lindex linecount list llength lsearch markdown nonce proc \ | |
| 1045 | - puts query randhex redirect regexp reinitialize rename render \ | |
| 1052 | + cgiHeaderLine checkout combobox continue copybtn date decorate \ | |
| 1053 | + defHeader dir enable_output encode64 error expr for getParameter \ | |
| 1054 | + glob_match globalState hascap hasfeature html htmlize http httpize if \ | |
| 1055 | + info insertCsrf lindex linecount list llength lsearch markdown nonce \ | |
| 1056 | + proc puts query randhex redirect regexp reinitialize rename render \ | |
| 1046 | 1057 | repository return searchable set setParameter setting stime string \ |
| 1047 | 1058 | styleFooter styleHeader styleScript tclReady trace unset unversioned \ |
| 1048 | 1059 | uplevel upvar utime verifyCsrf verifyLogin wiki} |
| 1049 | 1060 | set tcl_commands {tclEval tclExpr tclInvoke tclIsSafe tclMakeSafe} |
| 1050 | 1061 | if {$th1Tcl} { |
| 1051 | 1062 |
| --- test/th1.test | |
| +++ test/th1.test | |
| @@ -771,10 +771,21 @@ | |
| 771 | ------------------- END TRACE LOG -------------------}} |
| 772 | } |
| 773 | |
| 774 | ############################################################################### |
| 775 | |
| 776 | fossil test-th-eval "styleHeader {Page Title Here}" |
| 777 | test th1-header-1 {$RESULT eq {TH_ERROR: repository unavailable}} |
| 778 | |
| 779 | ############################################################################### |
| 780 | |
| @@ -1036,15 +1047,15 @@ | |
| 1036 | # |
| 1037 | fossil test-th-eval "info commands" |
| 1038 | set sorted_result [lsort $RESULT] |
| 1039 | protOut "Sorted: $sorted_result" |
| 1040 | set base_commands {anoncap anycap array artifact break breakpoint catch\ |
| 1041 | cgiHeaderLine checkout combobox continue copybtn date decorate dir \ |
| 1042 | enable_output encode64 error expr for getParameter glob_match \ |
| 1043 | globalState hascap hasfeature html htmlize http httpize if info \ |
| 1044 | insertCsrf lindex linecount list llength lsearch markdown nonce proc \ |
| 1045 | puts query randhex redirect regexp reinitialize rename render \ |
| 1046 | repository return searchable set setParameter setting stime string \ |
| 1047 | styleFooter styleHeader styleScript tclReady trace unset unversioned \ |
| 1048 | uplevel upvar utime verifyCsrf verifyLogin wiki} |
| 1049 | set tcl_commands {tclEval tclExpr tclInvoke tclIsSafe tclMakeSafe} |
| 1050 | if {$th1Tcl} { |
| 1051 |
| --- test/th1.test | |
| +++ test/th1.test | |
| @@ -771,10 +771,21 @@ | |
| 771 | ------------------- END TRACE LOG -------------------}} |
| 772 | } |
| 773 | |
| 774 | ############################################################################### |
| 775 | |
| 776 | fossil test-th-eval "defHeader {Page Title Here}" |
| 777 | test th1-defHeader-1 {$RESULT eq \ |
| 778 | {TH_ERROR: wrong # args: should be "defHeader"}} |
| 779 | |
| 780 | ############################################################################### |
| 781 | |
| 782 | fossil test-th-eval "defHeader" |
| 783 | test th1-defHeader-2 {[string match *<body> [normalize_result]]} |
| 784 | |
| 785 | ############################################################################### |
| 786 | |
| 787 | fossil test-th-eval "styleHeader {Page Title Here}" |
| 788 | test th1-header-1 {$RESULT eq {TH_ERROR: repository unavailable}} |
| 789 | |
| 790 | ############################################################################### |
| 791 | |
| @@ -1036,15 +1047,15 @@ | |
| 1047 | # |
| 1048 | fossil test-th-eval "info commands" |
| 1049 | set sorted_result [lsort $RESULT] |
| 1050 | protOut "Sorted: $sorted_result" |
| 1051 | set base_commands {anoncap anycap array artifact break breakpoint catch\ |
| 1052 | cgiHeaderLine checkout combobox continue copybtn date decorate \ |
| 1053 | defHeader dir enable_output encode64 error expr for getParameter \ |
| 1054 | glob_match globalState hascap hasfeature html htmlize http httpize if \ |
| 1055 | info insertCsrf lindex linecount list llength lsearch markdown nonce \ |
| 1056 | proc puts query randhex redirect regexp reinitialize rename render \ |
| 1057 | repository return searchable set setParameter setting stime string \ |
| 1058 | styleFooter styleHeader styleScript tclReady trace unset unversioned \ |
| 1059 | uplevel upvar utime verifyCsrf verifyLogin wiki} |
| 1060 | set tcl_commands {tclEval tclExpr tclInvoke tclIsSafe tclMakeSafe} |
| 1061 | if {$th1Tcl} { |
| 1062 |
+8
| --- www/th1.md | ||
| +++ www/th1.md | ||
| @@ -173,10 +173,11 @@ | ||
| 173 | 173 | * checkout |
| 174 | 174 | * combobox |
| 175 | 175 | * copybtn |
| 176 | 176 | * date |
| 177 | 177 | * decorate |
| 178 | + * defHeader | |
| 178 | 179 | * dir |
| 179 | 180 | * enable\_output |
| 180 | 181 | * encode64 |
| 181 | 182 | * getParameter |
| 182 | 183 | * glob\_match |
| @@ -316,10 +317,17 @@ | ||
| 316 | 317 | |
| 317 | 318 | * decorate STRING |
| 318 | 319 | |
| 319 | 320 | Renders STRING as wiki content; however, only links are handled. No |
| 320 | 321 | other markup is processed. |
| 322 | + | |
| 323 | +<a name="defHeader"></a>TH1 defHeader Command | |
| 324 | +--------------------------------------------- | |
| 325 | + | |
| 326 | + * defHeader | |
| 327 | + | |
| 328 | +Returns the default page header. | |
| 321 | 329 | |
| 322 | 330 | <a name="dir"></a>TH1 dir Command |
| 323 | 331 | --------------------------------- |
| 324 | 332 | |
| 325 | 333 | * dir CHECKIN ?GLOB? ?DETAILS? |
| 326 | 334 |
| --- www/th1.md | |
| +++ www/th1.md | |
| @@ -173,10 +173,11 @@ | |
| 173 | * checkout |
| 174 | * combobox |
| 175 | * copybtn |
| 176 | * date |
| 177 | * decorate |
| 178 | * dir |
| 179 | * enable\_output |
| 180 | * encode64 |
| 181 | * getParameter |
| 182 | * glob\_match |
| @@ -316,10 +317,17 @@ | |
| 316 | |
| 317 | * decorate STRING |
| 318 | |
| 319 | Renders STRING as wiki content; however, only links are handled. No |
| 320 | other markup is processed. |
| 321 | |
| 322 | <a name="dir"></a>TH1 dir Command |
| 323 | --------------------------------- |
| 324 | |
| 325 | * dir CHECKIN ?GLOB? ?DETAILS? |
| 326 |
| --- www/th1.md | |
| +++ www/th1.md | |
| @@ -173,10 +173,11 @@ | |
| 173 | * checkout |
| 174 | * combobox |
| 175 | * copybtn |
| 176 | * date |
| 177 | * decorate |
| 178 | * defHeader |
| 179 | * dir |
| 180 | * enable\_output |
| 181 | * encode64 |
| 182 | * getParameter |
| 183 | * glob\_match |
| @@ -316,10 +317,17 @@ | |
| 317 | |
| 318 | * decorate STRING |
| 319 | |
| 320 | Renders STRING as wiki content; however, only links are handled. No |
| 321 | other markup is processed. |
| 322 | |
| 323 | <a name="defHeader"></a>TH1 defHeader Command |
| 324 | --------------------------------------------- |
| 325 | |
| 326 | * defHeader |
| 327 | |
| 328 | Returns the default page header. |
| 329 | |
| 330 | <a name="dir"></a>TH1 dir Command |
| 331 | --------------------------------- |
| 332 | |
| 333 | * dir CHECKIN ?GLOB? ?DETAILS? |
| 334 |