git.iko.soy/typeable/pandoc
on master help sign in
Reduce state in Org writer (#3404)
commit59a2e5575a8349821a3d1108771527e47bb260e9 authorAlexander Krotov <ilabdsf@gmail.com> dateWed 1 Feb 2017, 15:00 (10 years ago) parentd4d3184
1 file changed+3−8
src/Text/Pandoc/Writers/Org.hs+3−8
src/Text/Pandoc/Writers/Org.hs+3−8
@@ -46,8 +46,6 @@ import Text.Pandoc.Class (PandocMonad)
4646
4747data WriterState =
4848 WriterState { stNotes :: [[Block]]
49− , stLinks :: Bool
50− , stImages :: Bool
5149 , stHasMath :: Bool
5250 , stOptions :: WriterOptions
5351 }
@@ -55,8 +53,8 @@ data WriterState =
5553-- | Convert Pandoc to Org.
5654writeOrg :: PandocMonad m => WriterOptions -> Pandoc -> m String
5755writeOrg opts document = return $
58− let st = WriterState { stNotes = [], stLinks = False,
59− stImages = False, stHasMath = False,
56+ let st = WriterState { stNotes = [],
57+ stHasMath = False,
6058 stOptions = opts }
6159 in evalState (pandocToOrg document) st
6260
@@ -361,13 +359,10 @@ inlineToOrg SoftBreak = do
361359inlineToOrg (Link _ txt (src, _)) = do
362360 case txt of
363361 [Str x] | escapeURI x == src -> -- autolink
364− do modify $ \s -> s{ stLinks = True }
365− return $ "[[" <> text (orgPath x) <> "]]"
362+ do return $ "[[" <> text (orgPath x) <> "]]"
366363 _ -> do contents <- inlineListToOrg txt
367− modify $ \s -> s{ stLinks = True }
368364 return $ "[[" <> text (orgPath src) <> "][" <> contents <> "]]"
369365inlineToOrg (Image _ _ (source, _)) = do
370− modify $ \s -> s{ stImages = True }
371366 return $ "[[" <> text (orgPath source) <> "]]"
372367inlineToOrg (Note contents) = do
373368 -- add to notes in state