| Copyright | Copyright (C) 2015 Nikolay Yakimov |
|---|---|
| License | GNU GPL, version 2 or above |
| Maintainer | Nikolay Yakimov <root@livid.pp.ru> |
| Stability | alpha |
| Portability | portable |
| Safe Haskell | None |
| Language | Haskell2010 |
Text.Pandoc.CrossRef
Description
Public interface to pandoc-crossref library
Example of use:
import Text.Pandoc
import Text.Pandoc.JSON
import Text.Pandoc.CrossRef
main :: IO ()
main = toJSONFilter go
where
go fmt p@(Pandoc meta _) = runCrossRefIO meta fmt action p
where
action (Pandoc _ bs) = do
meta' <- crossRefMeta
bs' <- crossRefBlocks bs
return $ Pandoc meta' bs'This module also exports utility functions for setting up meta-settings for
pandoc-crossref. Refer to documentation for a complete list of metadata field
names. All functions accept a single argument of type, returned by
Text.Pandoc.Builder functions, and return Meta.
Example:
runCrossRefIO meta fmt crossRefBlocks blocks
where
meta =
figureTitle (str "Figura")
<> tableTitle (str "Tabla")
<> figPrefix (str "fig.")
<> eqnPrefix (str "ec.")
<> tblPrefix (str "tbl.")
<> loftitle (header 1 $ text "Lista de figuras")
<> lotTitle (header 1 $ text "Lista de tablas")
<> chaptersDepth (MetaString "2")- crossRefBlocks :: [Block] -> CrossRefM [Block]
- crossRefMeta :: CrossRefM Meta
- defaultCrossRefAction :: Pandoc -> CrossRefM Pandoc
- runCrossRef :: forall a b. Meta -> Maybe Format -> (a -> CrossRefM b) -> a -> b
- runCrossRefIO :: forall a b. Meta -> Maybe Format -> (a -> CrossRefM b) -> a -> IO b
- type CrossRefM a = Reader CrossRefEnv a
- data CrossRefEnv = CrossRefEnv {
- creSettings :: Meta
- creOptions :: Options
Documentation
crossRefBlocks :: [Block] -> CrossRefM [Block] #
Walk over blocks, while inserting cross-references, list-of, etc.
Works in CrossRefM monad.
crossRefMeta :: CrossRefM Meta #
Modifies metadata for LaTeX output, adding header-includes instructions to setup custom and builtin environments.
Note, that if output format is not "latex", this function does nothing.
Works in CrossRefM monad.
defaultCrossRefAction :: Pandoc -> CrossRefM Pandoc #
Combines crossRefMeta and crossRefBlocks
Works in CrossRefM monad.
type CrossRefM a = Reader CrossRefEnv a #
Essentially a reader monad for basic pandoc-crossref environment
data CrossRefEnv #
Enviromnent for CrossRefM
Constructors
| CrossRefEnv | |
Fields
| |