summaryrefslogtreecommitdiff
path: root/src/node.c
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2014-12-28 20:45:35 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2014-12-28 20:52:17 -0800
commit96c7df6a8480b78ddc2540dd85877487af358ceb (patch)
tree548174d5a2fa85dcae0cd93be2ea41e1eeb10bd1 /src/node.c
parent2875252bf83c7a0f26ee940e5c29920b290d615f (diff)
Added cmark_node_set_list_delim, cmark_node_get_list_delim.
Even though this doesn't make a difference in default HTML output, it's worth keeping track; some output formats may allow you to distinguish lists with `1)` and with `1.` delimiters.
Diffstat (limited to 'src/node.c')
-rw-r--r--src/node.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/node.c b/src/node.c
index 88b1281..199dd38 100644
--- a/src/node.c
+++ b/src/node.c
@@ -292,6 +292,39 @@ cmark_node_set_list_type(cmark_node *node, cmark_list_type type) {
}
}
+cmark_delim_type
+cmark_node_get_list_delim(cmark_node *node) {
+ if (node == NULL) {
+ return CMARK_NO_DELIM;
+ }
+
+ if (node->type == CMARK_NODE_LIST) {
+ return node->as.list.delimiter;
+ }
+ else {
+ return CMARK_NO_DELIM;
+ }
+}
+
+int
+cmark_node_set_list_delim(cmark_node *node, cmark_delim_type delim) {
+ if (!(delim == CMARK_PERIOD_DELIM || delim == CMARK_PAREN_DELIM)) {
+ return 0;
+ }
+
+ if (node == NULL) {
+ return 0;
+ }
+
+ if (node->type == CMARK_NODE_LIST) {
+ node->as.list.delimiter = delim;
+ return 1;
+ }
+ else {
+ return 0;
+ }
+}
+
int
cmark_node_get_list_start(cmark_node *node) {
if (node == NULL) {