summaryrefslogtreecommitdiffstats
path: root/src/Zettel/Render.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Zettel/Render.hs')
-rw-r--r--src/Zettel/Render.hs21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/Zettel/Render.hs b/src/Zettel/Render.hs
index 662742d..8f9fbe5 100644
--- a/src/Zettel/Render.hs
+++ b/src/Zettel/Render.hs
@@ -19,6 +19,7 @@ import Text.Pandoc.Templates (WithDefaultPartials (..), compileTemplate)
import Text.Pandoc.Walk (query)
import Text.Pandoc.Writers (writeMarkdown)
import Zettel.Types
+import Control.Logging
zettelIdToLink :: ZettelId -> Inline
zettelIdToLink ident = Link mempty [Str $ "#" <> unZettelId ident] ("/" <> unZettelId ident, "")
@@ -85,27 +86,27 @@ renderZettel csl bib _ zettel = do
>>= writeMarkdown writeOpts
else writeMarkdown writeOpts zettel.zettelBody
-renderZettelFile :: Bool -> FilePath -> Maybe FilePath -> FilePath -> ZettelId -> Zettel -> IO ()
-renderZettelFile v csl bib dir ident zettel = do
- when v . putStrLn $ "Writing " <> path
+renderZettelFile :: FilePath -> Maybe FilePath -> FilePath -> ZettelId -> Zettel -> IO ()
+renderZettelFile csl bib dir ident zettel = do
+ log $ "Writing " <> T.pack path
t <- renderZettel csl bib ident zettel
writeFileText path t
where
path = dir </> "zettel" </> toString (unZettelId ident) <.> "md"
-renderBibFile :: Bool -> FilePath -> Maybe FilePath -> FilePath -> BibId -> Zettel -> IO ()
-renderBibFile v csl bib dir (BibId ident) zettel = do
- when v . putStrLn $ "Writing " <> path
+renderBibFile :: FilePath -> Maybe FilePath -> FilePath -> BibId -> Zettel -> IO ()
+renderBibFile csl bib dir (BibId ident) zettel = do
+ log $ "Writing " <> T.pack path
t <- renderZettel csl bib (ZettelId ident) zettel
writeFileText path t
where
path = dir </> "bib" </> toString ident <.> "md"
-renderZettelGraphFile :: Bool -> FilePath -> Maybe FilePath -> FilePath -> ZettelGraph -> IO ()
-renderZettelGraphFile v csl bib fp zg =
+renderZettelGraphFile :: FilePath -> Maybe FilePath -> FilePath -> ZettelGraph -> IO ()
+renderZettelGraphFile csl bib fp zg =
forM_
(Map.assocs (unZettelGraph zg))
- (uncurry (renderZettelFile v csl bib fp))
+ (uncurry (renderZettelFile csl bib fp))
>> forM_
(Map.assocs (zettelGraphBib zg))
- (uncurry (renderBibFile v csl bib fp))
+ (uncurry (renderBibFile csl bib fp))