чување 26a4ae3d0e236c4ea56d1392956b6043d8939183
родитељ a1e6a696870a577c225d3059f750309b7d198ece
Аутор: Страхиња Радић <contact@strahinja.org>
Датум: Fri, 7 Apr 2023 22:23:54 +0200
Fix <ol> with more than 9 items
Signed-off-by: Страхиња Радић <contact@strahinja.org>
Diffstat:
измењених датотека: 2, додавања: 20(+), брисања: 2(-)
diff --git a/TODO b/TODO
@@ -3,7 +3,7 @@
[x] Check {code.classname} output?
- [ ] Fix <ol> with more than 9 items
+ [x] Fix <ol> with more than 9 items
< > Add <abbr>?
diff --git a/slweb.c b/slweb.c
@@ -210,6 +210,19 @@ endswith(const char* s, const char* what)
return *ps == *pwhat && pwhat == what;
}
+int
+all_numeric(const u8* s)
+{
+ const u8* ps = s;
+ while (*ps)
+ {
+ if (*ps && !isdigit((const int)*ps))
+ return 0;
+ ps++;
+ }
+ return 1;
+}
+
u8*
get_value(KeyValue* list, const size_t list_count, const u8* key)
{
@@ -4523,6 +4536,7 @@ do_line:
case '8':
case '9':
case '0':
+ *ptoken = 0;
if (ANY(state,
ST_CODE | ST_DISPLAY_FORMULA | ST_FORMULA
| ST_MACRO_BODY | ST_PRE | ST_YAML_VAL))
@@ -4530,9 +4544,13 @@ do_line:
CHECKCOPY(token, ptoken, token_size, pline);
colno++;
}
- else if (colno == 1 && strlen((char*)pline) > 1
+ else if ((colno == 1 || all_numeric(token))
+ && strlen((char*)pline) > 1
&& (*(pline + 1) == '.' || *(pline + 1) == ')'))
{
+ ptoken = token;
+ *ptoken = 0;
+
if (IN(state, ST_LIST))
{
state &= ~ST_LIST;