aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Text/Pandoc/Options.hs2
-rw-r--r--src/Text/Pandoc/Parsing.hs2
-rw-r--r--src/Text/Pandoc/Readers/Markdown.hs4
-rw-r--r--src/pandoc.hs4
4 files changed, 6 insertions, 6 deletions
diff --git a/src/Text/Pandoc/Options.hs b/src/Text/Pandoc/Options.hs
index 063162718..64c3709e1 100644
--- a/src/Text/Pandoc/Options.hs
+++ b/src/Text/Pandoc/Options.hs
@@ -61,6 +61,7 @@ data ReaderOptions = ReaderOptions{
-- in parsing dashes; -- is em-dash;
-- - before numerial is en-dash
, readerLiterateHaskell :: Bool -- ^ Interpret as literate Haskell
+ , readerCitations :: [String] -- ^ List of available citations
} deriving (Show, Read)
instance Default ReaderOptions
@@ -73,4 +74,5 @@ instance Default ReaderOptions
, readerTabStop = 4
, readerOldDashes = False
, readerLiterateHaskell = False
+ , readerCitations = []
}
diff --git a/src/Text/Pandoc/Parsing.hs b/src/Text/Pandoc/Parsing.hs
index a266c527e..997316180 100644
--- a/src/Text/Pandoc/Parsing.hs
+++ b/src/Text/Pandoc/Parsing.hs
@@ -693,7 +693,6 @@ data ParserState = ParserState
stateMaxNestingLevel :: Int, -- ^ Max # of nested Strong/Emph
stateLastStrPos :: Maybe SourcePos, -- ^ Position after last str parsed
stateKeys :: KeyTable, -- ^ List of reference keys
- stateCitations :: [String], -- ^ List of available citations
stateNotes :: NoteTable, -- ^ List of notes
stateTitle :: [Inline], -- ^ Title of document
stateAuthors :: [[Inline]], -- ^ Authors of document
@@ -720,7 +719,6 @@ defaultParserState =
stateMaxNestingLevel = 6,
stateLastStrPos = Nothing,
stateKeys = M.empty,
- stateCitations = [],
stateNotes = [],
stateTitle = [],
stateAuthors = [],
diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs
index 4f1831baf..f6f23faed 100644
--- a/src/Text/Pandoc/Readers/Markdown.hs
+++ b/src/Text/Pandoc/Readers/Markdown.hs
@@ -1405,8 +1405,8 @@ citeKey = try $ do
let internal p = try $ p >>~ lookAhead (letter <|> digit)
rest <- many $ letter <|> digit <|> internal (oneOf ":.#$%&-_?<>~")
let key = first:rest
- st <- getState
- guard $ key `elem` stateCitations st
+ citations' <- getOption readerCitations
+ guard $ key `elem` citations'
return (suppress_author, key)
suffix :: Parser [Char] ParserState [Inline]
diff --git a/src/pandoc.hs b/src/pandoc.hs
index 884e851f9..a0404d9e6 100644
--- a/src/pandoc.hs
+++ b/src/pandoc.hs
@@ -936,8 +936,7 @@ main = do
then "."
else takeDirectory (head sources)
- let startParserState = def{ stateCitations = map CSL.refId refs,
- stateOptions = def{
+ let startParserState = def{ stateOptions = def{
readerStrict = strict
, readerSmart = smart || (texLigatures &&
(laTeXOutput || writerName' == "context"))
@@ -948,6 +947,7 @@ main = do
, readerLiterateHaskell =
"+lhs" `isSuffixOf` readerName' ||
lhsExtension sources
+ , readerCitations = map CSL.refId refs
},
stateIndentedCodeClasses = codeBlockClasses,
stateApplyMacros = not laTeXOutput