From b27783e2ecf5715c9bdf209793a67380a87e65b5 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Tue, 29 Dec 2015 19:51:08 -0800 Subject: Use cmark 0.5. Closes #2605. --- src/Text/Pandoc/Readers/CommonMark.hs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'src/Text/Pandoc/Readers') 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) = -- cgit v1.2.3