| Copyright | (C) 2008 Andrea Rossato | 
|---|---|
| License | BSD3 | 
| Maintainer | vhaisman@gmail.com | 
| Stability | provisional | 
| Portability | portable | 
| Safe Haskell | None | 
| Language | Haskell2010 | 
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
- 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 ()
 - setOutputRawOpts :: ForeignPtr Param -> [Raw] -> IO ()
 - setVerbose :: ForeignPtr Param -> IO ()
 - setVerboseLevel :: ForeignPtr Param -> Int -> 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
 - ebi_in :: BiblioIn
 - word_in :: BiblioIn
 - nbib_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
 - nbib_out :: BiblioOut
 - data FormatOpt
 - bibout_finalcomma :: FormatOpt
 - bibout_singledash :: FormatOpt
 - bibout_whitespace :: FormatOpt
 - bibout_brackets :: FormatOpt
 - bibout_uppercase :: FormatOpt
 - bibout_strictkey :: FormatOpt
 - bibout_shorttitle :: FormatOpt
 - bibout_dropkey :: FormatOpt
 - modsout_dropkey :: FormatOpt
 - data Charset
 - bibl_charset_unknown :: Charset
 - bibl_charset_unicode :: Charset
 - bibl_charset_gb18030 :: Charset
 - bibl_charset_default :: Charset
 - bibl_charset_utf8_default :: Charset
 - bibl_charset_bom_default :: Charset
 - data Status
 - bibl_ok :: Status
 - bibl_err_badinput :: Status
 - bibl_err_memerr :: Status
 - bibl_err_cantopen :: Status
 - data Raw
 - bibl_raw_with_charset_convert :: Raw
 - bibl_raw_with_make_ref_id :: Raw
 
Basic Functions
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 # | |
Defined in Text.Bibutils  | |
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 # | |
| Storable Param Source # | |
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 #
bibl_write :: ForeignPtr Param -> ForeignPtr Bibl -> FilePath -> IO Status Source #
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_freeparams :: ForeignPtr Param -> IO () Source #
Free the Param C struct.
bibl_reporterr :: Status -> IO () Source #
Auxiliary Functions
numberOfRefs :: ForeignPtr Bibl -> IO Int Source #
Retrieve the number of references from a Bibl C struct.
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.
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 #
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.