diff options
author | John MacFarlane <jgm@berkeley.edu> | 2015-12-29 19:51:08 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2015-12-29 19:52:06 -0800 |
commit | b27783e2ecf5715c9bdf209793a67380a87e65b5 (patch) | |
tree | 890328540ef2a619eb10b7a8a5885a40aa61fe72 /src/Text/Pandoc/Readers | |
parent | 59d6f02a9af4ea47d001c84527df77f26d2d1fdd (diff) | |
download | pandoc-b27783e2ecf5715c9bdf209793a67380a87e65b5.tar.gz |
Use cmark 0.5.
Closes #2605.
Diffstat (limited to 'src/Text/Pandoc/Readers')
-rw-r--r-- | src/Text/Pandoc/Readers/CommonMark.hs | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Readers/CommonMark.hs b/src/Text/Pandoc/Readers/CommonMark.hs index 71c7d05b2..d20d386e7 100644 --- a/src/Text/Pandoc/Readers/CommonMark.hs +++ b/src/Text/Pandoc/Readers/CommonMark.hs @@ -58,15 +58,19 @@ addBlocks = foldr addBlock [] addBlock :: Node -> [Block] -> [Block] addBlock (Node _ PARAGRAPH nodes) = (Para (addInlines nodes) :) -addBlock (Node _ HRULE _) = +addBlock (Node _ THEMATIC_BREAK _) = (HorizontalRule :) addBlock (Node _ BLOCK_QUOTE nodes) = (BlockQuote (addBlocks nodes) :) -addBlock (Node _ (HTML t) _) = +addBlock (Node _ (HTML_BLOCK t) _) = (RawBlock (Format "html") (unpack t) :) +-- Note: the cmark parser will never generate CUSTOM_BLOCK, +-- so we don't need to handle it: +addBlock (Node _ (CUSTOM_BLOCK _onEnter _onExit) _nodes) = + id addBlock (Node _ (CODE_BLOCK info t) _) = (CodeBlock ("", take 1 (words (unpack info)), []) (unpack t) :) -addBlock (Node _ (HEADER lev) nodes) = +addBlock (Node _ (HEADING lev) nodes) = (Header lev ("",[],[]) (addInlines nodes) :) addBlock (Node _ (LIST listAttrs) nodes) = (constructor (map (setTightness . addBlocks . children) nodes) :) @@ -104,8 +108,12 @@ addInline (Node _ (TEXT t) _) = (map toinl clumps ++) toinl xs = Str xs addInline (Node _ LINEBREAK _) = (LineBreak :) addInline (Node _ SOFTBREAK _) = (SoftBreak :) -addInline (Node _ (INLINE_HTML t) _) = +addInline (Node _ (HTML_INLINE t) _) = (RawInline (Format "html") (unpack t) :) +-- Note: the cmark parser will never generate CUSTOM_BLOCK, +-- so we don't need to handle it: +addInline (Node _ (CUSTOM_INLINE _onEnter _onExit) _nodes) = + id addInline (Node _ (CODE t) _) = (Code ("",[],[]) (unpack t) :) addInline (Node _ EMPH nodes) = |