lucy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nwelln...@apache.org
Subject [10/12] lucy-clownfish git commit: Adjust for CommonMark API changes
Date Sun, 18 Jan 2015 18:44:46 GMT
Adjust for CommonMark API changes


Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/eb17ed8e
Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/eb17ed8e
Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/eb17ed8e

Branch: refs/heads/master
Commit: eb17ed8e0d44ee6dfc33d853aa77ea9af0c5c8ba
Parents: 5672da1
Author: Nick Wellnhofer <wellnhofer@aevum.de>
Authored: Sat Jan 10 19:02:33 2015 +0100
Committer: Nick Wellnhofer <wellnhofer@aevum.de>
Committed: Sun Jan 18 19:38:29 2015 +0100

----------------------------------------------------------------------
 compiler/src/CFCCHtml.c   |  4 ++--
 compiler/src/CFCCMan.c    | 47 +++++++++++++++++++---------------------
 compiler/src/CFCPerlPod.c | 49 ++++++++++++++++++++----------------------
 3 files changed, 47 insertions(+), 53 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/eb17ed8e/compiler/src/CFCCHtml.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCCHtml.c b/compiler/src/CFCCHtml.c
index 73b25cf..e4b67f7 100644
--- a/compiler/src/CFCCHtml.c
+++ b/compiler/src/CFCCHtml.c
@@ -754,7 +754,7 @@ static char*
 S_md_to_html(CFCClass *klass, const char *md) {
     cmark_node *doc = cmark_parse_document(md, strlen(md));
     S_convert_uris(klass, doc);
-    char *html = cmark_render_html(doc);
+    char *html = cmark_render_html(doc, CMARK_OPT_DEFAULT);
     cmark_node_free(doc);
 
     return html;
@@ -831,7 +831,7 @@ S_convert_uri(CFCClass *klass, cmark_node *link) {
 
             if (link_text) {
                 cmark_node *text_node = cmark_node_new(CMARK_NODE_TEXT);
-                cmark_node_set_string_content(text_node, link_text);
+                cmark_node_set_literal(text_node, link_text);
                 cmark_node_append_child(link, text_node);
                 FREEMEM(link_text);
             }

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/eb17ed8e/compiler/src/CFCCMan.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCCMan.c b/compiler/src/CFCCMan.c
index 736d0f0..55865b1 100644
--- a/compiler/src/CFCCMan.c
+++ b/compiler/src/CFCCMan.c
@@ -428,7 +428,7 @@ S_nodes_to_man(CFCClass *klass, cmark_node *node, int needs_indent) {
         cmark_node_type type = cmark_node_get_type(node);
 
         switch (type) {
-            case NODE_DOCUMENT: {
+            case CMARK_NODE_DOCUMENT: {
                 cmark_node *child = cmark_node_first_child(node);
                 char *children_man = S_nodes_to_man(klass, child,
                                                     needs_indent);
@@ -437,7 +437,7 @@ S_nodes_to_man(CFCClass *klass, cmark_node *node, int needs_indent) {
                 break;
             }
 
-            case NODE_PARAGRAPH: {
+            case CMARK_NODE_PARAGRAPH: {
                 if (needs_indent && !has_indent) {
                     result = CFCUtil_cat(result, ".IP\n", NULL);
                     has_indent = true;
@@ -461,7 +461,7 @@ S_nodes_to_man(CFCClass *klass, cmark_node *node, int needs_indent) {
                 break;
             }
 
-            case NODE_BLOCK_QUOTE: {
+            case CMARK_NODE_BLOCK_QUOTE: {
                 if (needs_indent) {
                     result = CFCUtil_cat(result, ".RS\n", NULL);
                 }
@@ -482,7 +482,7 @@ S_nodes_to_man(CFCClass *klass, cmark_node *node, int needs_indent) {
                 break;
             }
 
-            case NODE_LIST_ITEM: {
+            case CMARK_NODE_ITEM: {
                 cmark_node *child = cmark_node_first_child(node);
                 char *children_man = S_nodes_to_man(klass, child, true);
                 result = CFCUtil_cat(result, ".IP \\(bu\n", children_man,
@@ -491,7 +491,7 @@ S_nodes_to_man(CFCClass *klass, cmark_node *node, int needs_indent) {
                 break;
             }
 
-            case NODE_LIST: {
+            case CMARK_NODE_LIST: {
                 if (needs_indent) {
                     result = CFCUtil_cat(result, ".RS\n", NULL);
                 }
@@ -513,7 +513,7 @@ S_nodes_to_man(CFCClass *klass, cmark_node *node, int needs_indent) {
                 break;
             }
 
-            case NODE_HEADER: {
+            case CMARK_NODE_HEADER: {
                 cmark_node *child = cmark_node_first_child(node);
                 char *children_man = S_nodes_to_man(klass, child,
                                                     needs_indent);
@@ -524,12 +524,12 @@ S_nodes_to_man(CFCClass *klass, cmark_node *node, int needs_indent)
{
                 break;
             }
 
-            case NODE_CODE_BLOCK: {
+            case CMARK_NODE_CODE_BLOCK: {
                 if (needs_indent) {
                     result = CFCUtil_cat(result, ".RS\n", NULL);
                 }
 
-                const char *content = cmark_node_get_string_content(node);
+                const char *content = cmark_node_get_literal(node);
                 char *escaped = S_man_escape(content);
                 result = CFCUtil_cat(result, ".IP\n.nf\n.fam C\n", escaped,
                                      ".fam\n.fi\n", NULL);
@@ -546,47 +546,44 @@ S_nodes_to_man(CFCClass *klass, cmark_node *node, int needs_indent)
{
                 break;
             }
 
-            case NODE_HTML:
+            case CMARK_NODE_HTML:
                 CFCUtil_warn("HTML not supported in man pages");
                 break;
 
-            case NODE_HRULE:
+            case CMARK_NODE_HRULE:
                 break;
 
-            case NODE_REFERENCE_DEF:
-                break;
-
-            case NODE_TEXT: {
-                const char *content = cmark_node_get_string_content(node);
+            case CMARK_NODE_TEXT: {
+                const char *content = cmark_node_get_literal(node);
                 char *escaped = S_man_escape(content);
                 result = CFCUtil_cat(result, escaped, NULL);
                 FREEMEM(escaped);
                 break;
             }
 
-            case NODE_LINEBREAK:
+            case CMARK_NODE_LINEBREAK:
                 result = CFCUtil_cat(result, "\n.br\n", NULL);
                 break;
 
-            case NODE_SOFTBREAK:
+            case CMARK_NODE_SOFTBREAK:
                 result = CFCUtil_cat(result, "\n", NULL);
                 break;
 
-            case NODE_INLINE_CODE: {
-                const char *content = cmark_node_get_string_content(node);
+            case CMARK_NODE_CODE: {
+                const char *content = cmark_node_get_literal(node);
                 char *escaped = S_man_escape(content);
                 result = CFCUtil_cat(result, "\\FC", escaped, "\\F[]", NULL);
                 FREEMEM(escaped);
                 break;
             }
 
-            case NODE_INLINE_HTML: {
-                const char *html = cmark_node_get_string_content(node);
+            case CMARK_NODE_INLINE_HTML: {
+                const char *html = cmark_node_get_literal(node);
                 CFCUtil_warn("HTML not supported in man pages: %s", html);
                 break;
             }
 
-            case NODE_LINK: {
+            case CMARK_NODE_LINK: {
                 cmark_node *child = cmark_node_first_child(node);
                 char *children_man = S_nodes_to_man(klass, child,
                                                     needs_indent);
@@ -614,11 +611,11 @@ S_nodes_to_man(CFCClass *klass, cmark_node *node, int needs_indent)
{
                 break;
             }
 
-            case NODE_IMAGE:
+            case CMARK_NODE_IMAGE:
                 CFCUtil_warn("Images not supported in man pages");
                 break;
 
-            case NODE_STRONG: {
+            case CMARK_NODE_STRONG: {
                 cmark_node *child = cmark_node_first_child(node);
                 char *children_man = S_nodes_to_man(klass, child,
                                                     needs_indent);
@@ -628,7 +625,7 @@ S_nodes_to_man(CFCClass *klass, cmark_node *node, int needs_indent) {
                 break;
             }
 
-            case NODE_EMPH: {
+            case CMARK_NODE_EMPH: {
                 cmark_node *child = cmark_node_first_child(node);
                 char *children_man = S_nodes_to_man(klass, child,
                                                     needs_indent);

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/eb17ed8e/compiler/src/CFCPerlPod.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCPerlPod.c b/compiler/src/CFCPerlPod.c
index aaf8253..3dcb83a 100644
--- a/compiler/src/CFCPerlPod.c
+++ b/compiler/src/CFCPerlPod.c
@@ -336,7 +336,7 @@ S_nodes_to_pod(CFCClass *klass, cmark_node *node) {
         cmark_node_type type = cmark_node_get_type(node);
 
         switch (type) {
-            case NODE_DOCUMENT: {
+            case CMARK_NODE_DOCUMENT: {
                 cmark_node *child = cmark_node_first_child(node);
                 char *children_pod = S_nodes_to_pod(klass, child);
                 result = CFCUtil_cat(result, children_pod, NULL);
@@ -344,7 +344,7 @@ S_nodes_to_pod(CFCClass *klass, cmark_node *node) {
                 break;
             }
 
-            case NODE_PARAGRAPH: {
+            case CMARK_NODE_PARAGRAPH: {
                 cmark_node *child = cmark_node_first_child(node);
                 char *children_pod = S_nodes_to_pod(klass, child);
                 result = CFCUtil_cat(result, children_pod, "\n\n", NULL);
@@ -352,7 +352,7 @@ S_nodes_to_pod(CFCClass *klass, cmark_node *node) {
                 break;
             }
 
-            case NODE_BLOCK_QUOTE: {
+            case CMARK_NODE_BLOCK_QUOTE: {
                 cmark_node *child = cmark_node_first_child(node);
                 char *children_pod = S_nodes_to_pod(klass, child);
                 result = CFCUtil_cat(result, "=over\n\n", children_pod,
@@ -361,7 +361,7 @@ S_nodes_to_pod(CFCClass *klass, cmark_node *node) {
                 break;
             }
 
-            case NODE_LIST_ITEM: {
+            case CMARK_NODE_ITEM: {
                 // TODO: Ordered lists.
                 cmark_node *child = cmark_node_first_child(node);
                 char *children_pod = S_nodes_to_pod(klass, child);
@@ -371,7 +371,7 @@ S_nodes_to_pod(CFCClass *klass, cmark_node *node) {
                 break;
             }
 
-            case NODE_LIST: {
+            case CMARK_NODE_LIST: {
                 cmark_node *child = cmark_node_first_child(node);
                 char *children_pod = S_nodes_to_pod(klass, child);
                 result = CFCUtil_cat(result, "=over\n\n", children_pod,
@@ -380,7 +380,7 @@ S_nodes_to_pod(CFCClass *klass, cmark_node *node) {
                 break;
             }
 
-            case NODE_HEADER: {
+            case CMARK_NODE_HEADER: {
                 cmark_node *child = cmark_node_first_child(node);
                 int header_level = cmark_node_get_header_level(node);
                 char *children_pod = S_nodes_to_pod(klass, child);
@@ -392,8 +392,8 @@ S_nodes_to_pod(CFCClass *klass, cmark_node *node) {
                 break;
             }
 
-            case NODE_CODE_BLOCK: {
-                const char *content = cmark_node_get_string_content(node);
+            case CMARK_NODE_CODE_BLOCK: {
+                const char *content = cmark_node_get_literal(node);
                 char *escaped = S_pod_escape(content);
                 // Chomp trailing newline.
                 size_t len = strlen(escaped);
@@ -408,62 +408,59 @@ S_nodes_to_pod(CFCClass *klass, cmark_node *node) {
                 break;
             }
 
-            case NODE_HTML: {
-                const char *html = cmark_node_get_string_content(node);
+            case CMARK_NODE_HTML: {
+                const char *html = cmark_node_get_literal(node);
                 result = CFCUtil_cat(result, "=begin html\n\n", html,
                                      "\n=end\n\n", NULL);
                 break;
             }
 
-            case NODE_HRULE:
+            case CMARK_NODE_HRULE:
                 break;
 
-            case NODE_REFERENCE_DEF:
-                break;
-
-            case NODE_TEXT: {
-                const char *content = cmark_node_get_string_content(node);
+            case CMARK_NODE_TEXT: {
+                const char *content = cmark_node_get_literal(node);
                 char *escaped = S_pod_escape(content);
                 result = CFCUtil_cat(result, escaped, NULL);
                 FREEMEM(escaped);
                 break;
             }
 
-            case NODE_LINEBREAK:
+            case CMARK_NODE_LINEBREAK:
                 // POD doesn't support line breaks. Start a new paragraph.
                 result = CFCUtil_cat(result, "\n\n", NULL);
                 break;
 
-            case NODE_SOFTBREAK:
+            case CMARK_NODE_SOFTBREAK:
                 result = CFCUtil_cat(result, "\n", NULL);
                 break;
 
-            case NODE_INLINE_CODE: {
-                const char *content = cmark_node_get_string_content(node);
+            case CMARK_NODE_CODE: {
+                const char *content = cmark_node_get_literal(node);
                 char *escaped = S_pod_escape(content);
                 result = CFCUtil_cat(result, "C<", escaped, ">", NULL);
                 FREEMEM(escaped);
                 break;
             }
 
-            case NODE_INLINE_HTML: {
-                const char *html = cmark_node_get_string_content(node);
+            case CMARK_NODE_INLINE_HTML: {
+                const char *html = cmark_node_get_literal(node);
                 CFCUtil_warn("Inline HTML not supported in POD: %s", html);
                 break;
             }
 
-            case NODE_LINK: {
+            case CMARK_NODE_LINK: {
                 char *pod = S_convert_link(klass, node);
                 result = CFCUtil_cat(result, pod, NULL);
                 FREEMEM(pod);
                 break;
             }
 
-            case NODE_IMAGE:
+            case CMARK_NODE_IMAGE:
                 CFCUtil_warn("Images not supported in POD");
                 break;
 
-            case NODE_STRONG: {
+            case CMARK_NODE_STRONG: {
                 cmark_node *child = cmark_node_first_child(node);
                 char *children_pod = S_nodes_to_pod(klass, child);
                 result = CFCUtil_cat(result, "B<", children_pod, ">", NULL);
@@ -471,7 +468,7 @@ S_nodes_to_pod(CFCClass *klass, cmark_node *node) {
                 break;
             }
 
-            case NODE_EMPH: {
+            case CMARK_NODE_EMPH: {
                 cmark_node *child = cmark_node_first_child(node);
                 char *children_pod = S_nodes_to_pod(klass, child);
                 result = CFCUtil_cat(result, "I<", children_pod, ">", NULL);


Mime
View raw message