| | @@ -369,10 +369,23 @@ |
| 369 | 369 | short allowWiki; /* ALLOW_WIKI if wiki allowed before tag */ |
| 370 | 370 | const char *zId; /* ID attribute or NULL */ |
| 371 | 371 | } *aStack; |
| 372 | 372 | }; |
| 373 | 373 | |
| 374 | +/* |
| 375 | +** Return TRUE if HTML should be used as the sole markup language for wiki. |
| 376 | +** |
| 377 | +** On first invocation, this routine consults the "wiki-use-html" setting. |
| 378 | +** It caches the result for subsequent invocations, under the assumption |
| 379 | +** that the setting will not change. |
| 380 | +*/ |
| 381 | +static int wikiUsesHtml(void){ |
| 382 | + static int r = -1; |
| 383 | + if( r<0 ) r = db_get_boolean("wiki-use-html", 0); |
| 384 | + return r; |
| 385 | +} |
| 386 | + |
| 374 | 387 | |
| 375 | 388 | /* |
| 376 | 389 | ** z points to a "<" character. Check to see if this is the start of |
| 377 | 390 | ** a valid markup. If it is, return the total number of characters in |
| 378 | 391 | ** the markup including the initial "<" and the terminating ">". If |
| | @@ -1390,11 +1403,11 @@ |
| 1390 | 1403 | if( flags & WIKI_INLINE ){ |
| 1391 | 1404 | renderer.wantAutoParagraph = 0; |
| 1392 | 1405 | }else{ |
| 1393 | 1406 | renderer.wantAutoParagraph = 1; |
| 1394 | 1407 | } |
| 1395 | | - if( db_get_int("wiki-use-html", 0) ){ |
| 1408 | + if( wikiUsesHtml() ){ |
| 1396 | 1409 | renderer.state |= WIKI_USE_HTML; |
| 1397 | 1410 | } |
| 1398 | 1411 | if( pOut ){ |
| 1399 | 1412 | renderer.pOut = pOut; |
| 1400 | 1413 | }else{ |
| | @@ -1477,11 +1490,11 @@ |
| 1477 | 1490 | memset(&renderer, 0, sizeof(renderer)); |
| 1478 | 1491 | renderer.state = ALLOW_WIKI|AT_NEWLINE|AT_PARAGRAPH; |
| 1479 | 1492 | if( flags & WIKI_NOBLOCK ){ |
| 1480 | 1493 | renderer.state |= INLINE_MARKUP_ONLY; |
| 1481 | 1494 | } |
| 1482 | | - if( db_get_int("wiki-use-html", 0) ){ |
| 1495 | + if( wikiUsesHtml() ){ |
| 1483 | 1496 | renderer.state |= WIKI_USE_HTML; |
| 1484 | 1497 | wikiUseHtml = 1; |
| 1485 | 1498 | } |
| 1486 | 1499 | inlineOnly = (renderer.state & INLINE_MARKUP_ONLY)!=0; |
| 1487 | 1500 | if( replaceFlag ){ |
| 1488 | 1501 | |