aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Options.hs
diff options
context:
space:
mode:
authorJesse Rosenthal <jrosenthal@jhu.edu>2016-02-20 21:27:08 -0500
committerJesse Rosenthal <jrosenthal@jhu.edu>2016-03-15 12:52:51 -0400
commit5c055b4cf3cdfac534a74c5c5775aa2d58889150 (patch)
tree3b470812f963b018eb7a3660e3a76352bc41fb4d /src/Text/Pandoc/Options.hs
parent68fd333ec4475c5a524004bcf2e76a7959dc3afa (diff)
downloadpandoc-5c055b4cf3cdfac534a74c5c5775aa2d58889150.tar.gz
Introduce file-scope parsing (parse-before-combine)
Traditionally pandoc operates on multiple files by first concetenating them (around extra line breaks) and then processing the joined file. So it only parses a multi-file document at the document scope. This has the benefit that footnotes and links can be in different files, but it also introduces a couple of difficulties: - it is difficult to join files with footnotes without some sort of preprocessing, which makes it difficult to write academic documents in small pieces. - it makes it impossible to process multiple binary input files, which can't be catted. - it makes it impossible to process files from different input formats. This commit introduces alternative method. Instead of catting the files first, it parses the files first, and then combines the parsed output. This makes it impossible to have links across multiple files, and auto-identified headers won't work correctly if headers in multiple files have the same name. On the other hand, footnotes across multiple files will work correctly and will allow more freedom for input formats. Since ByteStringReaders can currently only read one binary file, and will ignore subsequent files, we also changes the behavior to automatically parse before combining if using the ByteStringReader. If we use one file, it will work as normal. If there is more than one file it will combine them after parsing (assuming that the format is the same). Note that this is intended to be an optional method, defaulting to off. Turn it on with `--file-scope`.
Diffstat (limited to 'src/Text/Pandoc/Options.hs')
-rw-r--r--src/Text/Pandoc/Options.hs2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/Text/Pandoc/Options.hs b/src/Text/Pandoc/Options.hs
index 333f499fb..b5736c63d 100644
--- a/src/Text/Pandoc/Options.hs
+++ b/src/Text/Pandoc/Options.hs
@@ -264,6 +264,7 @@ data ReaderOptions = ReaderOptions{
, readerDefaultImageExtension :: String -- ^ Default extension for images
, readerTrace :: Bool -- ^ Print debugging info
, readerTrackChanges :: TrackChanges
+ , readerFileScope :: Bool -- ^ Parse before combining
} deriving (Show, Read, Data, Typeable, Generic)
instance Default ReaderOptions
@@ -280,6 +281,7 @@ instance Default ReaderOptions
, readerDefaultImageExtension = ""
, readerTrace = False
, readerTrackChanges = AcceptChanges
+ , readerFileScope = False
}
--