Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Delete the timeline-block-markup setting, and all the complication that goes with it. Due to a bug introduced on 2020-06-02, Fossil has behaved as if that setting where always "on", regardless of its actual value, and nobody has complained. Hence, we surmise that the setting is not needed. Ref: [forum:/forumpost/9adfe7e46b2441ae|forum post 9adfe7e46b2] |
|---|---|
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
0432c38df681ecc0b2442108666a03de |
| User & Date: | drh 2025-03-22 10:38:36.034 |
Context
|
2025-03-22
| ||
| 11:08 | The <mark> HTML tag flows through to the output in html_to_plaintext() if the output is not going to a VT-100 terminal. check-in: a980566991 user: drh tags: trunk | |
| 10:38 | Delete the timeline-block-markup setting, and all the complication that goes with it. Due to a bug introduced on 2020-06-02, Fossil has behaved as if that setting where always "on", regardless of its actual value, and nobody has complained. Hence, we surmise that the setting is not needed. Ref: [forum:/forumpost/9adfe7e... check-in: 0432c38df6 user: drh tags: trunk | |
| 09:38 | Simplify the verify-comments setting to have just "on", "off", and "preview" options. Rename the function that implements this feature to "verify_comment()". Reimplement that function so that it uses the new error reporting mechanism in wiki_convert(). check-in: 072125b0ec user: drh tags: trunk | |
Changes
Changes to src/configure.c.
| ︙ | ︙ | |||
98 99 100 101 102 103 104 |
{ "default-skin", CONFIGSET_SKIN },
{ "logo-mimetype", CONFIGSET_SKIN },
{ "logo-image", CONFIGSET_SKIN },
{ "background-mimetype", CONFIGSET_SKIN },
{ "background-image", CONFIGSET_SKIN },
{ "icon-mimetype", CONFIGSET_SKIN },
{ "icon-image", CONFIGSET_SKIN },
| < | 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
{ "default-skin", CONFIGSET_SKIN },
{ "logo-mimetype", CONFIGSET_SKIN },
{ "logo-image", CONFIGSET_SKIN },
{ "background-mimetype", CONFIGSET_SKIN },
{ "background-image", CONFIGSET_SKIN },
{ "icon-mimetype", CONFIGSET_SKIN },
{ "icon-image", CONFIGSET_SKIN },
{ "timeline-date-format", CONFIGSET_SKIN },
{ "timeline-default-style", CONFIGSET_SKIN },
{ "timeline-dwelltime", CONFIGSET_SKIN },
{ "timeline-closetime", CONFIGSET_SKIN },
{ "timeline-hard-newlines", CONFIGSET_SKIN },
{ "timeline-max-comment", CONFIGSET_SKIN },
{ "timeline-plaintext", CONFIGSET_SKIN },
|
| ︙ | ︙ |
Changes to src/json_config.c.
| ︙ | ︙ | |||
84 85 86 87 88 89 90 |
{ "default-skin", CONFIGSET_SKIN },
{ "logo-mimetype", CONFIGSET_SKIN },
{ "logo-image", CONFIGSET_SKIN },
{ "background-mimetype", CONFIGSET_SKIN },
{ "background-image", CONFIGSET_SKIN },
{ "icon-mimetype", CONFIGSET_SKIN },
{ "icon-image", CONFIGSET_SKIN },
| < | 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
{ "default-skin", CONFIGSET_SKIN },
{ "logo-mimetype", CONFIGSET_SKIN },
{ "logo-image", CONFIGSET_SKIN },
{ "background-mimetype", CONFIGSET_SKIN },
{ "background-image", CONFIGSET_SKIN },
{ "icon-mimetype", CONFIGSET_SKIN },
{ "icon-image", CONFIGSET_SKIN },
{ "timeline-date-format", CONFIGSET_SKIN },
{ "timeline-default-style", CONFIGSET_SKIN },
{ "timeline-dwelltime", CONFIGSET_SKIN },
{ "timeline-closetime", CONFIGSET_SKIN },
{ "timeline-hard-newlines", CONFIGSET_SKIN },
{ "timeline-max-comment", CONFIGSET_SKIN },
{ "timeline-plaintext", CONFIGSET_SKIN },
|
| ︙ | ︙ |
Changes to src/printf.c.
| ︙ | ︙ | |||
246 247 248 249 250 251 252 | ** SETTING: timeline-plaintext boolean default=off ** ** If enabled, no wiki-formatting is done for timeline comment messages. ** Hyperlinks are activated, but they show up on screen using the ** complete input text, not just the display text. No other formatting ** is done. */ | < < < < < < < < | > | < > > > < | < < < < < < < < | < | 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 |
** SETTING: timeline-plaintext boolean default=off
**
** If enabled, no wiki-formatting is done for timeline comment messages.
** Hyperlinks are activated, but they show up on screen using the
** complete input text, not just the display text. No other formatting
** is done.
*/
/*
** SETTING: timeline-hard-newlines boolean default=off
**
** If enabled, the timeline honors newline characters in check-in comments.
** In other words, newlines are coverted into <br> for HTML display.
** The default behavior, when this setting is off, is that newlines are
** treated like any other whitespace character.
*/
/*
** Return an appropriate set of flags for wiki_convert() for displaying
** comments on a timeline. These flag settings are determined by
** configuration parameters.
**
** The altForm2 argument is true for "%!W" (with the "!" alternate-form-2
** flags) and is false for plain "%W". The ! flag indicates that the
** formatting is for display of a check-in comment on the timeline. Such
** comments used to be renderedd differently, but ever since 2020, they
** have been rendered identially, so the ! flag does not make any different
** in the output any more.
*/
int wiki_convert_flags(int altForm2){
static int wikiFlags = 0;
(void)altForm2;
if( wikiFlags==0 ){
wikiFlags = WIKI_INLINE | WIKI_NOBADLINKS;
if( db_get_boolean("timeline-plaintext", 0) ){
wikiFlags |= WIKI_LINKSONLY;
}
if( db_get_boolean("timeline-hard-newlines", 0) ){
wikiFlags |= WIKI_NEWLINE;
}
}
return wikiFlags;
}
/*
** The root program. All variations call this core.
**
|
| ︙ | ︙ |
Changes to src/setup.c.
| ︙ | ︙ | |||
979 980 981 982 983 984 985 |
style_set_current_feature("setup");
style_header("Timeline Display Preferences");
db_begin_transaction();
@ <form action="%R/setup_timeline" method="post"><div>
login_insert_csrf_secret();
@ <p><input type="submit" name="submit" value="Apply Changes"></p>
| < < < < < < < | 979 980 981 982 983 984 985 986 987 988 989 990 991 992 |
style_set_current_feature("setup");
style_header("Timeline Display Preferences");
db_begin_transaction();
@ <form action="%R/setup_timeline" method="post"><div>
login_insert_csrf_secret();
@ <p><input type="submit" name="submit" value="Apply Changes"></p>
@ <hr>
onoff_attribute("Plaintext comments on timelines",
"timeline-plaintext", "tpt", 0, 0);
@ <p>In timeline displays, check-in comments are displayed literally,
@ without any wiki or HTML interpretation. Use CSS to change
@ display formatting features such as fonts and line-wrapping behavior.
@ (Property: "timeline-plaintext")</p>
|
| ︙ | ︙ |
Changes to src/wikiformat.c.
| ︙ | ︙ | |||
23 24 25 26 27 28 29 | #if INTERFACE /* ** Allowed wiki transformation operations */ #define WIKI_HTMLONLY 0x0001 /* HTML markup only. No wiki */ #define WIKI_INLINE 0x0002 /* Do not surround with <p>..</p> */ | | | 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | #if INTERFACE /* ** Allowed wiki transformation operations */ #define WIKI_HTMLONLY 0x0001 /* HTML markup only. No wiki */ #define WIKI_INLINE 0x0002 /* Do not surround with <p>..</p> */ /* avalable for reuse: 0x0004 --- formerly WIKI_NOBLOCK */ #define WIKI_BUTTONS 0x0008 /* Allow sub-menu buttons */ #define WIKI_NOBADLINKS 0x0010 /* Ignore broken hyperlinks */ #define WIKI_LINKSONLY 0x0020 /* No markup. Only decorate links */ #define WIKI_NEWLINE 0x0040 /* Honor \n - break lines at each \n */ #define WIKI_MARKDOWNLINKS 0x0080 /* Resolve hyperlinks as in markdown */ #define WIKI_SAFE 0x0100 /* Make the result safe for embedding */ #define WIKI_TARGET_BLANK 0x0200 /* Hyperlinks go to a new window */ |
| ︙ | ︙ | |||
463 464 465 466 467 468 469 | ** State flags. Save the lower 16 bits for the WIKI_* flags. */ #define AT_NEWLINE 0x0010000 /* At start of a line */ #define AT_PARAGRAPH 0x0020000 /* At start of a paragraph */ #define ALLOW_WIKI 0x0040000 /* Allow wiki markup */ #define ALLOW_LINKS 0x0080000 /* Allow [...] hyperlinks */ #define FONT_MARKUP_ONLY 0x0100000 /* Only allow MUTYPE_FONT markup */ | < | | 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 |
** State flags. Save the lower 16 bits for the WIKI_* flags.
*/
#define AT_NEWLINE 0x0010000 /* At start of a line */
#define AT_PARAGRAPH 0x0020000 /* At start of a paragraph */
#define ALLOW_WIKI 0x0040000 /* Allow wiki markup */
#define ALLOW_LINKS 0x0080000 /* Allow [...] hyperlinks */
#define FONT_MARKUP_ONLY 0x0100000 /* Only allow MUTYPE_FONT markup */
#define IN_LIST 0x0200000 /* Within wiki <ul> or <ol> */
/*
** Current state of the rendering engine
*/
typedef struct Renderer Renderer;
struct Renderer {
Blob *pOut; /* Output appended to this blob */
|
| ︙ | ︙ | |||
1524 1525 1526 1527 1528 1529 1530 |
**
** This routine will probably modify the content of z[].
*/
static void wiki_render(Renderer *p, char *z){
int tokenType;
ParsedMarkup markup;
int n;
| < < < < < | | | | | | | < < < < | | | | | | | | | | | | | < < < < | | | | | | | | | | | | | < < < < | | | | | | | | | | | | | < < | | | | | < | 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 |
**
** This routine will probably modify the content of z[].
*/
static void wiki_render(Renderer *p, char *z){
int tokenType;
ParsedMarkup markup;
int n;
int wikiHtmlOnly = (p->state & (WIKI_HTMLONLY | WIKI_LINKSONLY))!=0;
int linksOnly = (p->state & WIKI_LINKSONLY)!=0;
char *zOrig = z;
/* Make sure the attribute constants and names still align
** following changes in the attribute list. */
assert( fossil_strcmp(aAttribute[ATTR_WIDTH].zName, "width")==0 );
while( z[0] ){
if( wikiHtmlOnly ){
n = nextRawToken(z, p, &tokenType);
}else{
n = nextWikiToken(z, p, &tokenType);
}
p->state &= ~(AT_NEWLINE|AT_PARAGRAPH);
switch( tokenType ){
case TOKEN_PARAGRAPH: {
if( p->wikiList ){
popStackToTag(p, p->wikiList);
p->wikiList = 0;
}
endAutoParagraph(p);
blob_append_string(p->pOut, "\n\n");
p->wantAutoParagraph = 1;
p->state |= AT_PARAGRAPH|AT_NEWLINE;
break;
}
case TOKEN_NEWLINE: {
if( p->renderFlags & WIKI_NEWLINE ){
blob_append_string(p->pOut, "<br>\n");
}else{
blob_append_string(p->pOut, "\n");
}
p->state |= AT_NEWLINE;
break;
}
case TOKEN_BUL_LI: {
p->mRender |= RENDER_BLOCK;
if( p->wikiList!=MARKUP_UL ){
if( p->wikiList ){
popStackToTag(p, p->wikiList);
}
endAutoParagraph(p);
pushStack(p, MARKUP_UL);
blob_append_string(p->pOut, "<ul>");
p->wikiList = MARKUP_UL;
}
popStackToTag(p, MARKUP_LI);
startAutoParagraph(p);
pushStack(p, MARKUP_LI);
blob_append_string(p->pOut, "<li>");
break;
}
case TOKEN_NUM_LI: {
p->mRender |= RENDER_BLOCK;
if( p->wikiList!=MARKUP_OL ){
if( p->wikiList ){
popStackToTag(p, p->wikiList);
}
endAutoParagraph(p);
pushStack(p, MARKUP_OL);
blob_append_string(p->pOut, "<ol>");
p->wikiList = MARKUP_OL;
}
popStackToTag(p, MARKUP_LI);
startAutoParagraph(p);
pushStack(p, MARKUP_LI);
blob_append_string(p->pOut, "<li>");
break;
}
case TOKEN_ENUM: {
p->mRender |= RENDER_BLOCK;
if( p->wikiList!=MARKUP_OL ){
if( p->wikiList ){
popStackToTag(p, p->wikiList);
}
endAutoParagraph(p);
pushStack(p, MARKUP_OL);
blob_append_string(p->pOut, "<ol>");
p->wikiList = MARKUP_OL;
}
popStackToTag(p, MARKUP_LI);
startAutoParagraph(p);
pushStack(p, MARKUP_LI);
blob_appendf(p->pOut, "<li value=\"%d\">", atoi(z));
break;
}
case TOKEN_INDENT: {
p->mRender |= RENDER_BLOCK;
assert( p->wikiList==0 );
pushStack(p, MARKUP_BLOCKQUOTE);
blob_append_string(p->pOut, "<blockquote>");
p->wantAutoParagraph = 0;
p->wikiList = MARKUP_BLOCKQUOTE;
break;
}
case TOKEN_CHARACTER: {
startAutoParagraph(p);
if( p->state & WIKI_MARK ){
blob_append_string(p->pOut, "<mark>");
p->mRender |= RENDER_MARK;
|
| ︙ | ︙ | |||
1808 1809 1810 1811 1812 1813 1814 |
if( markup.endTag ){
p->state |= ALLOW_WIKI;
}else{
p->state &= ~ALLOW_WIKI;
}
}else
| < < < < < < | 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 |
if( markup.endTag ){
p->state |= ALLOW_WIKI;
}else{
p->state &= ~ALLOW_WIKI;
}
}else
/* Generate end-tags */
if( markup.endTag ){
popStackToTag(p, markup.iCode);
}else
/* Push <div> markup onto the stack together with the id=ID attribute.
*/
|
| ︙ | ︙ | |||
2157 2158 2159 2160 2161 2162 2163 |
Backlink *pBklnk, /* Backlink extraction context */
int flags /* wiki parsing flags */
){
Renderer renderer;
int tokenType;
ParsedMarkup markup;
int n;
| < < < < < | 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 |
Backlink *pBklnk, /* Backlink extraction context */
int flags /* wiki parsing flags */
){
Renderer renderer;
int tokenType;
ParsedMarkup markup;
int n;
int wikiHtmlOnly = 0;
memset(&renderer, 0, sizeof(renderer));
renderer.state = ALLOW_WIKI|AT_NEWLINE|AT_PARAGRAPH;
if( wikiUsesHtml() ){
renderer.state |= WIKI_HTMLONLY;
wikiHtmlOnly = 1;
}
while( z[0] ){
if( wikiHtmlOnly ){
n = nextRawToken(z, &renderer, &tokenType);
}else{
n = nextWikiToken(z, &renderer, &tokenType);
}
|
| ︙ | ︙ | |||
2250 2251 2252 2253 2254 2255 2256 |
if( markup.endTag ){
renderer.state |= ALLOW_WIKI;
}else{
renderer.state &= ~ALLOW_WIKI;
}
}else
| < < < < < < | 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 |
if( markup.endTag ){
renderer.state |= ALLOW_WIKI;
}else{
renderer.state &= ~ALLOW_WIKI;
}
}else
/* Generate end-tags */
if( markup.endTag ){
popStackToTag(&renderer, markup.iCode);
}else
/* Push <div> markup onto the stack together with the id=ID attribute.
*/
|
| ︙ | ︙ |