citation-resolve-0.2.1: convert document IDs such as DOI, ISBN, arXiv ID to bibliographic reference.

Safe HaskellNone

Text.CSL.Input.Identifier.Internal

Synopsis

Documentation

>>> import Control.Applicative((<$>), (<*>))
>>> import Data.Either.Utils(forceEither)
>>> import Text.CSL

data WebCacheGeneric backend Source

data structure for accessing the reference cache database.

type Resolver a = String -> IO (Either String a)Source

Resolver is a function that converts a String key to some value a, which may fail with an error message.

cached :: Resolver ByteString -> Resolver ByteStringSource

Take a resolver, and make it cached.

resolveBibtex :: String -> Resolver ReferenceSource

parse a Bibtex entry obtained in various ways.

readID :: Resolver ReferenceSource

Multi-purpose reference ID resolver. Resolve String starting with arXiv:, isbn:, doi: to Reference .

>>> (==) <$> readArXiv "1204.4779" <*>  readID "arXiv:1204.4779"
True
>>> (==) <$> readDOI "10.1088/1749-4699/5/1/015003" <*> readID "doi:10.1088/1749-4699/5/1/015003"
True
>>> (==) <$> readISBN "9780199233212" <*> readID "isbn:9780199233212"
True

readDOI :: Resolver ReferenceSource

resolve a DOI to a Reference.

>>> ref <- forceEither <$> readDOI "10.1088/1749-4699/5/1/015003"
>>> title ref
"Paraiso: an automated tuning framework for explicit solvers of partial differential equations"
>>> putStrLn $ url ref
http://dx.doi.org/10.1088/1749-4699/5/1/015003

readArXiv :: Resolver ReferenceSource

resolve an arXiv ID to a Reference. If it's a referred journal paper, it can also resolve the refereed version of the paper.

>>> ref <- forceEither <$> readArXiv "1204.4779"
>>> title ref
"Paraiso: an automated tuning framework for explicit solvers of partial differential equations"
>>> containerTitle ref
"Computational Science and Discovery"

readBibcode :: Resolver ReferenceSource

resolve an Bibcode ID to a Reference.

>>> ref <- forceEither <$> readBibcode " 2012CS&D....5a5003M"
>>> title ref
"Paraiso: an automated tuning framework for explicit solvers of partial differential equations"
>>> containerTitle ref
"Computational Science and Discovery"

readISBN :: Resolver ReferenceSource

resolve an ISBN to a Reference.

>>> ref <- forceEither <$> readISBN "9780199233212"
>>> title ref
"The nature of computation"

getDataFileName :: String -> IO StringSource

a safer way to get data file name.