packages feed

citation-resolve 0.3 → 0.3.0.2

raw patch · 3 files changed

+11/−7 lines, 3 filesPVP: minor bump suggested

API additions: PVP suggests at least a minor version bump

API changes (from Hackage documentation)

+ Text.CSL.Input.Identifier: DB :: Map String String -> DB
+ Text.CSL.Input.Identifier: newtype DB
+ Text.CSL.Input.Identifier: unDB :: DB -> Map String String
+ Text.CSL.Input.Identifier: withDBFile :: (MonadIO m, MonadState DB m) => FilePath -> m a -> m a

Files

citation-resolve.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/  name:                citation-resolve-version:             0.3+version:             0.3.0.2 synopsis:            convert document IDs such as DOI, ISBN, arXiv ID to bibliographic reference. description:            This modules provides a way to convert document identifiers, such
src/Text/CSL/Input/Identifier.hs view
@@ -11,7 +11,7 @@ --  making the server load as little as possible.  module Text.CSL.Input.Identifier-       (resolveEither, resolve)+       (resolveEither, resolve, withDBFile, DB(..))        where  import           Control.Monad.IO.Class@@ -28,10 +28,10 @@   --- | Resolve a document url to a 'Reference'. returns an empty reference when someting fails. +-- | 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 }@@ -43,12 +43,12 @@   resolve :: (MonadIO m, MonadState DB m) => String -> m Reference-resolve = liftM (either (const emptyReference) id) . runEitherT . resolveEither +resolve = liftM (either (const emptyReference) id) . runEitherT . resolveEither  -- | Resolve the document id using the default database.  resolveDef :: String -> IO Reference resolveDef url = do-  fn <- getDataFileName "default.db"             +  fn <- getDataFileName "default.db"   let go = withDBFile fn $ resolve url   State.evalStateT go def
src/Text/CSL/Input/Identifier/Internal.hs view
@@ -40,7 +40,11 @@   --- | The data structure that carries the resolved references.+-- | 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 DB,+--  rather  than 'Reference'. newtype DB = DB { unDB :: Map.Map String String}  -- | The lens for accessing the map within the DB.