From f3a80034fff41a8b0c13519fa13bed794db1b8d2 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sat, 30 Sep 2017 16:07:47 -0500 Subject: Removed writerSourceURL, add source URL to common state. Removed `writerSourceURL` from `WriterOptions` (API change). Added `stSourceURL` to `CommonState`. It is set automatically by `setInputFiles`. Text.Pandoc.Class now exports `setInputFiles`, `setOutputFile`. The type of `getInputFiles` has changed; it now returns `[FilePath]` instead of `Maybe [FilePath]`. Functions in Class that formerly took the source URL as a parameter now have one fewer parameter (`fetchItem`, `downloadOrRead`, `setMediaResource`, `fillMediaBag`). Removed `WriterOptions` parameter from `makeSelfContained` in `SelfContained`. --- src/Text/Pandoc/Readers/RST.hs | 2 +- src/Text/Pandoc/Readers/Txt2Tags.hs | 10 ++-------- 2 files changed, 3 insertions(+), 9 deletions(-) (limited to 'src/Text/Pandoc/Readers') diff --git a/src/Text/Pandoc/Readers/RST.hs b/src/Text/Pandoc/Readers/RST.hs index daaeff2f0..2d6bb979f 100644 --- a/src/Text/Pandoc/Readers/RST.hs +++ b/src/Text/Pandoc/Readers/RST.hs @@ -850,7 +850,7 @@ csvTableDirective top fields rawcsv = do rawcsv' <- case trim <$> lookup "file" fields `mplus` lookup "url" fields of Just u -> do - (bs, _) <- fetchItem Nothing u + (bs, _) <- fetchItem u return $ UTF8.toString bs Nothing -> return rawcsv let res = parseCSV opts (T.pack $ case explicitHeader of diff --git a/src/Text/Pandoc/Readers/Txt2Tags.hs b/src/Text/Pandoc/Readers/Txt2Tags.hs index f000646c2..2d3e541cf 100644 --- a/src/Text/Pandoc/Readers/Txt2Tags.hs +++ b/src/Text/Pandoc/Readers/Txt2Tags.hs @@ -70,14 +70,8 @@ instance Default T2TMeta where -- | Get the meta information required by Txt2Tags macros getT2TMeta :: PandocMonad m => m T2TMeta getT2TMeta = do - mbInps <- P.getInputFiles - let inps = case mbInps of - Just x -> x - Nothing -> [] - mbOutp <- P.getOutputFile - let outp = case mbOutp of - Just x -> x - Nothing -> "" + inps <- P.getInputFiles + outp <- fromMaybe "" <$> P.getOutputFile curDate <- formatTime defaultTimeLocale "%F" <$> P.getZonedTime let getModTime = fmap (formatTime defaultTimeLocale "%T") . P.getModificationTime -- cgit v1.2.3