diff options
| author | 2022-09-27 10:59:29 +0200 | |
|---|---|---|
| committer | 2022-09-27 10:59:29 +0200 | |
| commit | f516866f9ebcb24cc4b8db7573c59ff3a8bf3cfb (patch) | |
| tree | 19a15c5bcb54fd988f6f00c2353c7d83c3a94ba7 | |
| parent | More work in not_really_markdown(). (diff) | |
| download | snac2-f516866f9ebcb24cc4b8db7573c59ff3a8bf3cfb.tar.gz snac2-f516866f9ebcb24cc4b8db7573c59ff3a8bf3cfb.tar.xz snac2-f516866f9ebcb24cc4b8db7573c59ff3a8bf3cfb.zip | |
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) | |||
| 58 | } | 58 | } |
| 59 | } | 59 | } |
| 60 | 60 | ||
| 61 | #if 0 | ||
| 61 | { | 62 | { |
| 62 | /* urls */ | 63 | /* urls */ |
| 64 | xs *done = xs_list_new(); | ||
| 63 | xs *ml = xs_regex_matchall(wrk, "https?:/" "/[^ ]+"); | 65 | xs *ml = xs_regex_matchall(wrk, "https?:/" "/[^ ]+"); |
| 64 | p = ml; | 66 | p = ml; |
| 65 | 67 | ||
| 66 | while (xs_list_iter(&p, &v)) { | 68 | while (xs_list_iter(&p, &v)) { |
| 67 | xs *s2 = xs_fmt("<a href=\"%s\">%s</a>", v, v); | 69 | if (xs_list_in(done, v) == -1) { |
| 70 | xs *s2 = xs_fmt("<a href=\"%s\">%s</a>", v, v); | ||
| 71 | wrk = xs_replace_i(wrk, v, s2); | ||
| 68 | 72 | ||
| 69 | wrk = xs_replace_i(wrk, v, s2); | 73 | /* keep track of already done replaces */ |
| 74 | done = xs_list_append(done, v); | ||
| 75 | } | ||
| 70 | } | 76 | } |
| 71 | } | 77 | } |
| 78 | #endif | ||
| 72 | 79 | ||
| 73 | /* now work on lines */ | 80 | /* now work on lines */ |
| 74 | 81 | ||