Fossil SCM

Delete the timeline-block-markup setting, and all the complication that goes with it. Due to a bug [/info/2020-06-02T17:38z|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]

drh 2025-03-22 10:38 trunk
Commit 0432c38df681ecc0b2442108666a03de5ef68853af57a21d2db2b897e4c0dc1f
--- src/configure.c
+++ src/configure.c
@@ -100,11 +100,10 @@
100100
{ "logo-image", CONFIGSET_SKIN },
101101
{ "background-mimetype", CONFIGSET_SKIN },
102102
{ "background-image", CONFIGSET_SKIN },
103103
{ "icon-mimetype", CONFIGSET_SKIN },
104104
{ "icon-image", CONFIGSET_SKIN },
105
- { "timeline-block-markup", CONFIGSET_SKIN },
106105
{ "timeline-date-format", CONFIGSET_SKIN },
107106
{ "timeline-default-style", CONFIGSET_SKIN },
108107
{ "timeline-dwelltime", CONFIGSET_SKIN },
109108
{ "timeline-closetime", CONFIGSET_SKIN },
110109
{ "timeline-hard-newlines", CONFIGSET_SKIN },
111110
--- src/configure.c
+++ src/configure.c
@@ -100,11 +100,10 @@
100 { "logo-image", CONFIGSET_SKIN },
101 { "background-mimetype", CONFIGSET_SKIN },
102 { "background-image", CONFIGSET_SKIN },
103 { "icon-mimetype", CONFIGSET_SKIN },
104 { "icon-image", CONFIGSET_SKIN },
105 { "timeline-block-markup", CONFIGSET_SKIN },
106 { "timeline-date-format", CONFIGSET_SKIN },
107 { "timeline-default-style", CONFIGSET_SKIN },
108 { "timeline-dwelltime", CONFIGSET_SKIN },
109 { "timeline-closetime", CONFIGSET_SKIN },
110 { "timeline-hard-newlines", CONFIGSET_SKIN },
111
--- src/configure.c
+++ src/configure.c
@@ -100,11 +100,10 @@
100 { "logo-image", CONFIGSET_SKIN },
101 { "background-mimetype", CONFIGSET_SKIN },
102 { "background-image", CONFIGSET_SKIN },
103 { "icon-mimetype", CONFIGSET_SKIN },
104 { "icon-image", CONFIGSET_SKIN },
 
105 { "timeline-date-format", CONFIGSET_SKIN },
106 { "timeline-default-style", CONFIGSET_SKIN },
107 { "timeline-dwelltime", CONFIGSET_SKIN },
108 { "timeline-closetime", CONFIGSET_SKIN },
109 { "timeline-hard-newlines", CONFIGSET_SKIN },
110
--- src/json_config.c
+++ src/json_config.c
@@ -86,11 +86,10 @@
8686
{ "logo-image", CONFIGSET_SKIN },
8787
{ "background-mimetype", CONFIGSET_SKIN },
8888
{ "background-image", CONFIGSET_SKIN },
8989
{ "icon-mimetype", CONFIGSET_SKIN },
9090
{ "icon-image", CONFIGSET_SKIN },
91
-{ "timeline-block-markup", CONFIGSET_SKIN },
9291
{ "timeline-date-format", CONFIGSET_SKIN },
9392
{ "timeline-default-style", CONFIGSET_SKIN },
9493
{ "timeline-dwelltime", CONFIGSET_SKIN },
9594
{ "timeline-closetime", CONFIGSET_SKIN },
9695
{ "timeline-hard-newlines", CONFIGSET_SKIN },
9796
--- src/json_config.c
+++ src/json_config.c
@@ -86,11 +86,10 @@
86 { "logo-image", CONFIGSET_SKIN },
87 { "background-mimetype", CONFIGSET_SKIN },
88 { "background-image", CONFIGSET_SKIN },
89 { "icon-mimetype", CONFIGSET_SKIN },
90 { "icon-image", CONFIGSET_SKIN },
91 { "timeline-block-markup", CONFIGSET_SKIN },
92 { "timeline-date-format", CONFIGSET_SKIN },
93 { "timeline-default-style", CONFIGSET_SKIN },
94 { "timeline-dwelltime", CONFIGSET_SKIN },
95 { "timeline-closetime", CONFIGSET_SKIN },
96 { "timeline-hard-newlines", CONFIGSET_SKIN },
97
--- src/json_config.c
+++ src/json_config.c
@@ -86,11 +86,10 @@
86 { "logo-image", CONFIGSET_SKIN },
87 { "background-mimetype", CONFIGSET_SKIN },
88 { "background-image", CONFIGSET_SKIN },
89 { "icon-mimetype", CONFIGSET_SKIN },
90 { "icon-image", CONFIGSET_SKIN },
 
91 { "timeline-date-format", CONFIGSET_SKIN },
92 { "timeline-default-style", CONFIGSET_SKIN },
93 { "timeline-dwelltime", CONFIGSET_SKIN },
94 { "timeline-closetime", CONFIGSET_SKIN },
95 { "timeline-hard-newlines", CONFIGSET_SKIN },
96
+8 -23
--- src/printf.c
+++ src/printf.c
@@ -248,18 +248,10 @@
248248
** If enabled, no wiki-formatting is done for timeline comment messages.
249249
** Hyperlinks are activated, but they show up on screen using the
250250
** complete input text, not just the display text. No other formatting
251251
** is done.
252252
*/
253
-/*
254
-** SETTING: timeline-block-markup boolean default=off
255
-**
256
-** If enabled, block markup (paragraph brakes, tables, lists, headings, etc)
257
-** is enabled while rendering check-in comment message on the timeline.
258
-** This is disabled by default, because the timeline works best if the
259
-** check-in comments are short and do not take up too much vertical space.
260
-*/
261253
/*
262254
** SETTING: timeline-hard-newlines boolean default=off
263255
**
264256
** If enabled, the timeline honors newline characters in check-in comments.
265257
** In other words, newlines are coverted into <br> for HTML display.
@@ -271,36 +263,29 @@
271263
** Return an appropriate set of flags for wiki_convert() for displaying
272264
** comments on a timeline. These flag settings are determined by
273265
** configuration parameters.
274266
**
275267
** The altForm2 argument is true for "%!W" (with the "!" alternate-form-2
276
-** flags) and is false for plain "%W". The ! indicates that the text is
277
-** to be rendered on a form rather than the timeline and that block markup
278
-** is acceptable even if the "timeline-block-markup" setting is false.
268
+** flags) and is false for plain "%W". The ! flag indicates that the
269
+** formatting is for display of a check-in comment on the timeline. Such
270
+** comments used to be renderedd differently, but ever since 2020, they
271
+** have been rendered identially, so the ! flag does not make any different
272
+** in the output any more.
279273
*/
280274
int wiki_convert_flags(int altForm2){
281275
static int wikiFlags = 0;
276
+ (void)altForm2;
282277
if( wikiFlags==0 ){
283
- if( db_get_boolean("timeline-block-markup", 0) ){
284
- wikiFlags = WIKI_INLINE | WIKI_NOBADLINKS;
285
- }else{
286
- wikiFlags = WIKI_INLINE | WIKI_NOBLOCK | WIKI_NOBADLINKS;
287
- }
278
+ wikiFlags = WIKI_INLINE | WIKI_NOBADLINKS;
288279
if( db_get_boolean("timeline-plaintext", 0) ){
289280
wikiFlags |= WIKI_LINKSONLY;
290281
}
291282
if( db_get_boolean("timeline-hard-newlines", 0) ){
292283
wikiFlags |= WIKI_NEWLINE;
293284
}
294285
}
295
- if( altForm2 ){
296
- /* block markup (ex: <p>, <table>) allowed */
297
- return wikiFlags & ~WIKI_NOBLOCK;
298
- }else{
299
- /* Do not allow any block format. Everything in a <span> */
300
- return wikiFlags;
301
- }
286
+ return wikiFlags;
302287
}
303288
304289
305290
306291
/*
307292
--- src/printf.c
+++ src/printf.c
@@ -248,18 +248,10 @@
248 ** If enabled, no wiki-formatting is done for timeline comment messages.
249 ** Hyperlinks are activated, but they show up on screen using the
250 ** complete input text, not just the display text. No other formatting
251 ** is done.
252 */
253 /*
254 ** SETTING: timeline-block-markup boolean default=off
255 **
256 ** If enabled, block markup (paragraph brakes, tables, lists, headings, etc)
257 ** is enabled while rendering check-in comment message on the timeline.
258 ** This is disabled by default, because the timeline works best if the
259 ** check-in comments are short and do not take up too much vertical space.
260 */
261 /*
262 ** SETTING: timeline-hard-newlines boolean default=off
263 **
264 ** If enabled, the timeline honors newline characters in check-in comments.
265 ** In other words, newlines are coverted into <br> for HTML display.
@@ -271,36 +263,29 @@
271 ** Return an appropriate set of flags for wiki_convert() for displaying
272 ** comments on a timeline. These flag settings are determined by
273 ** configuration parameters.
274 **
275 ** The altForm2 argument is true for "%!W" (with the "!" alternate-form-2
276 ** flags) and is false for plain "%W". The ! indicates that the text is
277 ** to be rendered on a form rather than the timeline and that block markup
278 ** is acceptable even if the "timeline-block-markup" setting is false.
 
 
279 */
280 int wiki_convert_flags(int altForm2){
281 static int wikiFlags = 0;
 
282 if( wikiFlags==0 ){
283 if( db_get_boolean("timeline-block-markup", 0) ){
284 wikiFlags = WIKI_INLINE | WIKI_NOBADLINKS;
285 }else{
286 wikiFlags = WIKI_INLINE | WIKI_NOBLOCK | WIKI_NOBADLINKS;
287 }
288 if( db_get_boolean("timeline-plaintext", 0) ){
289 wikiFlags |= WIKI_LINKSONLY;
290 }
291 if( db_get_boolean("timeline-hard-newlines", 0) ){
292 wikiFlags |= WIKI_NEWLINE;
293 }
294 }
295 if( altForm2 ){
296 /* block markup (ex: <p>, <table>) allowed */
297 return wikiFlags & ~WIKI_NOBLOCK;
298 }else{
299 /* Do not allow any block format. Everything in a <span> */
300 return wikiFlags;
301 }
302 }
303
304
305
306 /*
307
--- src/printf.c
+++ src/printf.c
@@ -248,18 +248,10 @@
248 ** If enabled, no wiki-formatting is done for timeline comment messages.
249 ** Hyperlinks are activated, but they show up on screen using the
250 ** complete input text, not just the display text. No other formatting
251 ** is done.
252 */
 
 
 
 
 
 
 
 
253 /*
254 ** SETTING: timeline-hard-newlines boolean default=off
255 **
256 ** If enabled, the timeline honors newline characters in check-in comments.
257 ** In other words, newlines are coverted into <br> for HTML display.
@@ -271,36 +263,29 @@
263 ** Return an appropriate set of flags for wiki_convert() for displaying
264 ** comments on a timeline. These flag settings are determined by
265 ** configuration parameters.
266 **
267 ** The altForm2 argument is true for "%!W" (with the "!" alternate-form-2
268 ** flags) and is false for plain "%W". The ! flag indicates that the
269 ** formatting is for display of a check-in comment on the timeline. Such
270 ** comments used to be renderedd differently, but ever since 2020, they
271 ** have been rendered identially, so the ! flag does not make any different
272 ** in the output any more.
273 */
274 int wiki_convert_flags(int altForm2){
275 static int wikiFlags = 0;
276 (void)altForm2;
277 if( wikiFlags==0 ){
278 wikiFlags = WIKI_INLINE | WIKI_NOBADLINKS;
 
 
 
 
279 if( db_get_boolean("timeline-plaintext", 0) ){
280 wikiFlags |= WIKI_LINKSONLY;
281 }
282 if( db_get_boolean("timeline-hard-newlines", 0) ){
283 wikiFlags |= WIKI_NEWLINE;
284 }
285 }
286 return wikiFlags;
 
 
 
 
 
 
287 }
288
289
290
291 /*
292
--- src/setup.c
+++ src/setup.c
@@ -981,17 +981,10 @@
981981
db_begin_transaction();
982982
@ <form action="%R/setup_timeline" method="post"><div>
983983
login_insert_csrf_secret();
984984
@ <p><input type="submit" name="submit" value="Apply Changes"></p>
985985
986
- @ <hr>
987
- onoff_attribute("Allow block-markup in timeline",
988
- "timeline-block-markup", "tbm", 0, 0);
989
- @ <p>In timeline displays, check-in comments can be displayed with or
990
- @ without block markup such as paragraphs, tables, etc.
991
- @ (Property: "timeline-block-markup")</p>
992
-
993986
@ <hr>
994987
onoff_attribute("Plaintext comments on timelines",
995988
"timeline-plaintext", "tpt", 0, 0);
996989
@ <p>In timeline displays, check-in comments are displayed literally,
997990
@ without any wiki or HTML interpretation. Use CSS to change
998991
--- src/setup.c
+++ src/setup.c
@@ -981,17 +981,10 @@
981 db_begin_transaction();
982 @ <form action="%R/setup_timeline" method="post"><div>
983 login_insert_csrf_secret();
984 @ <p><input type="submit" name="submit" value="Apply Changes"></p>
985
986 @ <hr>
987 onoff_attribute("Allow block-markup in timeline",
988 "timeline-block-markup", "tbm", 0, 0);
989 @ <p>In timeline displays, check-in comments can be displayed with or
990 @ without block markup such as paragraphs, tables, etc.
991 @ (Property: "timeline-block-markup")</p>
992
993 @ <hr>
994 onoff_attribute("Plaintext comments on timelines",
995 "timeline-plaintext", "tpt", 0, 0);
996 @ <p>In timeline displays, check-in comments are displayed literally,
997 @ without any wiki or HTML interpretation. Use CSS to change
998
--- src/setup.c
+++ src/setup.c
@@ -981,17 +981,10 @@
981 db_begin_transaction();
982 @ <form action="%R/setup_timeline" method="post"><div>
983 login_insert_csrf_secret();
984 @ <p><input type="submit" name="submit" value="Apply Changes"></p>
985
 
 
 
 
 
 
 
986 @ <hr>
987 onoff_attribute("Plaintext comments on timelines",
988 "timeline-plaintext", "tpt", 0, 0);
989 @ <p>In timeline displays, check-in comments are displayed literally,
990 @ without any wiki or HTML interpretation. Use CSS to change
991
+53 -91
--- src/wikiformat.c
+++ src/wikiformat.c
@@ -25,11 +25,11 @@
2525
/*
2626
** Allowed wiki transformation operations
2727
*/
2828
#define WIKI_HTMLONLY 0x0001 /* HTML markup only. No wiki */
2929
#define WIKI_INLINE 0x0002 /* Do not surround with <p>..</p> */
30
-#define WIKI_NOBLOCK 0x0004 /* No block markup of any kind */
30
+/* avalable for reuse: 0x0004 --- formerly WIKI_NOBLOCK */
3131
#define WIKI_BUTTONS 0x0008 /* Allow sub-menu buttons */
3232
#define WIKI_NOBADLINKS 0x0010 /* Ignore broken hyperlinks */
3333
#define WIKI_LINKSONLY 0x0020 /* No markup. Only decorate links */
3434
#define WIKI_NEWLINE 0x0040 /* Honor \n - break lines at each \n */
3535
#define WIKI_MARKDOWNLINKS 0x0080 /* Resolve hyperlinks as in markdown */
@@ -465,12 +465,11 @@
465465
#define AT_NEWLINE 0x0010000 /* At start of a line */
466466
#define AT_PARAGRAPH 0x0020000 /* At start of a paragraph */
467467
#define ALLOW_WIKI 0x0040000 /* Allow wiki markup */
468468
#define ALLOW_LINKS 0x0080000 /* Allow [...] hyperlinks */
469469
#define FONT_MARKUP_ONLY 0x0100000 /* Only allow MUTYPE_FONT markup */
470
-#define INLINE_MARKUP_ONLY 0x0200000 /* Allow only "inline" markup */
471
-#define IN_LIST 0x0400000 /* Within wiki <ul> or <ol> */
470
+#define IN_LIST 0x0200000 /* Within wiki <ul> or <ol> */
472471
473472
/*
474473
** Current state of the rendering engine
475474
*/
476475
typedef struct Renderer Renderer;
@@ -1526,11 +1525,10 @@
15261525
*/
15271526
static void wiki_render(Renderer *p, char *z){
15281527
int tokenType;
15291528
ParsedMarkup markup;
15301529
int n;
1531
- int inlineOnly = (p->state & INLINE_MARKUP_ONLY)!=0;
15321530
int wikiHtmlOnly = (p->state & (WIKI_HTMLONLY | WIKI_LINKSONLY))!=0;
15331531
int linksOnly = (p->state & WIKI_LINKSONLY)!=0;
15341532
char *zOrig = z;
15351533
15361534
/* Make sure the attribute constants and names still align
@@ -1544,22 +1542,17 @@
15441542
n = nextWikiToken(z, p, &tokenType);
15451543
}
15461544
p->state &= ~(AT_NEWLINE|AT_PARAGRAPH);
15471545
switch( tokenType ){
15481546
case TOKEN_PARAGRAPH: {
1549
- if( inlineOnly ){
1550
- /* blob_append_string(p->pOut, " &para; "); */
1551
- blob_append_string(p->pOut, " &nbsp;&nbsp; ");
1552
- }else{
1553
- if( p->wikiList ){
1554
- popStackToTag(p, p->wikiList);
1555
- p->wikiList = 0;
1556
- }
1557
- endAutoParagraph(p);
1558
- blob_append_string(p->pOut, "\n\n");
1559
- p->wantAutoParagraph = 1;
1560
- }
1547
+ if( p->wikiList ){
1548
+ popStackToTag(p, p->wikiList);
1549
+ p->wikiList = 0;
1550
+ }
1551
+ endAutoParagraph(p);
1552
+ blob_append_string(p->pOut, "\n\n");
1553
+ p->wantAutoParagraph = 1;
15611554
p->state |= AT_PARAGRAPH|AT_NEWLINE;
15621555
break;
15631556
}
15641557
case TOKEN_NEWLINE: {
15651558
if( p->renderFlags & WIKI_NEWLINE ){
@@ -1570,80 +1563,66 @@
15701563
p->state |= AT_NEWLINE;
15711564
break;
15721565
}
15731566
case TOKEN_BUL_LI: {
15741567
p->mRender |= RENDER_BLOCK;
1575
- if( inlineOnly ){
1576
- blob_append_string(p->pOut, " &bull; ");
1577
- }else{
1578
- if( p->wikiList!=MARKUP_UL ){
1579
- if( p->wikiList ){
1580
- popStackToTag(p, p->wikiList);
1581
- }
1582
- endAutoParagraph(p);
1583
- pushStack(p, MARKUP_UL);
1584
- blob_append_string(p->pOut, "<ul>");
1585
- p->wikiList = MARKUP_UL;
1586
- }
1587
- popStackToTag(p, MARKUP_LI);
1588
- startAutoParagraph(p);
1589
- pushStack(p, MARKUP_LI);
1590
- blob_append_string(p->pOut, "<li>");
1591
- }
1568
+ if( p->wikiList!=MARKUP_UL ){
1569
+ if( p->wikiList ){
1570
+ popStackToTag(p, p->wikiList);
1571
+ }
1572
+ endAutoParagraph(p);
1573
+ pushStack(p, MARKUP_UL);
1574
+ blob_append_string(p->pOut, "<ul>");
1575
+ p->wikiList = MARKUP_UL;
1576
+ }
1577
+ popStackToTag(p, MARKUP_LI);
1578
+ startAutoParagraph(p);
1579
+ pushStack(p, MARKUP_LI);
1580
+ blob_append_string(p->pOut, "<li>");
15921581
break;
15931582
}
15941583
case TOKEN_NUM_LI: {
15951584
p->mRender |= RENDER_BLOCK;
1596
- if( inlineOnly ){
1597
- blob_append_string(p->pOut, " # ");
1598
- }else{
1599
- if( p->wikiList!=MARKUP_OL ){
1600
- if( p->wikiList ){
1601
- popStackToTag(p, p->wikiList);
1602
- }
1603
- endAutoParagraph(p);
1604
- pushStack(p, MARKUP_OL);
1605
- blob_append_string(p->pOut, "<ol>");
1606
- p->wikiList = MARKUP_OL;
1607
- }
1608
- popStackToTag(p, MARKUP_LI);
1609
- startAutoParagraph(p);
1610
- pushStack(p, MARKUP_LI);
1611
- blob_append_string(p->pOut, "<li>");
1612
- }
1585
+ if( p->wikiList!=MARKUP_OL ){
1586
+ if( p->wikiList ){
1587
+ popStackToTag(p, p->wikiList);
1588
+ }
1589
+ endAutoParagraph(p);
1590
+ pushStack(p, MARKUP_OL);
1591
+ blob_append_string(p->pOut, "<ol>");
1592
+ p->wikiList = MARKUP_OL;
1593
+ }
1594
+ popStackToTag(p, MARKUP_LI);
1595
+ startAutoParagraph(p);
1596
+ pushStack(p, MARKUP_LI);
1597
+ blob_append_string(p->pOut, "<li>");
16131598
break;
16141599
}
16151600
case TOKEN_ENUM: {
16161601
p->mRender |= RENDER_BLOCK;
1617
- if( inlineOnly ){
1618
- blob_appendf(p->pOut, " (%d) ", atoi(z));
1619
- }else{
1620
- if( p->wikiList!=MARKUP_OL ){
1621
- if( p->wikiList ){
1622
- popStackToTag(p, p->wikiList);
1623
- }
1624
- endAutoParagraph(p);
1625
- pushStack(p, MARKUP_OL);
1626
- blob_append_string(p->pOut, "<ol>");
1627
- p->wikiList = MARKUP_OL;
1628
- }
1629
- popStackToTag(p, MARKUP_LI);
1630
- startAutoParagraph(p);
1631
- pushStack(p, MARKUP_LI);
1632
- blob_appendf(p->pOut, "<li value=\"%d\">", atoi(z));
1633
- }
1602
+ if( p->wikiList!=MARKUP_OL ){
1603
+ if( p->wikiList ){
1604
+ popStackToTag(p, p->wikiList);
1605
+ }
1606
+ endAutoParagraph(p);
1607
+ pushStack(p, MARKUP_OL);
1608
+ blob_append_string(p->pOut, "<ol>");
1609
+ p->wikiList = MARKUP_OL;
1610
+ }
1611
+ popStackToTag(p, MARKUP_LI);
1612
+ startAutoParagraph(p);
1613
+ pushStack(p, MARKUP_LI);
1614
+ blob_appendf(p->pOut, "<li value=\"%d\">", atoi(z));
16341615
break;
16351616
}
16361617
case TOKEN_INDENT: {
16371618
p->mRender |= RENDER_BLOCK;
1638
- if( !inlineOnly ){
1639
- assert( p->wikiList==0 );
1640
- pushStack(p, MARKUP_BLOCKQUOTE);
1641
- blob_append_string(p->pOut, "<blockquote>");
1642
- p->wantAutoParagraph = 0;
1643
- p->wikiList = MARKUP_BLOCKQUOTE;
1644
- }
1619
+ assert( p->wikiList==0 );
1620
+ pushStack(p, MARKUP_BLOCKQUOTE);
1621
+ blob_append_string(p->pOut, "<blockquote>");
1622
+ p->wantAutoParagraph = 0;
1623
+ p->wikiList = MARKUP_BLOCKQUOTE;
16451624
break;
16461625
}
16471626
case TOKEN_CHARACTER: {
16481627
startAutoParagraph(p);
16491628
if( p->state & WIKI_MARK ){
@@ -1810,16 +1789,10 @@
18101789
}else{
18111790
p->state &= ~ALLOW_WIKI;
18121791
}
18131792
}else
18141793
1815
- /* Ignore block markup for in-line rendering.
1816
- */
1817
- if( inlineOnly && (markup.iType&MUTYPE_INLINE)==0 ){
1818
- /* Do nothing */
1819
- }else
1820
-
18211794
/* Generate end-tags */
18221795
if( markup.endTag ){
18231796
popStackToTag(p, markup.iCode);
18241797
}else
18251798
@@ -2159,23 +2132,18 @@
21592132
){
21602133
Renderer renderer;
21612134
int tokenType;
21622135
ParsedMarkup markup;
21632136
int n;
2164
- int inlineOnly;
21652137
int wikiHtmlOnly = 0;
21662138
21672139
memset(&renderer, 0, sizeof(renderer));
21682140
renderer.state = ALLOW_WIKI|AT_NEWLINE|AT_PARAGRAPH;
2169
- if( flags & WIKI_NOBLOCK ){
2170
- renderer.state |= INLINE_MARKUP_ONLY;
2171
- }
21722141
if( wikiUsesHtml() ){
21732142
renderer.state |= WIKI_HTMLONLY;
21742143
wikiHtmlOnly = 1;
21752144
}
2176
- inlineOnly = (renderer.state & INLINE_MARKUP_ONLY)!=0;
21772145
21782146
while( z[0] ){
21792147
if( wikiHtmlOnly ){
21802148
n = nextRawToken(z, &renderer, &tokenType);
21812149
}else{
@@ -2252,16 +2220,10 @@
22522220
}else{
22532221
renderer.state &= ~ALLOW_WIKI;
22542222
}
22552223
}else
22562224
2257
- /* Ignore block markup for in-line rendering.
2258
- */
2259
- if( inlineOnly && (markup.iType&MUTYPE_INLINE)==0 ){
2260
- /* Do nothing */
2261
- }else
2262
-
22632225
/* Generate end-tags */
22642226
if( markup.endTag ){
22652227
popStackToTag(&renderer, markup.iCode);
22662228
}else
22672229
22682230
--- src/wikiformat.c
+++ src/wikiformat.c
@@ -25,11 +25,11 @@
25 /*
26 ** Allowed wiki transformation operations
27 */
28 #define WIKI_HTMLONLY 0x0001 /* HTML markup only. No wiki */
29 #define WIKI_INLINE 0x0002 /* Do not surround with <p>..</p> */
30 #define WIKI_NOBLOCK 0x0004 /* No block markup of any kind */
31 #define WIKI_BUTTONS 0x0008 /* Allow sub-menu buttons */
32 #define WIKI_NOBADLINKS 0x0010 /* Ignore broken hyperlinks */
33 #define WIKI_LINKSONLY 0x0020 /* No markup. Only decorate links */
34 #define WIKI_NEWLINE 0x0040 /* Honor \n - break lines at each \n */
35 #define WIKI_MARKDOWNLINKS 0x0080 /* Resolve hyperlinks as in markdown */
@@ -465,12 +465,11 @@
465 #define AT_NEWLINE 0x0010000 /* At start of a line */
466 #define AT_PARAGRAPH 0x0020000 /* At start of a paragraph */
467 #define ALLOW_WIKI 0x0040000 /* Allow wiki markup */
468 #define ALLOW_LINKS 0x0080000 /* Allow [...] hyperlinks */
469 #define FONT_MARKUP_ONLY 0x0100000 /* Only allow MUTYPE_FONT markup */
470 #define INLINE_MARKUP_ONLY 0x0200000 /* Allow only "inline" markup */
471 #define IN_LIST 0x0400000 /* Within wiki <ul> or <ol> */
472
473 /*
474 ** Current state of the rendering engine
475 */
476 typedef struct Renderer Renderer;
@@ -1526,11 +1525,10 @@
1526 */
1527 static void wiki_render(Renderer *p, char *z){
1528 int tokenType;
1529 ParsedMarkup markup;
1530 int n;
1531 int inlineOnly = (p->state & INLINE_MARKUP_ONLY)!=0;
1532 int wikiHtmlOnly = (p->state & (WIKI_HTMLONLY | WIKI_LINKSONLY))!=0;
1533 int linksOnly = (p->state & WIKI_LINKSONLY)!=0;
1534 char *zOrig = z;
1535
1536 /* Make sure the attribute constants and names still align
@@ -1544,22 +1542,17 @@
1544 n = nextWikiToken(z, p, &tokenType);
1545 }
1546 p->state &= ~(AT_NEWLINE|AT_PARAGRAPH);
1547 switch( tokenType ){
1548 case TOKEN_PARAGRAPH: {
1549 if( inlineOnly ){
1550 /* blob_append_string(p->pOut, " &para; "); */
1551 blob_append_string(p->pOut, " &nbsp;&nbsp; ");
1552 }else{
1553 if( p->wikiList ){
1554 popStackToTag(p, p->wikiList);
1555 p->wikiList = 0;
1556 }
1557 endAutoParagraph(p);
1558 blob_append_string(p->pOut, "\n\n");
1559 p->wantAutoParagraph = 1;
1560 }
1561 p->state |= AT_PARAGRAPH|AT_NEWLINE;
1562 break;
1563 }
1564 case TOKEN_NEWLINE: {
1565 if( p->renderFlags & WIKI_NEWLINE ){
@@ -1570,80 +1563,66 @@
1570 p->state |= AT_NEWLINE;
1571 break;
1572 }
1573 case TOKEN_BUL_LI: {
1574 p->mRender |= RENDER_BLOCK;
1575 if( inlineOnly ){
1576 blob_append_string(p->pOut, " &bull; ");
1577 }else{
1578 if( p->wikiList!=MARKUP_UL ){
1579 if( p->wikiList ){
1580 popStackToTag(p, p->wikiList);
1581 }
1582 endAutoParagraph(p);
1583 pushStack(p, MARKUP_UL);
1584 blob_append_string(p->pOut, "<ul>");
1585 p->wikiList = MARKUP_UL;
1586 }
1587 popStackToTag(p, MARKUP_LI);
1588 startAutoParagraph(p);
1589 pushStack(p, MARKUP_LI);
1590 blob_append_string(p->pOut, "<li>");
1591 }
1592 break;
1593 }
1594 case TOKEN_NUM_LI: {
1595 p->mRender |= RENDER_BLOCK;
1596 if( inlineOnly ){
1597 blob_append_string(p->pOut, " # ");
1598 }else{
1599 if( p->wikiList!=MARKUP_OL ){
1600 if( p->wikiList ){
1601 popStackToTag(p, p->wikiList);
1602 }
1603 endAutoParagraph(p);
1604 pushStack(p, MARKUP_OL);
1605 blob_append_string(p->pOut, "<ol>");
1606 p->wikiList = MARKUP_OL;
1607 }
1608 popStackToTag(p, MARKUP_LI);
1609 startAutoParagraph(p);
1610 pushStack(p, MARKUP_LI);
1611 blob_append_string(p->pOut, "<li>");
1612 }
1613 break;
1614 }
1615 case TOKEN_ENUM: {
1616 p->mRender |= RENDER_BLOCK;
1617 if( inlineOnly ){
1618 blob_appendf(p->pOut, " (%d) ", atoi(z));
1619 }else{
1620 if( p->wikiList!=MARKUP_OL ){
1621 if( p->wikiList ){
1622 popStackToTag(p, p->wikiList);
1623 }
1624 endAutoParagraph(p);
1625 pushStack(p, MARKUP_OL);
1626 blob_append_string(p->pOut, "<ol>");
1627 p->wikiList = MARKUP_OL;
1628 }
1629 popStackToTag(p, MARKUP_LI);
1630 startAutoParagraph(p);
1631 pushStack(p, MARKUP_LI);
1632 blob_appendf(p->pOut, "<li value=\"%d\">", atoi(z));
1633 }
1634 break;
1635 }
1636 case TOKEN_INDENT: {
1637 p->mRender |= RENDER_BLOCK;
1638 if( !inlineOnly ){
1639 assert( p->wikiList==0 );
1640 pushStack(p, MARKUP_BLOCKQUOTE);
1641 blob_append_string(p->pOut, "<blockquote>");
1642 p->wantAutoParagraph = 0;
1643 p->wikiList = MARKUP_BLOCKQUOTE;
1644 }
1645 break;
1646 }
1647 case TOKEN_CHARACTER: {
1648 startAutoParagraph(p);
1649 if( p->state & WIKI_MARK ){
@@ -1810,16 +1789,10 @@
1810 }else{
1811 p->state &= ~ALLOW_WIKI;
1812 }
1813 }else
1814
1815 /* Ignore block markup for in-line rendering.
1816 */
1817 if( inlineOnly && (markup.iType&MUTYPE_INLINE)==0 ){
1818 /* Do nothing */
1819 }else
1820
1821 /* Generate end-tags */
1822 if( markup.endTag ){
1823 popStackToTag(p, markup.iCode);
1824 }else
1825
@@ -2159,23 +2132,18 @@
2159 ){
2160 Renderer renderer;
2161 int tokenType;
2162 ParsedMarkup markup;
2163 int n;
2164 int inlineOnly;
2165 int wikiHtmlOnly = 0;
2166
2167 memset(&renderer, 0, sizeof(renderer));
2168 renderer.state = ALLOW_WIKI|AT_NEWLINE|AT_PARAGRAPH;
2169 if( flags & WIKI_NOBLOCK ){
2170 renderer.state |= INLINE_MARKUP_ONLY;
2171 }
2172 if( wikiUsesHtml() ){
2173 renderer.state |= WIKI_HTMLONLY;
2174 wikiHtmlOnly = 1;
2175 }
2176 inlineOnly = (renderer.state & INLINE_MARKUP_ONLY)!=0;
2177
2178 while( z[0] ){
2179 if( wikiHtmlOnly ){
2180 n = nextRawToken(z, &renderer, &tokenType);
2181 }else{
@@ -2252,16 +2220,10 @@
2252 }else{
2253 renderer.state &= ~ALLOW_WIKI;
2254 }
2255 }else
2256
2257 /* Ignore block markup for in-line rendering.
2258 */
2259 if( inlineOnly && (markup.iType&MUTYPE_INLINE)==0 ){
2260 /* Do nothing */
2261 }else
2262
2263 /* Generate end-tags */
2264 if( markup.endTag ){
2265 popStackToTag(&renderer, markup.iCode);
2266 }else
2267
2268
--- src/wikiformat.c
+++ src/wikiformat.c
@@ -25,11 +25,11 @@
25 /*
26 ** Allowed wiki transformation operations
27 */
28 #define WIKI_HTMLONLY 0x0001 /* HTML markup only. No wiki */
29 #define WIKI_INLINE 0x0002 /* Do not surround with <p>..</p> */
30 /* avalable for reuse: 0x0004 --- formerly WIKI_NOBLOCK */
31 #define WIKI_BUTTONS 0x0008 /* Allow sub-menu buttons */
32 #define WIKI_NOBADLINKS 0x0010 /* Ignore broken hyperlinks */
33 #define WIKI_LINKSONLY 0x0020 /* No markup. Only decorate links */
34 #define WIKI_NEWLINE 0x0040 /* Honor \n - break lines at each \n */
35 #define WIKI_MARKDOWNLINKS 0x0080 /* Resolve hyperlinks as in markdown */
@@ -465,12 +465,11 @@
465 #define AT_NEWLINE 0x0010000 /* At start of a line */
466 #define AT_PARAGRAPH 0x0020000 /* At start of a paragraph */
467 #define ALLOW_WIKI 0x0040000 /* Allow wiki markup */
468 #define ALLOW_LINKS 0x0080000 /* Allow [...] hyperlinks */
469 #define FONT_MARKUP_ONLY 0x0100000 /* Only allow MUTYPE_FONT markup */
470 #define IN_LIST 0x0200000 /* Within wiki <ul> or <ol> */
 
471
472 /*
473 ** Current state of the rendering engine
474 */
475 typedef struct Renderer Renderer;
@@ -1526,11 +1525,10 @@
1525 */
1526 static void wiki_render(Renderer *p, char *z){
1527 int tokenType;
1528 ParsedMarkup markup;
1529 int n;
 
1530 int wikiHtmlOnly = (p->state & (WIKI_HTMLONLY | WIKI_LINKSONLY))!=0;
1531 int linksOnly = (p->state & WIKI_LINKSONLY)!=0;
1532 char *zOrig = z;
1533
1534 /* Make sure the attribute constants and names still align
@@ -1544,22 +1542,17 @@
1542 n = nextWikiToken(z, p, &tokenType);
1543 }
1544 p->state &= ~(AT_NEWLINE|AT_PARAGRAPH);
1545 switch( tokenType ){
1546 case TOKEN_PARAGRAPH: {
1547 if( p->wikiList ){
1548 popStackToTag(p, p->wikiList);
1549 p->wikiList = 0;
1550 }
1551 endAutoParagraph(p);
1552 blob_append_string(p->pOut, "\n\n");
1553 p->wantAutoParagraph = 1;
 
 
 
 
 
1554 p->state |= AT_PARAGRAPH|AT_NEWLINE;
1555 break;
1556 }
1557 case TOKEN_NEWLINE: {
1558 if( p->renderFlags & WIKI_NEWLINE ){
@@ -1570,80 +1563,66 @@
1563 p->state |= AT_NEWLINE;
1564 break;
1565 }
1566 case TOKEN_BUL_LI: {
1567 p->mRender |= RENDER_BLOCK;
1568 if( p->wikiList!=MARKUP_UL ){
1569 if( p->wikiList ){
1570 popStackToTag(p, p->wikiList);
1571 }
1572 endAutoParagraph(p);
1573 pushStack(p, MARKUP_UL);
1574 blob_append_string(p->pOut, "<ul>");
1575 p->wikiList = MARKUP_UL;
1576 }
1577 popStackToTag(p, MARKUP_LI);
1578 startAutoParagraph(p);
1579 pushStack(p, MARKUP_LI);
1580 blob_append_string(p->pOut, "<li>");
 
 
 
 
1581 break;
1582 }
1583 case TOKEN_NUM_LI: {
1584 p->mRender |= RENDER_BLOCK;
1585 if( p->wikiList!=MARKUP_OL ){
1586 if( p->wikiList ){
1587 popStackToTag(p, p->wikiList);
1588 }
1589 endAutoParagraph(p);
1590 pushStack(p, MARKUP_OL);
1591 blob_append_string(p->pOut, "<ol>");
1592 p->wikiList = MARKUP_OL;
1593 }
1594 popStackToTag(p, MARKUP_LI);
1595 startAutoParagraph(p);
1596 pushStack(p, MARKUP_LI);
1597 blob_append_string(p->pOut, "<li>");
 
 
 
 
1598 break;
1599 }
1600 case TOKEN_ENUM: {
1601 p->mRender |= RENDER_BLOCK;
1602 if( p->wikiList!=MARKUP_OL ){
1603 if( p->wikiList ){
1604 popStackToTag(p, p->wikiList);
1605 }
1606 endAutoParagraph(p);
1607 pushStack(p, MARKUP_OL);
1608 blob_append_string(p->pOut, "<ol>");
1609 p->wikiList = MARKUP_OL;
1610 }
1611 popStackToTag(p, MARKUP_LI);
1612 startAutoParagraph(p);
1613 pushStack(p, MARKUP_LI);
1614 blob_appendf(p->pOut, "<li value=\"%d\">", atoi(z));
 
 
 
 
1615 break;
1616 }
1617 case TOKEN_INDENT: {
1618 p->mRender |= RENDER_BLOCK;
1619 assert( p->wikiList==0 );
1620 pushStack(p, MARKUP_BLOCKQUOTE);
1621 blob_append_string(p->pOut, "<blockquote>");
1622 p->wantAutoParagraph = 0;
1623 p->wikiList = MARKUP_BLOCKQUOTE;
 
 
1624 break;
1625 }
1626 case TOKEN_CHARACTER: {
1627 startAutoParagraph(p);
1628 if( p->state & WIKI_MARK ){
@@ -1810,16 +1789,10 @@
1789 }else{
1790 p->state &= ~ALLOW_WIKI;
1791 }
1792 }else
1793
 
 
 
 
 
 
1794 /* Generate end-tags */
1795 if( markup.endTag ){
1796 popStackToTag(p, markup.iCode);
1797 }else
1798
@@ -2159,23 +2132,18 @@
2132 ){
2133 Renderer renderer;
2134 int tokenType;
2135 ParsedMarkup markup;
2136 int n;
 
2137 int wikiHtmlOnly = 0;
2138
2139 memset(&renderer, 0, sizeof(renderer));
2140 renderer.state = ALLOW_WIKI|AT_NEWLINE|AT_PARAGRAPH;
 
 
 
2141 if( wikiUsesHtml() ){
2142 renderer.state |= WIKI_HTMLONLY;
2143 wikiHtmlOnly = 1;
2144 }
 
2145
2146 while( z[0] ){
2147 if( wikiHtmlOnly ){
2148 n = nextRawToken(z, &renderer, &tokenType);
2149 }else{
@@ -2252,16 +2220,10 @@
2220 }else{
2221 renderer.state &= ~ALLOW_WIKI;
2222 }
2223 }else
2224
 
 
 
 
 
 
2225 /* Generate end-tags */
2226 if( markup.endTag ){
2227 popStackToTag(&renderer, markup.iCode);
2228 }else
2229
2230

Keyboard Shortcuts

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