summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/creole.c4
-rw-r--r--src/creole_test_main.c20
2 files changed, 23 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;
}
diff --git a/src/creole_test_main.c b/src/creole_test_main.c
index 334ba43..bae144b 100644
--- a/src/creole_test_main.c
+++ b/src/creole_test_main.c
@@ -136,6 +136,16 @@ struct {
.output = "<p>Bold and italics should <em>be\nable</em> to cross lines.</p>"
},
{
+ .name = "Emphasised URL",
+ .input = "//https://example.com//",
+ .output = "<p><em><a href=\"https://example.com\">https://example.com</a></em></p>"
+ },
+ { // I don't know that this is necessarily //correct// behavior... Let's document it anyways
+ .name = "Emphasised URL ending in slash",
+ .input = "//https://example.com///",
+ .output = "<p><em><a href=\"https://example.com\">https://example.com</a></em>/</p>"
+ },
+ {
.name = "Emphasis does not cross paragraph boundaries",
.input = "This text should //not\n\nbe emphased// as it crosses a paragraph boundary.",
.output = "<p>This text should //not</p>"
@@ -152,11 +162,21 @@ struct {
"<em>this should be an italic text</em>.</p>"
},
{
+ .name = "Escaped emphasis",
+ .input = "I //love double ~// slashes//!",
+ .output = "<p>I <em>love double // slashes</em>!</p>"
+ },
+ {
.name = "Bold",
.input = "**Strong**",
.output = "<p><strong>Strong</strong></p>"
},
{
+ .name = "Escaped bold",
+ .input = "**Strong ~** still strong**",
+ .output = "<p><strong>Strong ** still strong</strong></p>"
+ },
+ {
.name = "Nested bold/italic",
.input = "//**Strong and emphasized**//",
.output = "<p><em><strong>Strong and emphasized</strong></em></p>"