git.iko.soy/typeable/pandoc
on master help sign in
Use getTimestamp instead of getCurrentTime in writers.

Setting SOURCE_DATE_EPOCH will allow reproducible builds. Partially addresses #7093. This does not suffice to fully enable reproducible in EPUB, since a unique id is being generated for each build.

commit390d5e65b2d66078b2f9b9db142dbe2167ea29a9 authorJohn MacFarlane <jgm@berkeley.edu> dateWed 10 Feb 2021, 23:13 (6 years ago) parent3c4a58b
5 files changed+7−7
src/Text/Pandoc/Readers/RST.hs+2−2 src/Text/Pandoc/Writers/Docx.hs+1−1 src/Text/Pandoc/Writers/EPUB.hs+2−2 src/Text/Pandoc/Writers/ODT.hs+1−1 src/Text/Pandoc/Writers/Powerpoint/Output.hs+1−1
src/Text/Pandoc/Readers/RST.hs+2−2
@@ -28,7 +28,7 @@ import qualified Data.Text as T
2828import Text.Pandoc.Builder (Blocks, Inlines, fromList, setMeta, trimInlines)
2929import qualified Text.Pandoc.Builder as B
3030import Text.Pandoc.Class.PandocMonad (PandocMonad, fetchItem,
31− readFileFromDirs, getCurrentTime)
31+ readFileFromDirs, getTimestamp)
3232import Text.Pandoc.CSV (CSVOptions (..), defaultCSVOptions, parseCSV)
3333import Text.Pandoc.Definition
3434import Text.Pandoc.Error
@@ -685,7 +685,7 @@ directive' = do
685685 "replace" -> B.para <$> -- consumed by substKey
686686 parseInlineFromText (trim top)
687687 "date" -> B.para <$> do -- consumed by substKey
688− t <- getCurrentTime
688+ t <- getTimestamp
689689 let format = case T.unpack (T.strip top) of
690690 [] -> "%Y-%m-%d"
691691 x -> x
src/Text/Pandoc/Writers/Docx.hs+1−1
@@ -217,7 +217,7 @@ writeDocx opts doc = do
217217 let doc' = Pandoc meta blocks'
218218
219219 username <- P.lookupEnv "USERNAME"
220− utctime <- P.getCurrentTime
220+ utctime <- P.getTimestamp
221221 oldUserDataDir <- P.getUserDataDir
222222 P.setUserDataDir Nothing
223223 res <- P.readDefaultDataFile "reference.docx"
src/Text/Pandoc/Writers/EPUB.hs+2−2
@@ -191,7 +191,7 @@ getEPUBMetadata opts meta = do
191191 let fixDate m =
192192 if null (epubDate m)
193193 then do
194− currentTime <- lift P.getCurrentTime
194+ currentTime <- lift P.getTimestamp
195195 return $ m{ epubDate = [ Date{
196196 dateText = showDateTimeISO8601 currentTime
197197 , dateEvent = Nothing } ] }
@@ -709,7 +709,7 @@ pandocToEPUB version opts doc = do
709709 uuid <- case epubIdentifier metadata of
710710 (x:_) -> return $ identifierText x -- use first identifier as UUID
711711 [] -> throwError $ PandocShouldNeverHappenError "epubIdentifier is null" -- shouldn't happen
712− currentTime <- lift P.getCurrentTime
712+ currentTime <- lift P.getTimestamp
713713 let contentsData = UTF8.fromStringLazy $ ppTopElement $
714714 unode "package" !
715715 ([("version", case version of
src/Text/Pandoc/Writers/ODT.hs+1−1
@@ -68,7 +68,7 @@ pandocToODT :: PandocMonad m
6868pandocToODT opts doc@(Pandoc meta _) = do
6969 let title = docTitle meta
7070 let authors = docAuthors meta
71− utctime <- P.getCurrentTime
71+ utctime <- P.getTimestamp
7272 lang <- toLang (getLang opts meta)
7373 refArchive <-
7474 case writerReferenceDoc opts of
src/Text/Pandoc/Writers/Powerpoint/Output.hs+1−1
@@ -312,7 +312,7 @@ presentationToArchive opts pres = do
312312 Nothing -> toArchive . BL.fromStrict <$>
313313 P.readDataFile "reference.pptx"
314314
315− utctime <- P.getCurrentTime
315+ utctime <- P.getTimestamp
316316
317317 presSize <- case getPresentationSize refArchive distArchive of
318318 Just sz -> return sz