чување 0a33e59b0a126d9f8c183f2feab154e4ed48953f
родитељ 1982d98e76b5f74acfc4ea5bf993302762738e7a
Аутор: Страхиња Радић <contact@strahinja.org>
Датум: Fri, 20 May 2022 17:50:37 +0200
slw2gmi.c(do_line): Add handling of ~-, remove redundant check
Signed-off-by: Страхиња Радић <contact@strahinja.org>
Diffstat:
| M | slw2gmi.c | | | 43 | ++++++++++++++++++++++++++++++++++++++++++- |
измењених датотека: 1, додавања: 42(+), брисања: 1(-)
diff --git a/slw2gmi.c b/slw2gmi.c
@@ -2703,6 +2703,47 @@ do_line:
pline += 2;
colno += 2;
}
+ else if (strlen((char*)pline) > 1 && *(pline + 1) == '-')
+ {
+ u8* entity = (u8*)"-";
+ /* Handle ~- within footnotes, headings
+ * and link text specially */
+ if (ANY(state,
+ ST_INLINE_FOOTNOTE | ST_HEADING
+ | ST_FOOTNOTE_TEXT | ST_LINK))
+ {
+ size_t entity_len = strlen((char*)entity);
+ size_t token_len = 0;
+
+ *ptoken = 0;
+ token_len = strlen((char*)token);
+
+ if (token_len + entity_len < BUFSIZE)
+ {
+ strncat((char*)token, (char*)entity,
+ BUFSIZE - token_len - 1);
+ ptoken += entity_len;
+ }
+ }
+ else
+ {
+ /* Output existing text up to ~- */
+ process_text_token(output, line, link_prefix,
+ first_line_in_doc, previous_line_blank,
+ processed_start_of_line,
+ read_yaml_macros_and_links, list_para,
+ &token, &ptoken, &token_size, 1);
+ processed_start_of_line = 1;
+
+ if (!read_yaml_macros_and_links
+ && !(ANY(state,
+ ST_PRE | ST_CODE | ST_HEADING)))
+ print_output(output, "-");
+ }
+
+ pline += 2;
+ colno += 2;
+ }
else
{
/* Handle ~ within footnotes, headings
@@ -3358,7 +3399,7 @@ do_line:
break;
}
- if ((IN(state, ST_TAG)) && pline - 1 && *(pline - 1) == '{')
+ if ((IN(state, ST_TAG)) && *(pline - 1) == '{')
{
end_tag = 1;
pline++;