pandoc-crossref-0.3.15.0: Pandoc filter for cross-references
CopyrightCopyright (C) 2015 Nikolay Yakimov
LicenseGNU GPL, version 2 or above
MaintainerNikolay Yakimov <root@livid.pp.ru>
Stabilityalpha
Portabilityportable
Safe HaskellSafe-Inferred
LanguageHaskell2010

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")
Synopsis

Documentation

crossRefBlocks :: [Block] -> CrossRefM [Block] Source #

Walk over blocks, while inserting cross-references, list-of, etc.

Works in CrossRefM monad.

crossRefMeta :: CrossRefM Meta Source #

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.

runCrossRef :: forall a b. Meta -> Maybe Format -> (a -> CrossRefM b) -> a -> b Source #

Run an action in CrossRefM monad with argument, and return pure result.

This is primary function to work with CrossRefM

runCrossRefIO :: forall a b. Meta -> Maybe Format -> (a -> CrossRefM b) -> a -> IO b Source #

Run an action in CrossRefM monad with argument, and return IO result.

This function will attempt to read pandoc-crossref settings from settings file specified by crossrefYaml metadata field.

type CrossRefM a = Reader CrossRefEnv a Source #

Essentially a reader monad for basic pandoc-crossref environment

data CrossRefEnv Source #

Enviromnent for CrossRefM

Constructors

CrossRefEnv 

Fields