summaryrefslogtreecommitdiff
path: root/src/creole.c
diff options
context:
space:
mode:
authorLinnnus <[email protected]>2024-02-17 02:41:43 +0100
committerLinnnus <[email protected]>2024-02-17 02:44:38 +0100
commitfd385801d115e8a0aa29ffb9b9e6ff215c34cc42 (patch)
treeb97e150911216848a2655f767f7e48ad9b9a681a /src/creole.c
parent0f60b5f74919b8841bf9d8a9658d031e4fc503d1 (diff)
fix(creole): Handle escapes properly
A faulty boolean expression was to blame. This patch also adds the necessary tests to prevent relapses (i forgot det technical term).
Diffstat (limited to 'src/creole.c')
-rw-r--r--src/creole.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/creole.c b/src/creole.c
index 5804ebd..94e8020 100644
--- a/src/creole.c
+++ b/src/creole.c
@@ -116,6 +116,8 @@ static struct {
// Escaped special characters
{"~[[", "[["},
{"~]]", "]]"}, // NOTE: This pattern is duplicated in do_link().
+ {"~//", "//"},
+ {"~**", "**"},
// Characters that have special meaning in HTML
// NOTE: These rules are duplicated in hprint().
{"<", "&lt;"},
@@ -256,7 +258,7 @@ long do_emphasis(const char *begin, const char *end, bool new_block, FILE *out)
const char *stop = start;
do {
stop = strnstr(stop + 1, "//", end - (stop + 1));
- } while (stop != NULL && stop[-1] == '~' && stop[-1] == ':');
+ } while (stop != NULL && (stop[-1] == '~' || stop[-1] == ':'));
if (stop == NULL) {
return 0;
}