@@ -48,18 +48,14 @@ import Text.Pandoc.Walk (walkM)
48-- | Parse a CommonMark formatted string into a 'Pandoc' structure.
48-- | Parse a CommonMark formatted string into a 'Pandoc' structure.
49readCommonMark :: PandocMonad m => ReaderOptions -> Text -> m Pandoc
49readCommonMark :: PandocMonad m => ReaderOptions -> Text -> m Pandoc
50readCommonMark opts s = return $
50readCommonMark opts s = return $
51− (if enabled Ext_gfm_auto_identifiers opts
51+ (if isEnabled Ext_gfm_auto_identifiers opts
52 then addHeaderIdentifiers
52 then addHeaderIdentifiers
53 else id) $
53 else id) $
54 nodeToPandoc opts $ commonmarkToNode opts' exts s
54 nodeToPandoc opts $ commonmarkToNode opts' exts s
55− where opts' = [ optSmart | enabled Ext_smart opts ]
55+ where opts' = [ optSmart | isEnabled Ext_smart opts ]
56− exts = [ extStrikethrough | enabled Ext_strikeout opts ] ++
56+ exts = [ extStrikethrough | isEnabled Ext_strikeout opts ] ++
57− [ extTable | enabled Ext_pipe_tables opts ] ++
57+ [ extTable | isEnabled Ext_pipe_tables opts ] ++
58− [ extAutolink | enabled Ext_autolink_bare_uris opts ]
58+ [ extAutolink | isEnabled Ext_autolink_bare_uris opts ]
60−-- | Returns True if the given extension is enabled.
61−enabled :: Extension -> ReaderOptions -> Bool
62−enabled ext opts = ext `extensionEnabled` readerExtensions opts
64convertEmojis :: String -> String
60convertEmojis :: String -> String
65convertEmojis (':':xs) =
61convertEmojis (':':xs) =
@@ -112,7 +108,7 @@ addBlock _ (Node _ THEMATIC_BREAK _) =
112addBlock opts (Node _ BLOCK_QUOTE nodes) =
108addBlock opts (Node _ BLOCK_QUOTE nodes) =
113 (BlockQuote (addBlocks opts nodes) :)
109 (BlockQuote (addBlocks opts nodes) :)
114addBlock opts (Node _ (HTML_BLOCK t) _)
110addBlock opts (Node _ (HTML_BLOCK t) _)
115− | enabled Ext_raw_html opts = (RawBlock (Format "html") (unpack t) :)
111+ | isEnabled Ext_raw_html opts = (RawBlock (Format "html") (unpack t) :)
116 | otherwise = id
112 | otherwise = id
117-- Note: the cmark parser will never generate CUSTOM_BLOCK,
113-- Note: the cmark parser will never generate CUSTOM_BLOCK,
118-- so we don't need to handle it:
114-- so we don't need to handle it:
@@ -210,15 +206,15 @@ addInline opts (Node _ (TEXT t) _) = (map toinl clumps ++)
210 samekind _ ' ' = False
206 samekind _ ' ' = False
211 samekind _ _ = True
207 samekind _ _ = True
212 toinl (' ':_) = Space
208 toinl (' ':_) = Space
213− toinl xs = Str $ if enabled Ext_emoji opts
209+ toinl xs = Str $ if isEnabled Ext_emoji opts
214 then convertEmojis xs
210 then convertEmojis xs
216addInline _ (Node _ LINEBREAK _) = (LineBreak :)
212addInline _ (Node _ LINEBREAK _) = (LineBreak :)
217addInline opts (Node _ SOFTBREAK _)
213addInline opts (Node _ SOFTBREAK _)
218− | enabled Ext_hard_line_breaks opts = (LineBreak :)
214+ | isEnabled Ext_hard_line_breaks opts = (LineBreak :)
219 | otherwise = (SoftBreak :)
215 | otherwise = (SoftBreak :)
220addInline opts (Node _ (HTML_INLINE t) _)
216addInline opts (Node _ (HTML_INLINE t) _)
221− | enabled Ext_raw_html opts = (RawInline (Format "html") (unpack t) :)
217+ | isEnabled Ext_raw_html opts = (RawInline (Format "html") (unpack t) :)
222 | otherwise = id
218 | otherwise = id
223-- Note: the cmark parser will never generate CUSTOM_BLOCK,
219-- Note: the cmark parser will never generate CUSTOM_BLOCK,
224-- so we don't need to handle it:
220-- so we don't need to handle it: