aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Krotov <ilabdsf@gmail.com>2017-02-01 15:00:40 +0400
committerJohn MacFarlane <jgm@berkeley.edu>2017-02-01 12:00:40 +0100
commit59a2e5575a8349821a3d1108771527e47bb260e9 (patch)
tree4b1f45ff7daa230db8b65df67d4022c70c187878
parentd4d31840602fc654a5c0225a7d9144f4263aaa7b (diff)
downloadpandoc-59a2e5575a8349821a3d1108771527e47bb260e9.tar.gz
Reduce state in Org writer (#3404)
-rw-r--r--src/Text/Pandoc/Writers/Org.hs11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/Text/Pandoc/Writers/Org.hs b/src/Text/Pandoc/Writers/Org.hs
index 09c924397..316cc61cf 100644
--- a/src/Text/Pandoc/Writers/Org.hs
+++ b/src/Text/Pandoc/Writers/Org.hs
@@ -46,8 +46,6 @@ import Text.Pandoc.Class (PandocMonad)
data WriterState =
WriterState { stNotes :: [[Block]]
- , stLinks :: Bool
- , stImages :: Bool
, stHasMath :: Bool
, stOptions :: WriterOptions
}
@@ -55,8 +53,8 @@ data WriterState =
-- | Convert Pandoc to Org.
writeOrg :: PandocMonad m => WriterOptions -> Pandoc -> m String
writeOrg opts document = return $
- let st = WriterState { stNotes = [], stLinks = False,
- stImages = False, stHasMath = False,
+ let st = WriterState { stNotes = [],
+ stHasMath = False,
stOptions = opts }
in evalState (pandocToOrg document) st
@@ -361,13 +359,10 @@ inlineToOrg SoftBreak = do
inlineToOrg (Link _ txt (src, _)) = do
case txt of
[Str x] | escapeURI x == src -> -- autolink
- do modify $ \s -> s{ stLinks = True }
- return $ "[[" <> text (orgPath x) <> "]]"
+ do return $ "[[" <> text (orgPath x) <> "]]"
_ -> do contents <- inlineListToOrg txt
- modify $ \s -> s{ stLinks = True }
return $ "[[" <> text (orgPath src) <> "][" <> contents <> "]]"
inlineToOrg (Image _ _ (source, _)) = do
- modify $ \s -> s{ stImages = True }
return $ "[[" <> text (orgPath source) <> "]]"
inlineToOrg (Note contents) = do
-- add to notes in state