summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/html/houdini_html_e.c4
-rw-r--r--src/html/html.c5
-rw-r--r--src/inlines.c14
3 files changed, 7 insertions, 16 deletions
diff --git a/src/html/houdini_html_e.c b/src/html/houdini_html_e.c
index 5cdd3dd..95b6c41 100644
--- a/src/html/houdini_html_e.c
+++ b/src/html/houdini_html_e.c
@@ -62,8 +62,8 @@ houdini_escape_html0(gh_buf *ob, const uint8_t *src, size_t size, int secure)
break;
/* The forward slash is only escaped in secure mode */
- if (src[i] == '/' && !secure) {
- gh_buf_putc(ob, '/');
+ if ((src[i] == '/' || src[i] == '\'') && !secure) {
+ gh_buf_putc(ob, src[i]);
} else {
gh_buf_puts(ob, HTML_ESCAPES[esc]);
}
diff --git a/src/html/html.c b/src/html/html.c
index cdccf2a..913a602 100644
--- a/src/html/html.c
+++ b/src/html/html.c
@@ -191,10 +191,9 @@ void inlines_to_html(gh_buf *html, inl* ils)
escape_href(html, ils->content.linkable.url, -1);
inlines_to_html(&scrap, ils->content.inlines);
- if (scrap.size) {
- gh_buf_puts(html, "\" alt=\"");
+ gh_buf_puts(html, "\" alt=\"");
+ if (scrap.size)
escape_html(html, scrap.ptr, scrap.size);
- }
gh_buf_clear(&scrap);
if (ils->content.linkable.title) {
diff --git a/src/inlines.c b/src/inlines.c
index a0dcac9..599be84 100644
--- a/src/inlines.c
+++ b/src/inlines.c
@@ -21,7 +21,6 @@ reference* make_reference(chunk *label, chunk *url, chunk *title);
static unsigned char *clean_url(chunk *url, int is_email);
static unsigned char *clean_title(chunk *title);
-inline static unsigned char *chunk_to_cstr(chunk *c);
inline static void chunk_free(chunk *c);
inline static void chunk_trim(chunk *c);
@@ -37,6 +36,8 @@ static void subject_from_chunk(subject *e, chunk *chunk, reference** refmap);
static void subject_from_buf(subject *e, gh_buf *buffer, reference** refmap);
static int subject_find_special_char(subject *subj);
+static void normalize_whitespace(gh_buf *s);
+
extern void free_reference(reference *ref) {
free(ref->label);
free(ref->url);
@@ -62,19 +63,10 @@ extern void free_reference_map(reference **refmap) {
static unsigned char *normalize_reference(chunk *ref)
{
gh_buf normalized = GH_BUF_INIT;
- int r, w;
utf8proc_case_fold(&normalized, ref->data, ref->len);
gh_buf_trim(&normalized);
-
- for (r = 0, w = 0; r < normalized.size; ++r) {
- if (r && gh_buf_at(&normalized, r - 1) == ' ') {
- while (gh_buf_at(&normalized, r) == ' ')
- r++;
- }
-
- normalized.ptr[w++] = normalized.ptr[r];
- }
+ normalize_whitespace(&normalized);
return gh_buf_detach(&normalized);
}