diff options
| author | John MacFarlane <[email protected]> | 2024-06-30 11:32:16 -0600 |
|---|---|---|
| committer | John MacFarlane <[email protected]> | 2024-07-01 08:56:17 -0600 |
| commit | 3fe1f0fe20226144d992e1be2a378aa7f69d884a (patch) | |
| tree | 354d8bc773f39d558c4fdcb83b56a5e2b69429c1 /src/Text/Pandoc/App | |
| parent | 51f3da649c7832f6b92b66dbb58a77f5d6d28360 (diff) | |
Add option to link rather than embedding images in ODT.link-images
New cli option: `--link-images`. This causes images to be linked
rather than embedded in ODT.
New field in WriterOptions: `writerLinkImages` [API change].
New field in Opt: `optLinkImages` [API change].
Closes #9815.
Diffstat (limited to 'src/Text/Pandoc/App')
| -rw-r--r-- | src/Text/Pandoc/App/CommandLineOptions.hs | 8 | ||||
| -rw-r--r-- | src/Text/Pandoc/App/Opt.hs | 5 | ||||
| -rw-r--r-- | src/Text/Pandoc/App/OutputSettings.hs | 1 |
3 files changed, 14 insertions, 0 deletions
diff --git a/src/Text/Pandoc/App/CommandLineOptions.hs b/src/Text/Pandoc/App/CommandLineOptions.hs index c3abe1ba1..c50ec6208 100644 --- a/src/Text/Pandoc/App/CommandLineOptions.hs +++ b/src/Text/Pandoc/App/CommandLineOptions.hs @@ -601,6 +601,14 @@ options = "true|false") "" -- "Make slide shows include all the needed js and css" + , Option "" ["link-images"] -- maybe True (\argStr -> argStr == "true") arg + (OptArg + (\arg opt -> do + boolValue <- readBoolFromOptArg "--link-images" arg + return opt { optLinkImages = boolValue }) + "true|false") + "" -- "Link images in ODT rather than embedding them" + , Option "" ["request-header"] (ReqArg (\arg opt -> do diff --git a/src/Text/Pandoc/App/Opt.hs b/src/Text/Pandoc/App/Opt.hs index c1f16279c..b6050f117 100644 --- a/src/Text/Pandoc/App/Opt.hs +++ b/src/Text/Pandoc/App/Opt.hs @@ -119,6 +119,7 @@ data Opt = Opt , optIncremental :: Bool -- ^ Use incremental lists in Slidy/Slideous/S5 , optSelfContained :: Bool -- ^ Make HTML accessible offline (deprecated) , optEmbedResources :: Bool -- ^ Make HTML accessible offline + , optLinkImages :: Bool -- ^ Link ODT images rather than embedding , optHtmlQTags :: Bool -- ^ Use <q> tags in HTML , optHighlightStyle :: Maybe Text -- ^ Style to use for highlighted code , optSyntaxDefinitions :: [FilePath] -- ^ xml syntax defs to load @@ -201,6 +202,7 @@ instance FromJSON Opt where <*> o .:? "incremental" .!= optIncremental defaultOpts <*> o .:? "self-contained" .!= optSelfContained defaultOpts <*> o .:? "embed-resources" .!= optEmbedResources defaultOpts + <*> o .:? "link-images" .!= optLinkImages defaultOpts <*> o .:? "html-q-tags" .!= optHtmlQTags defaultOpts <*> o .:? "highlight-style" <*> o .:? "syntax-definitions" .!= optSyntaxDefinitions defaultOpts @@ -526,6 +528,8 @@ doOpt (k,v) = do parseJSON v >>= \x -> return (\o -> o{ optSelfContained = x }) "embed-resources" -> parseJSON v >>= \x -> return (\o -> o{ optEmbedResources = x }) + "link-images" -> + parseJSON v >>= \x -> return (\o -> o{ optLinkImages = x }) "html-q-tags" -> parseJSON v >>= \x -> return (\o -> o{ optHtmlQTags = x }) "highlight-style" -> @@ -738,6 +742,7 @@ defaultOpts = Opt , optIncremental = False , optSelfContained = False , optEmbedResources = False + , optLinkImages = False , optHtmlQTags = False , optHighlightStyle = Just "pygments" , optSyntaxDefinitions = [] diff --git a/src/Text/Pandoc/App/OutputSettings.hs b/src/Text/Pandoc/App/OutputSettings.hs index d08cb626b..11d813e5e 100644 --- a/src/Text/Pandoc/App/OutputSettings.hs +++ b/src/Text/Pandoc/App/OutputSettings.hs @@ -262,6 +262,7 @@ optToOutputSettings scriptingEngine opts = do , writerReferenceDoc = optReferenceDoc opts , writerSyntaxMap = syntaxMap , writerPreferAscii = optAscii opts + , writerLinkImages = optLinkImages opts } return $ OutputSettings { outputFormat = format |
