Skip to content

Commit a9a357b

Browse files
committed
Allow --reference-doc to take URL argument.
Closes #8535.
1 parent 8a2418c commit a9a357b

File tree

4 files changed

+7
-4
lines changed

4 files changed

+7
-4
lines changed

MANUAL.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1129,7 +1129,7 @@ header when requesting a document from a URL:
11291129
user data directory (see `--data-dir`). If it is not
11301130
found there, sensible defaults will be used.
11311131

1132-
`--reference-doc=`*FILE*
1132+
`--reference-doc=`*FILE*|*URL*
11331133

11341134
: Use the specified file as a style reference in producing a
11351135
docx or ODT file.

src/Text/Pandoc/Writers/Docx.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,8 @@ writeDocx opts doc = do
134134
P.setUserDataDir oldUserDataDir
135135
let distArchive = toArchive $ BL.fromStrict res
136136
refArchive <- case writerReferenceDoc opts of
137-
Just f -> toArchive <$> P.readFileLazy f
137+
Just f -> toArchive . BL.fromStrict . fst
138+
<$> P.fetchItem (T.pack f)
138139
Nothing -> toArchive . BL.fromStrict <$>
139140
readDataFile "reference.docx"
140141

src/Text/Pandoc/Writers/ODT.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@ pandocToODT opts doc@(Pandoc meta _) = do
9494
lang <- toLang (getLang opts meta)
9595
refArchive <-
9696
case writerReferenceDoc opts of
97-
Just f -> liftM toArchive $ lift $ P.readFileLazy f
97+
Just f -> lift $ toArchive . B.fromStrict . fst <$>
98+
(P.fetchItem (T.pack f))
9899
Nothing -> lift $ toArchive . B.fromStrict <$>
99100
readDataFile "reference.odt"
100101
-- handle formulas and pictures

src/Text/Pandoc/Writers/Powerpoint/Output.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,8 @@ presentationToArchive opts meta pres = do
578578
distArchive <- toArchive . BL.fromStrict <$>
579579
readDefaultDataFile "reference.pptx"
580580
refArchive <- case writerReferenceDoc opts of
581-
Just f -> toArchive <$> P.readFileLazy f
581+
Just f -> toArchive . BL.fromStrict . fst
582+
<$> P.fetchItem (T.pack f)
582583
Nothing -> toArchive . BL.fromStrict <$>
583584
readDataFile "reference.pptx"
584585

0 commit comments

Comments
 (0)