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.hs19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/Zettel/Render.hs b/src/Zettel/Render.hs
index 2451163..662742d 100644
--- a/src/Zettel/Render.hs
+++ b/src/Zettel/Render.hs
@@ -10,7 +10,7 @@ import System.FilePath ((<.>), (</>))
import Text.Pandoc.App (applyFilters)
import Text.Pandoc.Builder (HasMeta (..))
import Text.Pandoc.Class (runIOorExplode)
-import Text.Pandoc.Definition (Block (..), Inline (..))
+import Text.Pandoc.Definition (Block (..), Inline (..), Meta (..), MetaValue (..), Pandoc (..))
import Text.Pandoc.Extensions (Extension (..), disableExtension)
import Text.Pandoc.Filter (Environment (..), Filter (..))
import Text.Pandoc.Options (ReaderOptions (..), WriterOptions (..), getDefaultExtensions, multimarkdownExtensions)
@@ -91,8 +91,21 @@ renderZettelFile v csl bib dir ident zettel = do
t <- renderZettel csl bib ident zettel
writeFileText path t
where
- path = dir </> toString (unZettelId ident) <.> "md"
+ 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
+ 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 =
- forM_ (Map.assocs (unZettelGraph zg)) $ uncurry (renderZettelFile v csl bib fp)
+ forM_
+ (Map.assocs (unZettelGraph zg))
+ (uncurry (renderZettelFile v csl bib fp))
+ >> forM_
+ (Map.assocs (zettelGraphBib zg))
+ (uncurry (renderBibFile v csl bib fp))