hs-bibutils-0.3: Haskell bindings to bibutils, the bibliography conversion utilities.Source codeContentsIndex
Text.Bibutils
Portabilityportable
Stabilityprovisional
Maintainerandrea.rossato@unitn.it
Contents
Basic Functions
Auxiliary Functions
Functions for Setting Parameters
Input Formats
Output Formats
Options for Specific Output Formats
Charsets
Return Status
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
data Bibl
data Param = Param {
redaformat :: CInt
writeformat :: CInt
charsetin :: CInt
charsetin_src :: CUChar
latexin :: CUChar
utf8in :: CUChar
xmlin :: CUChar
nosplittitle :: CUChar
charsetout :: CInt
charsetout_src :: CUChar
latexout :: CUChar
utf8out :: CUChar
utf8bom :: CUChar
xmlout :: CUChar
format_opts :: CInt
addcount :: CInt
output_raw :: CUChar
verbose :: CUChar
singlerefperfile :: CUChar
}
bibl_init :: IO (ForeignPtr Bibl)
bibl_initparams :: BiblioIn -> BiblioOut -> String -> IO (ForeignPtr Param)
bibl_read :: ForeignPtr Param -> ForeignPtr Bibl -> FilePath -> IO Status
bibl_write :: ForeignPtr Param -> ForeignPtr Bibl -> FilePath -> IO Status
bibl_readasis :: ForeignPtr Param -> FilePath -> IO ()
bibl_addtoasis :: ForeignPtr Param -> String -> IO ()
bibl_readcorps :: ForeignPtr Param -> FilePath -> IO ()
bibl_addtocorps :: ForeignPtr Param -> String -> IO ()
bibl_free :: ForeignPtr Bibl -> IO ()
bibl_freeparams :: ForeignPtr Param -> IO ()
bibl_reporterr :: Status -> IO ()
numberOfRefs :: ForeignPtr Bibl -> IO Int
status :: Status -> CInt
setParam :: ForeignPtr Param -> (Param -> Param) -> IO ()
setFormatOpts :: ForeignPtr Param -> [FormatOpt] -> IO ()
setCharsetIn :: ForeignPtr Param -> Charset -> IO ()
setCharsetOut :: ForeignPtr Param -> Charset -> IO ()
setBOM :: ForeignPtr Param -> IO ()
unsetBOM :: ForeignPtr Param -> IO ()
setNoSplitTitle :: ForeignPtr Param -> IO ()
unsetNoSplitTitle :: ForeignPtr Param -> IO ()
setLatexOut :: ForeignPtr Param -> IO ()
unsetLatexOut :: ForeignPtr Param -> IO ()
setXmlOut :: ForeignPtr Param -> IO ()
unsetXmlOut :: ForeignPtr Param -> IO ()
setAddcount :: ForeignPtr Param -> IO ()
unsetAddcount :: ForeignPtr Param -> IO ()
setSinglerefperfile :: ForeignPtr Param -> IO ()
unsetSinglerefperfile :: ForeignPtr Param -> IO ()
setVerbose :: ForeignPtr Param -> IO ()
unsetVerbose :: ForeignPtr Param -> IO ()
data BiblioIn
mods_in :: BiblioIn
bibtex_in :: BiblioIn
ris_in :: BiblioIn
endnote_in :: BiblioIn
copac_in :: BiblioIn
isi_in :: BiblioIn
medline_in :: BiblioIn
biblatex_in :: BiblioIn
endnotexml_in :: BiblioIn
data BiblioOut
mods_out :: BiblioOut
bibtex_out :: BiblioOut
ris_out :: BiblioOut
endnote_out :: BiblioOut
isi_out :: BiblioOut
word2007_out :: BiblioOut
adsab_out :: BiblioOut
data FormatOpt
bibout_finalcomma :: FormatOpt
bibout_singledash :: FormatOpt
bibout_whitespace :: FormatOpt
bibout_brackets :: FormatOpt
bibout_uppercase :: FormatOpt
bibout_strictkey :: FormatOpt
modsout_dropkey :: FormatOpt
wordout_dropkey :: FormatOpt
data Charset
bibl_charset_unknown :: Charset
bibl_charset_unicode :: Charset
bibl_charset_gb18030 :: Charset
bibl_charset_default :: Charset
data Status
bibl_ok :: Status
bibl_err_badinput :: Status
bibl_err_memerr :: Status
bibl_err_cantopen :: Status
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.
show/hide Instances
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
redaformat :: CInt
writeformat :: CInt
charsetin :: CInt
charsetin_src :: CUChar
latexin :: CUChar
utf8in :: CUChar
xmlin :: CUChar
nosplittitle :: CUChar
charsetout :: CInt
charsetout_src :: CUChar
latexout :: CUChar
utf8out :: CUChar
utf8bom :: CUChar
xmlout :: CUChar
format_opts :: CInt
addcount :: CInt
output_raw :: CUChar
verbose :: CUChar
singlerefperfile :: CUChar
show/hide Instances
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 StatusSource
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 StatusSource
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.
bibl_reporterr :: Status -> IO ()Source
Auxiliary Functions
numberOfRefs :: ForeignPtr Bibl -> IO IntSource
Retrieve the number of references from a Bibl C struct.
status :: Status -> CIntSource
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
setVerbose :: ForeignPtr Param -> IO ()Source
Verbose output.
unsetVerbose :: ForeignPtr Param -> IO ()Source
Suppress verbose output.
Input Formats
data BiblioIn Source
show/hide Instances
mods_in :: BiblioInSource
bibtex_in :: BiblioInSource
ris_in :: BiblioInSource
endnote_in :: BiblioInSource
copac_in :: BiblioInSource
isi_in :: BiblioInSource
medline_in :: BiblioInSource
biblatex_in :: BiblioInSource
endnotexml_in :: BiblioInSource
Output Formats
data BiblioOut Source
show/hide Instances
mods_out :: BiblioOutSource
bibtex_out :: BiblioOutSource
ris_out :: BiblioOutSource
endnote_out :: BiblioOutSource
isi_out :: BiblioOutSource
word2007_out :: BiblioOutSource
adsab_out :: BiblioOutSource
Options for Specific Output Formats
data FormatOpt Source
bibout_finalcomma :: FormatOptSource
bibout_singledash :: FormatOptSource
bibout_whitespace :: FormatOptSource
bibout_brackets :: FormatOptSource
bibout_uppercase :: FormatOptSource
bibout_strictkey :: FormatOptSource
modsout_dropkey :: FormatOptSource
wordout_dropkey :: FormatOptSource
Charsets
data Charset Source
show/hide Instances
bibl_charset_unknown :: CharsetSource
bibl_charset_unicode :: CharsetSource
bibl_charset_gb18030 :: CharsetSource
bibl_charset_default :: CharsetSource
Return Status
data Status Source
show/hide Instances
bibl_ok :: StatusSource
bibl_err_badinput :: StatusSource
bibl_err_memerr :: StatusSource
bibl_err_cantopen :: StatusSource
Produced by Haddock version 2.4.2