diff options
author | default <nobody@localhost> | 2022-09-27 10:59:29 +0200 |
---|---|---|
committer | default <nobody@localhost> | 2022-09-27 10:59:29 +0200 |
commit | f516866f9ebcb24cc4b8db7573c59ff3a8bf3cfb (patch) | |
tree | 19a15c5bcb54fd988f6f00c2353c7d83c3a94ba7 | |
parent | 4f3b70d9979b22cfc1a789b14602a12ee5c896c7 (diff) |
Disabled URL replacement by now because it's not infinite-loop-safe.
-rw-r--r-- | html.c | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -58,17 +58,24 @@ d_char *not_really_markdown(char *content, d_char **f_content) } } +#if 0 { /* urls */ + xs *done = xs_list_new(); xs *ml = xs_regex_matchall(wrk, "https?:/" "/[^ ]+"); p = ml; while (xs_list_iter(&p, &v)) { - xs *s2 = xs_fmt("<a href=\"%s\">%s</a>", v, v); + if (xs_list_in(done, v) == -1) { + xs *s2 = xs_fmt("<a href=\"%s\">%s</a>", v, v); + wrk = xs_replace_i(wrk, v, s2); - wrk = xs_replace_i(wrk, v, s2); + /* keep track of already done replaces */ + done = xs_list_append(done, v); + } } } +#endif /* now work on lines */ |