aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers/CommonMark.hs
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2020-02-07 08:32:47 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2020-02-07 09:08:22 -0800
commit4c3db9273fc8e92c2c23d4455a6ab178472be06d (patch)
treecdfc8d65ebd56c0a571f8b46854465dd434489de /src/Text/Pandoc/Writers/CommonMark.hs
parent6cd77d4c638012be63d66882403804aa28feb6ed (diff)
downloadpandoc-4c3db9273fc8e92c2c23d4455a6ab178472be06d.tar.gz
Apply linter suggestions. Add fix_spacing to lint target in Makefile.
Diffstat (limited to 'src/Text/Pandoc/Writers/CommonMark.hs')
-rw-r--r--src/Text/Pandoc/Writers/CommonMark.hs16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/Text/Pandoc/Writers/CommonMark.hs b/src/Text/Pandoc/Writers/CommonMark.hs
index 815750a4e..41680aa3d 100644
--- a/src/Text/Pandoc/Writers/CommonMark.hs
+++ b/src/Text/Pandoc/Writers/CommonMark.hs
@@ -45,9 +45,7 @@ writeCommonMark opts (Pandoc meta blocks) = do
else return mempty
let (blocks', notes) = runState (walkM processNotes blocks) []
- notes' = if null notes
- then []
- else [OrderedList (1, Decimal, Period) $ reverse notes]
+ notes' = [OrderedList (1, Decimal, Period) $ reverse notes | not (null notes)]
main <- blocksToCommonMark opts (blocks' ++ notes')
metadata <- metaToContext opts
(fmap (literal . T.stripEnd) . blocksToCommonMark opts)
@@ -241,13 +239,11 @@ inlineToNodes opts SoftBreak
| otherwise = (node SOFTBREAK [] :)
inlineToNodes opts (Emph xs) = (node EMPH (inlinesToNodes opts xs) :)
inlineToNodes opts (Strong xs) = (node STRONG (inlinesToNodes opts xs) :)
-inlineToNodes opts (Strikeout xs) =
- if isEnabled Ext_strikeout opts
- then (node (CUSTOM_INLINE "~~" "~~") (inlinesToNodes opts xs) :)
- else if isEnabled Ext_raw_html opts
- then ((node (HTML_INLINE (T.pack "<s>")) [] : inlinesToNodes opts xs ++
- [node (HTML_INLINE (T.pack "</s>")) []]) ++ )
- else (inlinesToNodes opts xs ++)
+inlineToNodes opts (Strikeout xs)
+ | isEnabled Ext_strikeout opts = (node (CUSTOM_INLINE "~~" "~~") (inlinesToNodes opts xs) :)
+ | isEnabled Ext_raw_html opts = ((node (HTML_INLINE (T.pack "<s>")) [] : inlinesToNodes opts xs ++
+ [node (HTML_INLINE (T.pack "</s>")) []]) ++ )
+ | otherwise = (inlinesToNodes opts xs ++)
inlineToNodes opts (Superscript xs) =
if isEnabled Ext_raw_html opts
then ((node (HTML_INLINE (T.pack "<sup>")) [] : inlinesToNodes opts xs ++