slweb

Једноставни генератор статичких веб страна
Дневник | Датотеке | Референце | ПРОЧИТАЈМЕ | ЛИЦЕНЦА

чување 041cfd64518ea4bb73d89b3f0ad9241975bef3a1
родитељ 68f5e6bf70ebdb54bebb07fd710a70d0d86371a0
Аутор: Страхиња Радић <contact@strahinja.org>
Датум:   Sat, 15 Jan 2022 23:01:21 +0100

Finish fix: last line of footnote text being included twice

Signed-off-by: Страхиња Радић <contact@strahinja.org>

Diffstat:
MTODO | 2+-
Mexamples/includes/index.html.do | 3+--
Mslweb.c | 12++++++++----
измењених датотека: 3, додавања: 10(+), брисања: 7(-)

diff --git a/TODO b/TODO @@ -4,7 +4,7 @@ [x] Find a way to process {inline-,}stylesheet in includes (no <header> for <style> and <link> to go to) - [ ] Investigate: if footnote text is at the end of file, it gets + [x] Investigate: if footnote text is at the end of file, it gets included twice < > Add <abbr>? diff --git a/examples/includes/index.html.do b/examples/includes/index.html.do @@ -1,5 +1,4 @@ -redo ../../slweb for f in *.slw inc/*.slw; do echo $f done | xargs redo-ifchange -../../slweb ${2/%.html/.slw} >$3 +../../slweb ${2%.*}.slw >$3 diff --git a/slweb.c b/slweb.c @@ -2243,7 +2243,7 @@ process_line_start(FILE* output, const u8* line, const u8* link_prefix, if (!read_yaml_macros_and_links && (IN(state, ST_PARA_OPEN))) { - print_output(output, "@</p>\n"); + print_output(output, "</p>\n"); output_firstcol = TRUE; } state &= ~(ST_FOOTNOTE_TEXT | ST_PARA_OPEN); @@ -2559,7 +2559,7 @@ end_footnotes(FILE* output, BOOL add_footnote_div) if (IN(state, ST_PARA_OPEN)) { - print_output(output, "!!</p>\n"); + print_output(output, "</p>\n"); output_firstcol = TRUE; state &= ~ST_PARA_OPEN; } @@ -2577,7 +2577,7 @@ end_footnotes(FILE* output, BOOL add_footnote_div) print_output(output, "<p id=\"inline-footnote-%d\">" "<a href=\"#inline-footnote-text-%d\">%d.</a> " - "%s?!?</p>\n", + "%s</p>\n", footnote + 1, footnote + 1, footnote + 1, (char*)inline_footnotes[footnote]); output_firstcol = TRUE; @@ -2589,7 +2589,7 @@ end_footnotes(FILE* output, BOOL add_footnote_div) { print_output(output, "<p id=\"footnote-%d\">" - "<a href=\"#footnote-text-%d\">%d.</a> %s###</p>\n", + "<a href=\"#footnote-text-%d\">%d.</a> %s</p>\n", footnote + 1, footnote + 1, footnote + 1, (char*)pfootnote->value); output_firstcol = TRUE; @@ -4669,6 +4669,8 @@ done_line: (char*)token); strcat((char*)pfootnotes->value, "\n"); } + *token = 0; + ptoken = token; skip_footnote_read:; } else if (ANY(state, @@ -4794,6 +4796,8 @@ done_line: strcpy((char*)pfootnotes->value, (char*)token); } + *token = 0; + ptoken = token; skip_footnote_text_read:; } }