~strahinja/slweb

041cfd64518ea4bb73d89b3f0ad9241975bef3a1 — Страхиња Радић 3 months ago 68f5e6b v0.4.5
Finish fix: last line of footnote text being included twice

Signed-off-by: Страхиња Радић <contact@strahinja.org>
3 files changed, 10 insertions(+), 7 deletions(-)

M TODO
M examples/includes/index.html.do
M slweb.c
M TODO => TODO +1 -1
@@ 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>?

M examples/includes/index.html.do => examples/includes/index.html.do +1 -2
@@ 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

M slweb.c => slweb.c +8 -4
@@ 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:;
			}
		}