чување 2dc1091e26feee76afd075e7162817682a09d592
родитељ c1578ad94181345aee4454ea8a2338690d1c134d
Аутор: Страхиња Радић <contact@strahinja.org>
Датум: Tue, 10 Aug 2021 14:10:01 +0200
Fix: make the behavior of the macro-form of links consistent with slweb
Signed-off-by: Страхиња Радић <contact@strahinja.org>
Diffstat:
измењених датотека: 2, додавања: 32(+), брисања: 1(-)
diff --git a/defs.h b/defs.h
@@ -39,7 +39,7 @@
#include <uniwidth.h>
#define PROGRAMNAME "slw2gmi"
-#define VERSION "0.1.0"
+#define VERSION "0.1.1"
#define COPYRIGHTYEAR "2021"
#define MADEBY_URL "https://strahinja.srht.site/slw2gmi/index.html"
diff --git a/slw2gmi.c b/slw2gmi.c
@@ -3139,6 +3139,37 @@ slweb_parse(uint8_t* buffer, FILE* output, BOOL read_yaml_macros_and_links)
break;
+ case '(':
+ if (ANY(state, ST_CODE | ST_DISPLAY_FORMULA | ST_FORMULA
+ | ST_FOOTNOTE_TEXT | ST_HEADING
+ | ST_INLINE_FOOTNOTE | ST_LINK_SECOND_ARG_END
+ | ST_MACRO_BODY | ST_PRE))
+ CHECKCOPY(token, ptoken, token_size, pline)
+ else if (*link_macro && (state & ST_LINK))
+ {
+/*
+ * uint8_t* tag = (uint8_t*)"<span>";
+ * size_t tag_len = u8_strlen(tag);
+ * size_t token_len = 0;
+ *
+ * *ptoken = 0;
+ * token_len = u8_strlen(token);
+ *
+ * if (token_len + tag_len < BUFSIZE)
+ * {
+ * u8_strncat(token, tag, BUFSIZE-token_len-1);
+ * ptoken += tag_len;
+ * }
+ */
+
+ state |= ST_LINK_SPAN;
+ pline++;
+ }
+ else
+ CHECKCOPY(token, ptoken, token_size, pline)
+ colno++;
+ break;
+
case ')':
if (ANY(state, ST_DISPLAY_FORMULA | ST_FORMULA
| ST_LINK_SECOND_ARG_END))