Skip to content

Commit 4f20a61

Browse files
committed
processPandocBiblio: Document
1 parent 3bdb0c8 commit 4f20a61

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

Diff for: lib/Hakyll/Web/Pandoc/Biblio.hs

+30
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,42 @@ readPandocBiblios ropt csl biblios item = do
110110

111111

112112
--------------------------------------------------------------------------------
113+
114+
-- | Process a bibliography file with the given style.
115+
--
116+
-- This function supports pandoc's
117+
-- <https://pandoc.org/chunkedhtml-demo/9.6-including-uncited-items-in-the-bibliography.html nocite>
118+
-- functionality when there is a @nocite@ metadata field present.
119+
--
120+
-- ==== __Example__
121+
--
122+
-- In your main function, first compile the respective files:
123+
--
124+
-- > main = hakyll $ do
125+
-- > …
126+
-- > match "style.csl" $ compile cslCompiler
127+
-- > match "bib.bib" $ compile biblioCompiler
128+
--
129+
-- Then, create a function like the following:
130+
--
131+
-- > processBib :: Item Pandoc -> Compiler (Item Pandoc)
132+
-- > processBib pandoc = do
133+
-- > csl <- load @CSL "bib/style.csl"
134+
-- > bib <- load @Biblio "bib/bibliography.bib"
135+
-- > processPandocBiblio csl bib pandoc
136+
--
137+
-- Now, feed this function to your pandoc compiler:
138+
--
139+
-- > myCompiler :: Compiler (Item String)
140+
-- > myCompiler = pandocItemCompilerWithTransformM myReader myWriter processBib
113141
processPandocBiblio :: Item CSL
114142
-> Item Biblio
115143
-> (Item Pandoc)
116144
-> Compiler (Item Pandoc)
117145
processPandocBiblio csl biblio = processPandocBiblios csl [biblio]
118146

147+
-- | Like 'processPandocBiblio', which see, but support multiple bibliography
148+
-- files.
119149
processPandocBiblios :: Item CSL
120150
-> [Item Biblio]
121151
-> (Item Pandoc)

0 commit comments

Comments
 (0)