diff options
| author | John MacFarlane <jgm@berkeley.edu> | 2023-01-30 18:41:44 -0800 |
|---|---|---|
| committer | John MacFarlane <jgm@berkeley.edu> | 2023-01-30 21:09:02 -0800 |
| commit | 8fc4fc66a31a7a13db9072ebdf0c3f017d6ec51e (patch) | |
| tree | bdef1df49034727a5cb1cf4821aa7e92a306c006 /src/Text/Pandoc/App/Opt.hs | |
| parent | 1193bb59641f0fa0ab033d0382916be4c83e07da (diff) | |
Add new `--chunk-template` option (closes #8581).
* Add `--chunk-template` CLI option, allowing more control over the
chunk filenames in chunked HTML output.
* Text.Pandoc.App: Add `optChunkTemplate` constructor to Opt [API change].
* Text.Pandoc.Options: add `writerChunkTemplate` contsructor to
WriterOptions [API change].
* Text.Pandoc.Chunks: add Data, Typeable, Generic instances for
PathTemplate.
Diffstat (limited to 'src/Text/Pandoc/App/Opt.hs')
| -rw-r--r-- | src/Text/Pandoc/App/Opt.hs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/Text/Pandoc/App/Opt.hs b/src/Text/Pandoc/App/Opt.hs index 762305170..aa24690dd 100644 --- a/src/Text/Pandoc/App/Opt.hs +++ b/src/Text/Pandoc/App/Opt.hs @@ -127,6 +127,7 @@ data Opt = Opt , optAbbreviations :: Maybe FilePath -- ^ Path to abbrevs file , optReferenceDoc :: Maybe FilePath -- ^ Path of reference doc , optSplitLevel :: Int -- ^ Header level at which to split documents in epub and chunkedhtml + , optChunkTemplate :: Maybe Text -- ^ Template to use for chunk filenames , optEpubSubdirectory :: String -- ^ EPUB subdir in OCF container , optEpubMetadata :: Maybe FilePath -- ^ EPUB metadata , optEpubFonts :: [FilePath] -- ^ EPUB fonts to embed @@ -209,6 +210,7 @@ instance FromJSON Opt where <*> o .:? "reference-doc" <*> ((o .:? "split-level") <|> (o .:? "epub-chapter-level")) .!= optSplitLevel defaultOpts + <*> o .:? "chunk-template" <*> o .:? "epub-subdirectory" .!= optEpubSubdirectory defaultOpts <*> o .:? "epub-metadata" <*> o .:? "epub-fonts" .!= optEpubFonts defaultOpts @@ -563,6 +565,8 @@ doOpt (k,v) = do parseJSON v >>= \x -> return (\o -> o{ optSplitLevel = x }) "split-level" -> parseJSON v >>= \x -> return (\o -> o{ optSplitLevel = x }) + "chunk-template" -> + parseJSON v >>= \x -> return (\o -> o{ optChunkTemplate = Just x }) "epub-cover-image" -> parseJSON v >>= \x -> return (\o -> o{ optEpubCoverImage = unpack <$> x }) @@ -740,6 +744,7 @@ defaultOpts = Opt , optAbbreviations = Nothing , optReferenceDoc = Nothing , optSplitLevel = 1 + , optChunkTemplate = Nothing , optEpubSubdirectory = "EPUB" , optEpubMetadata = Nothing , optEpubFonts = [] |
