diff options
author | John MacFarlane <jgm@berkeley.edu> | 2014-11-22 22:39:26 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2014-11-22 22:39:26 -0800 |
commit | 4570eb2bff2e1b71fa5b6408abbc69c98ff5ff24 (patch) | |
tree | 16bab9f8f34dd6fc22a1b7f27b02b7f92b2939d6 /commonmark.rb | |
parent | a71423f6ee1b77d9f79d42599ea00b4ca99f5da0 (diff) |
Revert "Remove distinction btw atx and setext header in AST."
This reverts commit a71423f6ee1b77d9f79d42599ea00b4ca99f5da0.
Not quite sure about this change, so reverting for now.
Note that we still have a distinction between fenced and
indented code blocks in the AST. These two distinctions
seem to stand or fall together.
Diffstat (limited to 'commonmark.rb')
-rwxr-xr-x | commonmark.rb | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/commonmark.rb b/commonmark.rb index 94744dd..0140c1b 100755 --- a/commonmark.rb +++ b/commonmark.rb @@ -11,7 +11,7 @@ module CMark typedef :pointer, :node enum :node_type, [:document, :blockquote, :list, :list_item, :fenced_code, :indented_code, :html, :paragraph, - :header, :hrule, :reference_def, + :atx_header, :setext_header, :hrule, :reference_def, :str, :softbreak, :linebreak, :code, :inline_html, :emph, :strong, :link, :image] enum :list_type, [:no_list, :bullet_list, :ordered_list] @@ -55,7 +55,7 @@ class Node b = CMark::cmark_node_next(b) end @string_content = CMark::cmark_node_get_string_content(pointer) - if @type == :header + if @type == :atx_header || @type == :setext_header @header_level = CMark::cmark_node_get_header_level(pointer) end if @type == :list @@ -195,6 +195,14 @@ class Renderer self.code_block(node) end + def setext_header(node) + self.header(node) + end + + def atx_header(node) + self.header(node) + end + def reference_def(node) end @@ -367,7 +375,7 @@ end # Capitalize strings in headers doc.walk do |node| - if node.type == :header + if node.type == :setext_header or node.type == :atx_header node.walk do |subnode| if subnode.type == :str subnode.string_content = subnode.string_content.upcase |