summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cmark.h3
-rw-r--r--src/html/html.c9
-rw-r--r--src/inlines.c4
-rw-r--r--src/node.c18
-rw-r--r--src/node.h1
-rw-r--r--src/print.c6
6 files changed, 7 insertions, 34 deletions
diff --git a/src/cmark.h b/src/cmark.h
index de62fe2..c5ddd5b 100644
--- a/src/cmark.h
+++ b/src/cmark.h
@@ -41,9 +41,6 @@ typedef enum {
CMARK_NODE_FIRST_INLINE = CMARK_NODE_STRING,
CMARK_NODE_LAST_INLINE = CMARK_NODE_IMAGE,
-
- // Other
- CMARK_NODE_LINK_LABEL
} cmark_node_type;
typedef enum {
diff --git a/src/html/html.c b/src/html/html.c
index 1266328..2ef7206 100644
--- a/src/html/html.c
+++ b/src/html/html.c
@@ -127,11 +127,6 @@ static void inlines_to_plain_html(strbuf *html, cmark_node* ils)
case NODE_LINK:
case NODE_IMAGE:
- children = ils->as.link.label;
- visit_children = true;
- rstack = push_inline(rstack, ils->next, "");
- break;
-
case NODE_STRONG:
case NODE_EMPH:
children = ils->first_child;
@@ -201,7 +196,7 @@ static void inlines_to_html(strbuf *html, cmark_node* ils)
}
strbuf_puts(html, "\">");
- children = ils->as.link.label;
+ children = ils->first_child;
rstack = push_inline(rstack, ils->next, "</a>");
break;
@@ -211,7 +206,7 @@ static void inlines_to_html(strbuf *html, cmark_node* ils)
escape_href(html, ils->as.link.url, -1);
strbuf_puts(html, "\" alt=\"");
- inlines_to_plain_html(html, ils->as.link.label);
+ inlines_to_plain_html(html, ils->first_child);
if (ils->as.link.title) {
strbuf_puts(html, "\" title=\"");
diff --git a/src/inlines.c b/src/inlines.c
index 96b1792..57f4b28 100644
--- a/src/inlines.c
+++ b/src/inlines.c
@@ -68,7 +68,7 @@ static inline cmark_node *make_link(cmark_node *label, unsigned char *url, unsig
cmark_node* e = (cmark_node *)calloc(1, sizeof(*e));
if(e != NULL) {
e->type = CMARK_NODE_LINK;
- e->as.link.label = label;
+ e->first_child = label;
e->as.link.url = url;
e->as.link.title = title;
e->next = NULL;
@@ -735,7 +735,7 @@ match:
inl = opener->first_inline;
inl->type = is_image ? NODE_IMAGE : NODE_LINK;
chunk_free(&inl->as.literal);
- inl->as.link.label = link_text;
+ inl->first_child = link_text;
process_emphasis(subj, opener->previous);
inl->as.link.url = url;
inl->as.link.title = title;
diff --git a/src/node.c b/src/node.c
index ed58e90..88c2106 100644
--- a/src/node.c
+++ b/src/node.c
@@ -75,7 +75,6 @@ S_can_contain(cmark_node *node, cmark_node *child)
case CMARK_NODE_STRONG:
case CMARK_NODE_LINK:
case CMARK_NODE_IMAGE:
- case CMARK_NODE_LINK_LABEL:
return S_is_inline(child);
default:
@@ -233,22 +232,6 @@ cmark_node_append_child(cmark_node *node, cmark_node *child)
return 1;
}
-// Utility function used by cmark_free_nodes
-static void splice_into_list(cmark_node* e, cmark_node* children) {
- cmark_node * tmp;
- if (children) {
- tmp = children;
- // Find last child
- while (tmp->next) {
- tmp = tmp->next;
- }
- // Splice children into list
- tmp->next = e->next;
- e->next = children;
- }
- return ;
-}
-
int
cmark_node_check(cmark_node *node) {
cmark_node *cur = node;
@@ -326,7 +309,6 @@ void cmark_free_nodes(cmark_node *e)
case NODE_IMAGE:
free(e->as.link.url);
free(e->as.link.title);
- splice_into_list(e, e->as.link.label);
break;
default:
break;
diff --git a/src/node.h b/src/node.h
index f57ee3b..533406b 100644
--- a/src/node.h
+++ b/src/node.h
@@ -31,7 +31,6 @@ typedef struct {
} cmark_header;
typedef struct {
- struct cmark_node *label;
unsigned char *url;
unsigned char *title;
} cmark_link;
diff --git a/src/print.c b/src/print.c
index 98ae0a6..c8bf5f5 100644
--- a/src/print.c
+++ b/src/print.c
@@ -76,15 +76,15 @@ static void print_inlines(cmark_node* ils, int indent)
print_str(ils->as.link.title, -1);
}
putchar('\n');
- print_inlines(ils->as.link.label, indent + 2);
+ print_inlines(ils->first_child, indent + 2);
break;
case NODE_STRONG:
printf("strong\n");
- print_inlines(ils->as.link.label, indent + 2);
+ print_inlines(ils->first_child, indent + 2);
break;
case NODE_EMPH:
printf("emph\n");
- print_inlines(ils->as.link.label, indent + 2);
+ print_inlines(ils->first_child, indent + 2);
break;
default:
break;