slweb

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

чување 08b316044f620561ce493b73d18a8daa92ae8b52
родитељ 2062af37b945b459009d542aaba861af63cf7608
Аутор: Страхиња Радић <contact@strahinja.org>
Датум:   Sat, 23 Jan 2021 15:40:35 +0100

Added three asterisks for hrules; updated manpage

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

Diffstat:
Mindex.html | 2+-
Mslweb.1.in | 18++++++++++++------
Mslweb.c | 49++++++++++++++++++++++++++++++++++---------------
измењених датотека: 3, додавања: 47(+), брисања: 22(-)

diff --git a/index.html b/index.html @@ -134,7 +134,7 @@ this program. If not, see &lt;<a href="https://www.gnu.org/licenses">https://www <div id="git-log"> Previous commit: -index.slw 5a2340f 2021-01-22 22:54:10 +0100 (Страхиња Радић) (HEAD -> master, origin/master, origin/HEAD) +index.slw 2062af3 2021-01-23 13:21:37 +0100 (Страхиња Радић) (HEAD -> master, origin/master, origin/HEAD) </div><!--git-log--> diff --git a/slweb.1.in b/slweb.1.in @@ -211,6 +211,12 @@ block boundaries, it will work only if block is present in the input and before the three dashes for the horizontal rule. Any text following the three dashes on the same line will be ignored. . +.IP +Alternatively, three asterisks (\fC***\fP) can be used instead of dashes, +avoiding the necessity for a +.SM YAML +block preceding the asterisks. +. .IP \[bu] .BR Images . Similar to links (see @@ -527,6 +533,12 @@ file, it will be replaced by the macro body. Macro definitions can't be nested nor can they contain macro calls, and doing so will produce an error. . .IP \[bu] +.BR "Previous Git commit information" . +Directive \fC{git-log}\fP is converted into a div with the id \fCgit-log\fP +containing the information about the previous commit (as having information +about the current commit would be impossible). +. +.IP \[bu] .BR "Subdirectory inclusion (blogging directive)" . The command \fC{incdir "\fIdirname\fC" \fInum\fC =\fImacroname\fC}\fP .RI ( num @@ -574,12 +586,6 @@ directive. (See .BR samedir-permalink " variables.)" .RE . -.IP \[bu] -.BR "Previous Git commit information" . -Directive \fC{git-log}\fP is converted into a div with the id \fCgit-log\fP -containing the information about the previous commit (as having information -about the current commit would be impossible). -. .SS Special YAML variables . .IP \[bu] 4 diff --git a/slweb.c b/slweb.c @@ -1331,23 +1331,20 @@ process_line_start(uint8_t* line, BOOL first_line_in_doc, && !processed_start_of_line && !(state & (ST_BLOCKQUOTE | ST_PRE))) { - if (state & ST_LIST) + if (!list_para) { - if (!list_para) + if (state & ST_LIST) { - if (state & ST_LIST) - { - state &= ~ST_LIST; - if (!read_yaml_macros_and_links) - process_list_end(output); - } + state &= ~ST_LIST; + if (!read_yaml_macros_and_links) + process_list_end(output); + } - if (state & ST_FOOTNOTE_TEXT) - { - state &= ~ST_FOOTNOTE_TEXT; - if (!read_yaml_macros_and_links) - print_output(output, "</p>\n"); - } + if (state & ST_FOOTNOTE_TEXT) + { + state &= ~ST_FOOTNOTE_TEXT; + if (!read_yaml_macros_and_links) + print_output(output, "</p>\n"); } } if (!read_yaml_macros_and_links) @@ -1419,7 +1416,11 @@ process_footnote(uint8_t* token, BOOL footnote_definition, BOOL footnote_output, int process_horizontal_rule(FILE* output) { + if (state & ST_PARA_OPEN) + print_output(output, "</p>\n"); print_output(output, "<hr />\n"); + if (state & ST_PARA_OPEN) + print_output(output, "<p>\n"); return 0; } @@ -1507,10 +1508,16 @@ end_footnotes(FILE* output, BOOL add_footnote_div) { size_t footnote = 0; + if (state & ST_PARA_OPEN) + { + print_output(output, "</p>\n"); + state &= ~ST_PARA_OPEN; + } + if (add_footnote_div) print_output(output, "<div class=\"footnotes\">\n"); - print_output(output, "<hr />\n"); + process_horizontal_rule(output); for (footnote = 0; footnote < inline_footnote_count; footnote++) print_output(output, "<p id=\"inline-footnote-%d\">" @@ -1973,9 +1980,21 @@ slweb_parse(uint8_t* buffer, FILE* output, BOOL body_only, if (colno == 1 && pline_len > 1 && *(pline+1) == '[') { + process_line_start(line, first_line_in_doc, + previous_line_blank, processed_start_of_line, + read_yaml_macros_and_links, list_para, output, + &token, &ptoken); + /* Ignore abbreviations (for now) */ pline = NULL; } + else if (colno == 1 + && pline_len > 2 && startswith((char*)pline, "***")) + { + skip_eol = TRUE; + process_horizontal_rule(output); + pline = NULL; + } else if (pline_len > 1 && *(pline+1) == '*') { /* Handle ** within footnotes, headings and link text specially */