aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael G. Martins <rafael@rafaelmartins.eng.br>2016-03-05 19:46:40 +0100
committerRafael G. Martins <rafael@rafaelmartins.eng.br>2016-03-05 19:46:40 +0100
commit1645987e132d063847aa95c0693570b44bb2d7d5 (patch)
treeb3a517661b1e377734d584158094647796dcc34d
parentde986bafd7d765e94059c0e88df93a352d85d7aa (diff)
downloadblogc-1645987e132d063847aa95c0693570b44bb2d7d5.tar.gz
blogc-1645987e132d063847aa95c0693570b44bb2d7d5.tar.bz2
blogc-1645987e132d063847aa95c0693570b44bb2d7d5.zip
content-parser: fixed em/en-dash logic
-rw-r--r--src/content-parser.c4
-rw-r--r--tests/check_content_parser.c16
2 files changed, 10 insertions, 10 deletions
diff --git a/src/content-parser.c b/src/content-parser.c
index e636636..0a87fcb 100644
--- a/src/content-parser.c
+++ b/src/content-parser.c
@@ -366,11 +366,11 @@ blogc_content_parse_inline(const char *src)
break;
if (current < (src_len - 1) && src[current + 1] == '-') {
if (current < (src_len - 2) && src[current + 2] == '-') {
- sb_string_append(rv, "&ndash;");
+ sb_string_append(rv, "&mdash;");
current += 2;
}
else {
- sb_string_append(rv, "&mdash;");
+ sb_string_append(rv, "&ndash;");
current += 1;
}
}
diff --git a/tests/check_content_parser.c b/tests/check_content_parser.c
index d9d2528..b20f8d0 100644
--- a/tests/check_content_parser.c
+++ b/tests/check_content_parser.c
@@ -157,10 +157,10 @@ test_content_parse(void **state)
"<p>guda\n"
"yay</p>\n"
"<p><strong>bola</strong>\n"
- "&mdash; foo-bar\n"
- "&ndash; bar</p>\n"
- "<p>&mdash; asd</p>\n"
- "<p>&ndash; lol</p>\n");
+ "&ndash; foo-bar\n"
+ "&mdash; bar</p>\n"
+ "<p>&ndash; asd</p>\n"
+ "<p>&mdash; lol</p>\n");
free(html);
}
@@ -245,10 +245,10 @@ test_content_parse_crlf(void **state)
"<p>guda\r\n"
"yay</p>\r\n"
"<p><strong>bola</strong>\r\n"
- "&mdash; foo-bar\r\n"
- "&ndash; bar</p>\r\n"
- "<p>&mdash; asd</p>\r\n"
- "<p>&ndash; lol</p>\r\n");
+ "&ndash; foo-bar\r\n"
+ "&mdash; bar</p>\r\n"
+ "<p>&ndash; asd</p>\r\n"
+ "<p>&mdash; lol</p>\r\n");
free(html);
}