hs-bibutils-6.7.0.0: Haskell bindings to bibutils, the bibliography conversion utilities.

Copyright(C) 2008 Andrea Rossato
LicenseBSD3
Maintainervhaisman@gmail.com
Stabilityprovisional
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

Text.Bibutils

Contents

Description

Here is a simple program using hs-bibutils to conver a MODS collection into a bibtex file, sending the output to stdout:

import Text.Bibutils

main :: IO ()
main = do
  bibl  <- bibl_init
  param <- bibl_initparams mods_in bibtex_out "mods2bibtex"
  setFormatOpts param [bibout_brackets, bibout_uppercase]
  setBOM        param
  setVerbose    param
  bibl_read     param bibl "/path/to/bibtex.bib"
  bibl_write    param bibl "-"
  bibl_free       bibl
  bibl_freeparams param
Synopsis

Basic Functions

data Bibl Source #

A type for storing the C struct with the bibliography data. Mostly opaque to the Haskell side. See numberOfRefs to retrieve the number of references stored in the struct.

Instances
Storable Bibl Source # 
Instance details

Defined in Text.Bibutils

Methods

sizeOf :: Bibl -> Int

alignment :: Bibl -> Int

peekElemOff :: Ptr Bibl -> Int -> IO Bibl

pokeElemOff :: Ptr Bibl -> Int -> Bibl -> IO ()

peekByteOff :: Ptr b -> Int -> IO Bibl

pokeByteOff :: Ptr b -> Int -> Bibl -> IO ()

peek :: Ptr Bibl -> IO Bibl

poke :: Ptr Bibl -> Bibl -> IO ()

data Param Source #

A type for storing the Param C struct. It should be accessed with the functions provided, such as setCharsetIn, etc.

Constructors

Param 

Fields

Instances
Show Param Source # 
Instance details

Defined in Text.Bibutils

Methods

showsPrec :: Int -> Param -> ShowS

show :: Param -> String

showList :: [Param] -> ShowS

Storable Param Source # 
Instance details

Defined in Text.Bibutils

Methods

sizeOf :: Param -> Int

alignment :: Param -> Int

peekElemOff :: Ptr Param -> Int -> IO Param

pokeElemOff :: Ptr Param -> Int -> Param -> IO ()

peekByteOff :: Ptr b -> Int -> IO Param

pokeByteOff :: Ptr b -> Int -> Param -> IO ()

peek :: Ptr Param -> IO Param

poke :: Ptr Param -> Param -> IO ()

bibl_init :: IO (ForeignPtr Bibl) Source #

Initialize the Bibl C struct. Usually the first function being called.

bibl_initparams :: BiblioIn -> BiblioOut -> String -> IO (ForeignPtr Param) Source #

Initialize the Param C struct, given the input bibliographic format, the output bibliographic format, and the program name to be used for displaying debugging information.

bibl_read :: ForeignPtr Param -> ForeignPtr Bibl -> FilePath -> IO Status Source #

Given a Param C structure, a Bibl C structure, the path to the input file ("-" for the standard input), read the file, storing the data in the Bibl struct, and report a Status.

bibl_write :: ForeignPtr Param -> ForeignPtr Bibl -> FilePath -> IO Status Source #

Given a Param C structure, a Bibl C structure, the path to an output file ("-" for the standard output), write the file returning a Status.

bibl_readasis :: ForeignPtr Param -> FilePath -> IO () Source #

bibl_addtoasis :: ForeignPtr Param -> String -> IO () Source #

bibl_readcorps :: ForeignPtr Param -> FilePath -> IO () Source #

bibl_addtocorps :: ForeignPtr Param -> String -> IO () Source #

bibl_free :: ForeignPtr Bibl -> IO () Source #

Free the Bibl C struct.

bibl_freeparams :: ForeignPtr Param -> IO () Source #

Free the Param C struct.

Auxiliary Functions

numberOfRefs :: ForeignPtr Bibl -> IO Int Source #

Retrieve the number of references from a Bibl C struct.

status :: Status -> CInt Source #

Functions for Setting Parameters

setParam :: ForeignPtr Param -> (Param -> Param) -> IO () Source #

Set fields of the Param C struct directly.

setFormatOpts :: ForeignPtr Param -> [FormatOpt] -> IO () Source #

Set output format specific options. See FormatOpt.

setCharsetIn :: ForeignPtr Param -> Charset -> IO () Source #

Set the input charset. Default is Latin-1 (ISO8859-1). See Charset.

setCharsetOut :: ForeignPtr Param -> Charset -> IO () Source #

Set the output charset.

setBOM :: ForeignPtr Param -> IO () Source #

Write utf8 byte-order-mark.

unsetBOM :: ForeignPtr Param -> IO () Source #

setNoSplitTitle :: ForeignPtr Param -> IO () Source #

Do not split titles.

unsetNoSplitTitle :: ForeignPtr Param -> IO () Source #

Split titles.

setLatexOut :: ForeignPtr Param -> IO () Source #

Write Latex codes.

unsetLatexOut :: ForeignPtr Param -> IO () Source #

setXmlOut :: ForeignPtr Param -> IO () Source #

Write characters in XML entities.

unsetXmlOut :: ForeignPtr Param -> IO () Source #

setAddcount :: ForeignPtr Param -> IO () Source #

Add reference count to reference id.

unsetAddcount :: ForeignPtr Param -> IO () Source #

setSinglerefperfile :: ForeignPtr Param -> IO () Source #

Output a single reference for each file.

unsetSinglerefperfile :: ForeignPtr Param -> IO () Source #

setOutputRawOpts :: ForeignPtr Param -> [Raw] -> IO () Source #

Set the output charset.

setVerbose :: ForeignPtr Param -> IO () Source #

Verbose output.

setVerboseLevel :: ForeignPtr Param -> Int -> IO () Source #

Verbose output.

unsetVerbose :: ForeignPtr Param -> IO () Source #

Suppress verbose output.

Input Formats

data BiblioIn Source #

Instances
Eq BiblioIn Source # 
Instance details

Defined in Text.Bibutils

Methods

(==) :: BiblioIn -> BiblioIn -> Bool

(/=) :: BiblioIn -> BiblioIn -> Bool

Output Formats

data BiblioOut Source #

Instances
Eq BiblioOut Source # 
Instance details

Defined in Text.Bibutils

Methods

(==) :: BiblioOut -> BiblioOut -> Bool

(/=) :: BiblioOut -> BiblioOut -> Bool

Options for Specific Output Formats

Charsets

data Charset Source #

Instances
Eq Charset Source # 
Instance details

Defined in Text.Bibutils

Methods

(==) :: Charset -> Charset -> Bool

(/=) :: Charset -> Charset -> Bool

Return Status

data Status Source #

Instances
Eq Status Source # 
Instance details

Defined in Text.Bibutils

Methods

(==) :: Status -> Status -> Bool

(/=) :: Status -> Status -> Bool

Show Status Source # 
Instance details

Defined in Text.Bibutils

Methods

showsPrec :: Int -> Status -> ShowS

show :: Status -> String

showList :: [Status] -> ShowS

Raw

data Raw Source #

Instances
Eq Raw Source # 
Instance details

Defined in Text.Bibutils

Methods

(==) :: Raw -> Raw -> Bool

(/=) :: Raw -> Raw -> Bool

Show Raw Source # 
Instance details

Defined in Text.Bibutils

Methods

showsPrec :: Int -> Raw -> ShowS

show :: Raw -> String

showList :: [Raw] -> ShowS