aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2014-12-28 17:00:15 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2014-12-28 17:00:15 -0800
commitb50a2cd618802543e01f46bffb4b19d5bd5b4ba6 (patch)
treea7e5013ad6fd1dc27bacada0b84b4b3991aacfae
parent6f30b9fcabfacb2811cba6df20a49b90f44201a1 (diff)
Revamped xml writer and dtd to use lowercase element names.
-rw-r--r--CommonMark.dtd74
-rw-r--r--src/xml.c12
2 files changed, 45 insertions, 41 deletions
diff --git a/CommonMark.dtd b/CommonMark.dtd
index 4ad924b..2f6bdfa 100644
--- a/CommonMark.dtd
+++ b/CommonMark.dtd
@@ -1,45 +1,45 @@
<!-- DTD for CommonMark xml export format -->
-<!ELEMENT DOCUMENT
-(BLOCK_QUOTE|LIST|CODE_BLOCK|HTML|PARAGRAPH|HEADER|HRULE)*>
-<!ELEMENT BLOCK_QUOTE
-(BLOCK_QUOTE|LIST|CODE_BLOCK|HTML|PARAGRAPH|HEADER|HRULE)*>
-<!ELEMENT LIST (LIST_ITEM)+>
-<!ATTLIST LIST
+<!ELEMENT document
+(block_quote|list|code_block|html|paragraph|header|hrule)*>
+<!ELEMENT block_quote
+(block_quote|list|code_block|html|paragraph|header|hrule)*>
+<!ELEMENT list (list_item)+>
+<!ATTLIST list
type (bullet|ordered) #REQUIRED
start CDATA #IMPLIED
tight (true|false) #REQUIRED
delimiter (period|paren) #IMPLIED>
-<!ELEMENT LIST_ITEM
-(BLOCK_QUOTE|LIST|CODE_BLOCK|HTML|PARAGRAPH|HEADER|HRULE)*>
-<!ELEMENT CODE_BLOCK (#PCDATA)>
-<!ATTLIST CODE_BLOCK
+<!ELEMENT list_item
+(block_quote|list|code_block|html|paragraph|header|hrule)*>
+<!ELEMENT code_block (#PCDATA)>
+<!ATTLIST code_block
xml:space CDATA #FIXED "preserve"
info CDATA #IMPLIED>
-<!ELEMENT HTML (#PCDATA)>
-<!ATTLIST HTML xml:space CDATA #FIXED "preserve">
-<!ELEMENT PARAGRAPH
-(TEXT|SOFTBREAK|LINEBREAK|CODE|INLINE_HTML|EMPH|STRONG|LINK|IMAGE)*>
-<!ELEMENT HEADER
-(TEXT|SOFTBREAK|LINEBREAK|CODE|INLINE_HTML|EMPH|STRONG|LINK|IMAGE)*>
-<!ATTLIST HEADER level (1|2|3|4|5|6) #REQUIRED>
-<!ELEMENT HRULE EMPTY>
-<!ELEMENT TEXT (#PCDATA)>
-<!ELEMENT SOFTBREAK EMPTY>
-<!ELEMENT LINEBREAK EMPTY>
-<!ELEMENT CODE (#PCDATA)>
-<!ATTLIST CODE xml:space CDATA #FIXED "preserve">
-<!ELEMENT INLINE_HTML (#PCDATA)>
-<!ATTLIST INLINE_HTML xml:space CDATA #FIXED "preserve">
-<!ELEMENT EMPH
-(TEXT|SOFTBREAK|LINEBREAK|CODE|INLINE_HTML|EMPH|STRONG|LINK|IMAGE)*>
-<!ELEMENT STRONG
-(TEXT|SOFTBREAK|LINEBREAK|CODE|INLINE_HTML|EMPH|STRONG|LINK|IMAGE)*>
-<!ELEMENT LINK
-(TEXT|SOFTBREAK|LINEBREAK|CODE|INLINE_HTML|EMPH|STRONG|LINK|IMAGE)*>
-<!ATTLIST LINK url CDATA #REQUIRED>
-<!ATTLIST LINK title CDATA #IMPLIED>
-<!ELEMENT IMAGE
-(TEXT|SOFTBREAK|LINEBREAK|CODE|INLINE_HTML|EMPH|STRONG|LINK|IMAGE)*>
-<!ATTLIST IMAGE url CDATA #REQUIRED>
-<!ATTLIST IMAGE title CDATA #IMPLIED>
+<!ELEMENT html (#PCDATA)>
+<!ATTLIST html xml:space CDATA #FIXED "preserve">
+<!ELEMENT paragraph
+(text|softbreak|linebreak|code|inline_html|emph|strong|link|image)*>
+<!ELEMENT header
+(text|softbreak|linebreak|code|inline_html|emph|strong|link|image)*>
+<!ATTLIST header level (1|2|3|4|5|6) #REQUIRED>
+<!ELEMENT hrule EMPTY>
+<!ELEMENT text (#PCDATA)>
+<!ELEMENT softbreak EMPTY>
+<!ELEMENT linebreak EMPTY>
+<!ELEMENT code (#PCDATA)>
+<!ATTLIST code xml:space CDATA #FIXED "preserve">
+<!ELEMENT inline_html (#PCDATA)>
+<!ATTLIST inline_html xml:space CDATA #FIXED "preserve">
+<!ELEMENT emph
+(text|softbreak|linebreak|code|inline_html|emph|strong|link|image)*>
+<!ELEMENT strong
+(text|softbreak|linebreak|code|inline_html|emph|strong|link|image)*>
+<!ELEMENT link
+(text|softbreak|linebreak|code|inline_html|emph|strong|link|image)*>
+<!ATTLIST link Url CDATA #REQUIRED>
+<!ATTLIST link Title CDATA #IMPLIED>
+<!ELEMENT image
+(text|softbreak|linebreak|code|inline_html|emph|strong|link|image)*>
+<!ATTLIST image url CDATA #REQUIRED>
+<!ATTLIST image title CDATA #IMPLIED>
<!ATTLIST ANY sourcepos CDATA #IMPLIED>
diff --git a/src/xml.c b/src/xml.c
index 86fb6d4..1ec1d7d 100644
--- a/src/xml.c
+++ b/src/xml.c
@@ -45,7 +45,8 @@ S_render_node(cmark_node *node, cmark_event_type ev_type, void *vstate)
if (entering) {
indent(state);
- cmark_strbuf_printf(xml, "<%s", cmark_node_type_string(node));
+ cmark_strbuf_printf(xml, "<%s",
+ cmark_node_get_type_string(node));
if (node->start_line != 0) {
cmark_strbuf_printf(xml, " sourcepos=\"%d:%d-%d\"",
@@ -65,7 +66,8 @@ S_render_node(cmark_node *node, cmark_event_type ev_type, void *vstate)
escape_xml(xml, node->as.literal.data,
node->as.literal.len);
cmark_strbuf_puts(xml, "</");
- cmark_strbuf_puts(xml, cmark_node_type_string(node));
+ cmark_strbuf_puts(xml,
+ cmark_node_get_type_string(node));
literal = true;
break;
case CMARK_NODE_CODE_BLOCK:
@@ -79,7 +81,8 @@ S_render_node(cmark_node *node, cmark_event_type ev_type, void *vstate)
escape_xml(xml, node->as.code.literal.data,
node->as.code.literal.len);
cmark_strbuf_puts(xml, "</");
- cmark_strbuf_puts(xml, cmark_node_type_string(node));
+ cmark_strbuf_puts(xml,
+ cmark_node_get_type_string(node));
literal = true;
break;
case CMARK_NODE_LINK:
@@ -105,7 +108,8 @@ S_render_node(cmark_node *node, cmark_event_type ev_type, void *vstate)
state->indent -= 2;
}
indent(state);
- cmark_strbuf_printf(xml, "</%s", cmark_node_type_string(node));
+ cmark_strbuf_printf(xml, "</%s",
+ cmark_node_get_type_string(node));
}
// TODO print attributes