aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2014-07-30 17:25:00 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2014-07-30 17:25:00 -0700
commit71e76175be8a5fabb807a8462a1ab315868c8914 (patch)
tree82434ee8fe339ee2ca9bc9d3d0d544fa15925adc /src
parent3e26fb517d935f26868685a884a6c192826413a1 (diff)
downloadpandoc-71e76175be8a5fabb807a8462a1ab315868c8914.tar.gz
getT2TMeta: Take list of source files instead of single.
Get latest modification time.
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Readers/Txt2Tags.hs15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/Text/Pandoc/Readers/Txt2Tags.hs b/src/Text/Pandoc/Readers/Txt2Tags.hs
index 8d8af309e..3a51b9d84 100644
--- a/src/Text/Pandoc/Readers/Txt2Tags.hs
+++ b/src/Text/Pandoc/Readers/Txt2Tags.hs
@@ -70,14 +70,15 @@ instance Default T2TMeta where
def = T2TMeta "" "" "" ""
-- | Get the meta information required by Txt2Tags macros
-getT2TMeta :: FilePath -> FilePath -> IO T2TMeta
-getT2TMeta inp out = do
+getT2TMeta :: [FilePath] -> FilePath -> IO T2TMeta
+getT2TMeta inps out = do
curDate <- formatTime defaultTimeLocale "%F" <$> getZonedTime
- let getModTime = formatTime defaultTimeLocale "%F"
- <$> getModificationTime inp
- curMtime <- catchIOError getModTime (const (return ""))
-
- return $ T2TMeta curDate curMtime inp out
+ let getModTime = fmap (formatTime defaultTimeLocale "%F") .
+ getModificationTime
+ curMtime <- catchIOError
+ (maximum <$> mapM getModTime inps)
+ (const (return ""))
+ return $ T2TMeta curDate curMtime (intercalate ", " inps) out
-- | Read Txt2Tags from an input string returning a Pandoc document
readTxt2Tags :: T2TMeta -> ReaderOptions -> String -> Pandoc