aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2020-10-05 16:58:55 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2020-10-05 16:58:58 -0700
commit4dac62ef3a0377f2c748b348d3c7fa11a1d689f6 (patch)
treead4ec086129a789eb5300e767f7752d9c445c9a3 /src/Text/Pandoc
parent128991d4a43238cc92febd167b8babf38649f6e2 (diff)
downloadpandoc-4dac62ef3a0377f2c748b348d3c7fa11a1d689f6.tar.gz
Use yamlToMeta for yaml bibliography
This speeds up parsing of external yaml bibliographies considerably (in one test 36s -> 17s).
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r--src/Text/Pandoc/Citeproc.hs9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/Text/Pandoc/Citeproc.hs b/src/Text/Pandoc/Citeproc.hs
index de7f3273f..feb9be4f1 100644
--- a/src/Text/Pandoc/Citeproc.hs
+++ b/src/Text/Pandoc/Citeproc.hs
@@ -18,12 +18,13 @@ import Text.Pandoc.Citeproc.Locator (parseLocator)
import Text.Pandoc.Citeproc.CslJson (cslJsonToReferences)
import Text.Pandoc.Citeproc.BibTeX (readBibtexString, Variant(..))
import Text.Pandoc.Citeproc.MetaValue (metaValueToReference, metaValueToText)
+import Text.Pandoc.Readers.Markdown (yamlToMeta)
import Data.ByteString (ByteString)
import qualified Data.ByteString.Lazy as L
import Text.Pandoc.Definition as Pandoc
import Text.Pandoc.Walk
import Text.Pandoc.Builder as B
-import Text.Pandoc (PandocMonad(..), PandocError(..), readMarkdown,
+import Text.Pandoc (PandocMonad(..), PandocError(..),
readDataFile, ReaderOptions(..), pandocExtensions,
report, LogMessage(..), fetchItem)
import Text.Pandoc.Shared (stringify, ordNub, blocksToInlines)
@@ -203,10 +204,8 @@ getRefs locale format idpred raw =
(return . filter (idpred . unItemId . referenceId)) .
cslJsonToReferences $ raw
Format_yaml -> do
- Pandoc meta _ <-
- readMarkdown
- def{ readerExtensions = pandocExtensions }
- (UTF8.toText raw)
+ meta <- yamlToMeta def{ readerExtensions = pandocExtensions }
+ (L.fromStrict raw)
case lookupMeta "references" meta of
Just (MetaList rs) ->
return $ mapMaybe (metaValueToReference idpred) rs