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

Safe HaskellNone

Text.CSL.Input.Identifier

Description

This modules provides a way to convert document identifiers, such as DOIs, ISBNs, arXiv IDs to bibliographic references.

Each type of identifiers will be converted via internet services to a bibliographic record of type Reference , which in turn can be rendered in various format using citeproc-hs package hackage.haskell.org/package/citeproc-hs .

Moreover, the server responses are cached in a local database, making the server load as little as possible.

Synopsis

Documentation

resolveEither :: forall m s. (MonadIO m, MonadState s m, HasDatabase s) => String -> EitherT String m ReferenceSource

resolve a document url to a Reference, or emits a error message with reason why it fails.

resolve :: (MonadIO m, MonadState s m, HasDatabase s) => String -> m ReferenceSource

Resolve a document url to a Reference. returns an empty reference when someting fails. prefix the document ID with one of arXiv:, doi:, bibcode: or isbn: .

>>> do { ref <- resolveDef "arXiv:1204.4779" ; putStrLn $ title ref }
Paraiso: an automated tuning framework for explicit solvers of partial differential equations
>>> do { ref <- resolveDef "doi:10.1088/1749-4699/5/1/015003" ; print $ author ref }
[Takayuki Muranushi]
>>> do { ref <- resolveDef "bibcode:2012CS&D....5a5003M" ; putStrLn $ containerTitle ref }
Computational Science and Discovery
>>> do { ref <- resolveDef "isbn:9784274068850" ; putStrLn $ title ref }
Sugoi hasukeru tanoshiku manabō

withDatabaseFile :: (MonadIO m, MonadState s m, HasDatabase s) => FilePath -> m a -> m aSource

Excecute the program using the given database file. The file will be created if it didn't exist.

newtype Database Source

The data structure that carries the resolved references. Since the mapping Reference -> BibTeX is not the inverse of BibTeX -> Reference for the version citeproc-hs-0.3.8 and loses some information, we choose to store the original BibTeX string in the Database, rather than Reference.

Constructors

Database 

class HasDatabase t whereSource

The lens for accessing the map within the Database.

resolveDef :: String -> IO ReferenceSource

Resolve the document id using the default database.

toBibTeXItem :: (MonadIO m, MonadState s m, HasDatabase s) => String -> m TextSource

Access the resolver database and generate the BibTeX item string for the document, using the url as the citation-key.