Skip to content

Commit

Permalink
Allow --reference-doc to take URL argument.
Browse files Browse the repository at this point in the history
Closes jgm#8535.
  • Loading branch information
jgm authored and liruqi committed Mar 3, 2023
1 parent 6e93bc5 commit b7ffe58
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion MANUAL.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1129,7 +1129,7 @@ header when requesting a document from a URL:
user data directory (see `--data-dir`). If it is not
found there, sensible defaults will be used.

`--reference-doc=`*FILE*
`--reference-doc=`*FILE*|*URL*

: Use the specified file as a style reference in producing a
docx or ODT file.
Expand Down
3 changes: 2 additions & 1 deletion src/Text/Pandoc/Writers/Docx.hs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ writeDocx opts doc = do
P.setUserDataDir oldUserDataDir
let distArchive = toArchive $ BL.fromStrict res
refArchive <- case writerReferenceDoc opts of
Just f -> toArchive <$> P.readFileLazy f
Just f -> toArchive . BL.fromStrict . fst
<$> P.fetchItem (T.pack f)
Nothing -> toArchive . BL.fromStrict <$>
readDataFile "reference.docx"

Expand Down
3 changes: 2 additions & 1 deletion src/Text/Pandoc/Writers/ODT.hs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ pandocToODT opts doc@(Pandoc meta _) = do
lang <- toLang (getLang opts meta)
refArchive <-
case writerReferenceDoc opts of
Just f -> liftM toArchive $ lift $ P.readFileLazy f
Just f -> lift $ toArchive . B.fromStrict . fst <$>
(P.fetchItem (T.pack f))
Nothing -> lift $ toArchive . B.fromStrict <$>
readDataFile "reference.odt"
-- handle formulas and pictures
Expand Down
3 changes: 2 additions & 1 deletion src/Text/Pandoc/Writers/Powerpoint/Output.hs
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,8 @@ presentationToArchive opts meta pres = do
distArchive <- toArchive . BL.fromStrict <$>
readDefaultDataFile "reference.pptx"
refArchive <- case writerReferenceDoc opts of
Just f -> toArchive <$> P.readFileLazy f
Just f -> toArchive . BL.fromStrict . fst
<$> P.fetchItem (T.pack f)
Nothing -> toArchive . BL.fromStrict <$>
readDataFile "reference.pptx"

Expand Down

0 comments on commit b7ffe58

Please sign in to comment.