summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/html/html.c4
-rw-r--r--src/inlines.c12
2 files changed, 6 insertions, 10 deletions
diff --git a/src/html/html.c b/src/html/html.c
index 5f08506..ea83992 100644
--- a/src/html/html.c
+++ b/src/html/html.c
@@ -125,7 +125,7 @@ static void inlines_to_plain_html(strbuf *html, node_inl* ils)
case INL_LINK:
case INL_IMAGE:
- children = ils->content.inlines;
+ children = ils->content.linkable.label;
visit_children = true;
rstack = push_inline(rstack, ils->next, "");
break;
@@ -197,7 +197,7 @@ static void inlines_to_html(strbuf *html, node_inl* ils)
}
strbuf_puts(html, "\">");
- children = ils->content.inlines;
+ children = ils->content.linkable.label;
rstack = push_inline(rstack, ils->next, "</a>");
break;
diff --git a/src/inlines.c b/src/inlines.c
index 3e3ef0a..937c33f 100644
--- a/src/inlines.c
+++ b/src/inlines.c
@@ -634,7 +634,6 @@ static node_inl* handle_close_bracket(subject* subj, node_inl **last)
unsigned char *url, *title;
opener_stack *ostack = subj->openers;
node_inl *link_text;
- node_inl *tmp;
node_inl *inl;
chunk raw_label;
@@ -696,18 +695,16 @@ static node_inl* handle_close_bracket(subject* subj, node_inl **last)
subj->pos = subj->pos + scan_spacechars(&subj->input, subj->pos);
raw_label = chunk_literal("");
if (!link_label(subj, &raw_label) || raw_label.len == 0) {
- chunk_free(&raw_label);
+ // chunk_free(&raw_label);
raw_label = chunk_dup(&subj->input, ostack->position, initial_pos - ostack->position - 1);
}
- log_info("looking up '%s'", chunk_to_cstr(&raw_label));
ref = reference_lookup(subj->refmap, &raw_label);
chunk_free(&raw_label);
if (ref != NULL) { // found
- log_info("ref found url{%s} title{%s}", ref->url, ref->title);
- url = ref->url;
- title = ref->title;
+ url = bufdup(ref->url);
+ title = bufdup(ref->title);
goto match;
} else {
goto noMatch;
@@ -719,7 +716,6 @@ noMatch:
return make_str(chunk_literal("]"));
match:
- tmp = link_text->next;
inl = ostack->first_inline;
inl->tag = is_image ? INL_IMAGE : INL_LINK;
chunk_free(&inl->content.literal);
@@ -727,10 +723,10 @@ match:
inl->content.linkable.url = url;
inl->content.linkable.title = title;
inl->next = NULL;
+ *last = inl;
// remove this opener and all later ones from stack:
free_openers(subj, ostack->previous);
- *last = inl;
return NULL;
}