slweb

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

чување 8f69ce36ed7af37719853e295d2d8d845427d42b
родитељ 0feedfdc5b2fe58498dfea30e206de565f1fec70
Аутор: Страхиња Радић <contact@strahinja.org>
Датум:   Mon,  3 Jul 2023 20:06:31 +0200

Bugfix: Add <p> at the start of a summary output

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

Diffstat:
MTODO | 2+-
Mslweb.c | 20++++++++++++++++++--
измењених датотека: 2, додавања: 19(+), брисања: 3(-)

diff --git a/TODO b/TODO @@ -1,7 +1,7 @@ TODO ==== -[ ] Bugfix: check for paragraph start/ending tags in summaries +[x] Bugfix: check for paragraph start/ending tags in summaries < > Add <abbr>? diff --git a/slweb.c b/slweb.c @@ -1680,6 +1680,10 @@ process_incdir_subdir(FILE* output, const char* subdirname, if (ext_in_permalink) strcat(link, timestamp_output_ext); + /* TODO: Get rid of orphan <p> just before + * <footer>; would probably need another flag + * and another layer of code, so maybe not + */ print_output(output, "<footer>\n" "<a href=\"%s\">%s</a>\n" @@ -2970,7 +2974,12 @@ do_line: &ptoken, &token_size, 1, 1); processed_start_of_line = 1; - state &= ~ST_SUMMARY; + /* <p> without </p> is allowed in HTML spec */ + /*if (!read_yaml_macros_and_links + && IN(state, ST_PARA_OPEN)) + print_output(output, "</p>\n");*/ + + state &= ~(ST_SUMMARY | ST_PARA_OPEN); pline += 2; colno += 2; @@ -3758,11 +3767,18 @@ do_line: first_line_in_doc, previous_line_blank, &previous_line_block, processed_start_of_line, read_yaml_macros_and_links, list_para, &token, - &ptoken, &token_size, 1, 1); + &ptoken, &token_size, 0, 0); processed_start_of_line = 1; state |= ST_SUMMARY; + if (!read_yaml_macros_and_links) + { + state |= ST_PARA_OPEN; + print_output(output, "<p>\n"); + output_firstcol=1; + } + pline += 2; colno++; }