diff options
| author | Albert Krewinkel <albert@zeitkraut.de> | 2022-07-28 19:50:00 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-07-28 10:50:00 -0700 |
| commit | aaf69044b19841854000fe1a27e85279dfa5b750 (patch) | |
| tree | 1ae6d0d9dad2fd097b525d6994f541595043d2e3 | |
| parent | 4ba72aaa2e5beb6b8b5bb300cc648313348b5af0 (diff) | |
Populate mediabag after filters have run. (#8114)
The mediabag is filled with document resources after the filters have
run. This allows, for example, filter authors to modify image paths
before pandoc tries to fetch the images.
Lua filters that rely on a filled mediabag can use the new
`pandoc.mediabag.fill` function to perform that action in the filter.
Closes: #8099
| -rw-r--r-- | src/Text/Pandoc/App.hs | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/Text/Pandoc/App.hs b/src/Text/Pandoc/App.hs index 2bddcf1a3..5a1f016e0 100644 --- a/src/Text/Pandoc/App.hs +++ b/src/Text/Pandoc/App.hs @@ -306,17 +306,16 @@ convertWithOpts opts = do >>= r readerOpts ByteStringReader r -> mconcat <$> mapM (r readerOpts . inputToLazyByteString) inputs) - >>= - ( (if not (optSandbox opts) && - (isJust (optExtractMedia opts) - || writerNameBase == "docx") -- for fallback pngs - then fillMediaBag - else return) - >=> return . adjustMetadata (metadataFromFile <>) + >>= ( return . adjustMetadata (metadataFromFile <>) >=> return . adjustMetadata (<> optMetadata opts) >=> return . adjustMetadata (<> cslMetadata) >=> applyTransforms transforms >=> applyFilters filterEnv filters [T.unpack format] + >=> (if not (optSandbox opts) && + (isJust (optExtractMedia opts) + || writerNameBase == "docx") -- for fallback pngs + then fillMediaBag + else return) >=> maybe return extractMedia (optExtractMedia opts) ) |
