epub-metadata 4.2 → 4.3
raw patch · 43 files changed
+80/−94 lines, 43 filessetup-changedPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- LICENSE +1/−1
- README.md +9/−9
- Setup.hs +0/−1
- TODO +0/−9
- TODO.md +10/−0
- changelog.md +10/−0
- doc/examples/README +1/−1
- doc/hcar/epubmetadata-De.tex +8/−5
- epub-metadata.cabal +6/−6
- src/Codec/Epub.hs +0/−1
- src/Codec/Epub/Data/Common.hs +0/−1
- src/Codec/Epub/Data/Guide.hs +0/−1
- src/Codec/Epub/Data/Manifest.hs +0/−1
- src/Codec/Epub/Data/Metadata.hs +0/−1
- src/Codec/Epub/Data/Package.hs +0/−1
- src/Codec/Epub/Data/Spine.hs +0/−1
- src/Codec/Epub/Format.hs +0/−1
- src/Codec/Epub/Format/Guide.hs +0/−1
- src/Codec/Epub/Format/Manifest.hs +0/−1
- src/Codec/Epub/Format/Metadata.hs +0/−1
- src/Codec/Epub/Format/Package.hs +0/−1
- src/Codec/Epub/Format/Spine.hs +0/−1
- src/Codec/Epub/Format/Util.hs +0/−1
- src/Codec/Epub/IO.hs +1/−2
- src/Codec/Epub/Parse.hs +1/−2
- src/Codec/Epub/Parse/Guide.hs +0/−1
- src/Codec/Epub/Parse/Manifest.hs +0/−1
- src/Codec/Epub/Parse/Metadata.hs +0/−1
- src/Codec/Epub/Parse/Package.hs +0/−1
- src/Codec/Epub/Parse/Refinements.hs +0/−1
- src/Codec/Epub/Parse/Spine.hs +0/−1
- src/Codec/Epub/Parse/Util.hs +0/−1
- src/Codec/Epub/Util.hs +0/−1
- testsuite/Archive.hs +3/−4
- testsuite/Epub2/ParseGuide.hs +3/−4
- testsuite/Epub2/ParseMetadata.hs +4/−5
- testsuite/Epub3/ParseMetadata.hs +2/−3
- testsuite/ParseManifest.hs +3/−4
- testsuite/ParsePackage.hs +2/−3
- testsuite/ParseSpine.hs +4/−5
- testsuite/test-main.hs +0/−1
- util/prefs/boring +12/−6
- util/show-opf.hs +0/−1
LICENSE view
@@ -1,4 +1,4 @@-Copyright Dino Morelli 2010-2013+Copyright Dino Morelli 2010-2015 All rights reserved.
README.md view
@@ -65,7 +65,7 @@ ### Using this library Please see the [Haddock documentation](http://hackage.haskell.org/package/epub-metadata-4.0/docs/Codec-Epub.html) or source code for- [Codec.Epub](http://ui3.info/darcs/epub-metadata/src/Codec/Epub.hs)+ [Codec.Epub](http://hub.darcs.net/dino/epub-metadata/browse/src/Codec/Epub.hs) This file has a working example of using this library. @@ -73,17 +73,17 @@ ## Getting source - Download the cabalized source package [from Hackage](http://hackage.haskell.org/package/epub-metadata)-- Download the cabalized source tarball [from here](http://ui3.info/d/proj/epub-metadata/epub-metadata-4.2.tar.gz)-- Get the source with darcs: `$ darcs get http://ui3.info/darcs/epub-metadata`-- If you're just looking, [browse the source](http://ui3.info/darcs/epub-metadata)+- Get the source with cabal-install: `$ cabal get epub-metadata`+- Get the source with darcs: `$ darcs get http://hub.darcs.net/dino/epub-metadata`+- If you're just looking, [browse the source](http://hub.darcs.net/dino/epub-metadata) And once you have it, building the usual way: -> $ cabal configure --enable-tests-> $ cabal build-> $ cabal test-> $ cabal haddock-> $ cabal install+ $ cabal configure --enable-tests+ $ cabal build+ $ cabal test+ $ cabal haddock+ $ cabal install ## Installing
Setup.hs view
@@ -1,6 +1,5 @@ #! /usr/bin/env runhaskell --- Copyright: 2010-2013 Dino Morelli -- License: BSD3 (see LICENSE) -- Author: Dino Morelli <dino@ui3.info>
− TODO
@@ -1,9 +0,0 @@-- May need to add a special function that will try to locate modified even in the metaDate field (which is what an epub2 might look like)--- Need more API docs. Detail the differences between epub2 and epub3 in the data structures, where the fields come from and which are only one or the other.--- Separate some of the Metadata sub-types into their own modules, starting with Title. We've got some utility functions now for this, will help to clean it up some more.--- Better errors on parse failure, this will emerge along with more unit testing--- More unit testing
+ TODO.md view
@@ -0,0 +1,10 @@+- May need to add a special function that will try to locate modified+ even in the metaDate field (which is what an epub2 might look like)+- Need more API docs. Detail the differences between epub2 and+ epub3 in the data structures, where the fields come from and which+ are only one or the other.+- Separate some of the Metadata sub-types into their own modules,+ starting with Title. We've got some utility functions now for this,+ will help to clean it up some more.+- Better errors on parse failure, this will emerge along with more unit testing+- More unit testing
changelog.md view
@@ -1,3 +1,13 @@+4.3 (2015-05-25)++ * Replaced deprecated Control.Monad.Error with+ Control.Monad.Except+ * Updated cabal homepage, tested-with and source-repository+ * Cleaned out ui3.info stuff from the README+ * Updated boringfile with cabal sandbox filespecs+ * TODO is now a Markdown document++ 4.2 (2014-05-09) * Added many files missing from extra-source-files
doc/examples/README view
@@ -1,3 +1,3 @@-This is a small project for maintaining the example code that goes into the aHaddock docs for Codec.Epub+This is a small project for maintaining the example code that goes into the Haddock docs for Codec.Epub To build it, you'll need to install epub-metadata as it's called for by this example code's cabal file.
doc/hcar/epubmetadata-De.tex view
@@ -1,15 +1,18 @@ % epubmetadata-De.tex \begin{hcarentry}{epub-metadata}-\report{Dino Morelli}%05/11+\label{epub-metadata}+\report{Dino Morelli}%11/13 \status{experimental, actively developed} \makeheader Library for parsing and manipulating epub OPF package data. Now with epub3 support. -* Added support for epub3 documents. This was done using a single set of datatypes, not specific to either epub2 or epub3.-* Redesigned the book file querying API to be an edsl. Actions are to be combined together based on what the developer needs from the document.-* Data structures to contain epub metadata "sections" were redesigned to no longer be nested. Part of this change includes a typeclass-based pretty-print API for displaying this data.-* Documentation rewrites and additions, including a working code example in the API docs.+\begin{itemize}+\item Added support for epub3 documents. This was done using a single set of datatypes, not specific to either epub2 or epub3.+\item Redesigned the book file querying API to be an edsl. Actions are to be combined together based on what the developer needs from the document.+\item Data structures to contain epub metadata ``sections'' were redesigned to no longer be nested. Part of this change includes a typeclass-based pretty-print API for displaying this data.+\item Documentation rewrites and additions, including a working code example in the API docs.+\end{itemize} epub-metadata is available from Hackage and the Darcs repository below.
epub-metadata.cabal view
@@ -1,20 +1,20 @@ name: epub-metadata-version: 4.2+version: 4.3 cabal-version: >= 1.8 build-type: Simple license: BSD3 license-file: LICENSE-copyright: 2010-2013 Dino Morelli+copyright: 2010-2015 Dino Morelli author: Dino Morelli maintainer: Dino Morelli <dino@ui3.info> stability: experimental-homepage: http://ui3.info/d/proj/epub-metadata.html+homepage: http://hub.darcs.net/dino/epub-metadata synopsis: Library for parsing epub document metadata description: Library for parsing and manipulating epub document metadata. Supports epub versions 2 and 3. This library was constructed by studying the IDPF specifications for epub documents found here <http://www.idpf.org/epub/20/spec/OPF_2.0.1_draft.htm> and here <http://www.idpf.org/epub/30/spec/epub30-publications.html> category: Codec, Text-tested-with: GHC >= 7.6.2+tested-with: GHC >= 7.10.1 extra-source-files: changelog.md doc/dev/notes doc/examples/README@@ -30,14 +30,14 @@ testsuite/bookfiles/content/bar testsuite/Epub2/*.hs testsuite/Epub3/*.hs- TODO+ TODO.md util/gentags.sh util/prefs/boring util/show-opf.hs source-repository head type: darcs- location: http://ui3.info/darcs/epub-metadata/+ location: http://hub.darcs.net/dino/epub-metadata library exposed-modules: Codec.Epub
src/Codec/Epub.hs view
@@ -1,4 +1,3 @@--- Copyright: 2013 Dino Morelli -- License: BSD3 (see LICENSE) -- Author: Dino Morelli <dino@ui3.info>
src/Codec/Epub/Data/Common.hs view
@@ -1,4 +1,3 @@--- Copyright: 2010-2013 Dino Morelli -- License: BSD3 (see LICENSE) -- Author: Dino Morelli <dino@ui3.info>
src/Codec/Epub/Data/Guide.hs view
@@ -1,4 +1,3 @@--- Copyright: 2010-2013 Dino Morelli -- License: BSD3 (see LICENSE) -- Author: Dino Morelli <dino@ui3.info>
src/Codec/Epub/Data/Manifest.hs view
@@ -1,4 +1,3 @@--- Copyright: 2010-2013 Dino Morelli -- License: BSD3 (see LICENSE) -- Author: Dino Morelli <dino@ui3.info>
src/Codec/Epub/Data/Metadata.hs view
@@ -1,4 +1,3 @@--- Copyright: 2010-2013 Dino Morelli -- License: BSD3 (see LICENSE) -- Author: Dino Morelli <dino@ui3.info>
src/Codec/Epub/Data/Package.hs view
@@ -1,4 +1,3 @@--- Copyright: 2010-2013 Dino Morelli -- License: BSD3 (see LICENSE) -- Author: Dino Morelli <dino@ui3.info>
src/Codec/Epub/Data/Spine.hs view
@@ -1,4 +1,3 @@--- Copyright: 2010-2013 Dino Morelli -- License: BSD3 (see LICENSE) -- Author: Dino Morelli <dino@ui3.info>
src/Codec/Epub/Format.hs view
@@ -1,4 +1,3 @@--- Copyright: 2010-2013 Dino Morelli -- License: BSD3 (see LICENSE) -- Author: Dino Morelli <dino@ui3.info>
src/Codec/Epub/Format/Guide.hs view
@@ -1,4 +1,3 @@--- Copyright: 2010-2013 Dino Morelli -- License: BSD3 (see LICENSE) -- Author: Dino Morelli <dino@ui3.info>
src/Codec/Epub/Format/Manifest.hs view
@@ -1,4 +1,3 @@--- Copyright: 2010-2013 Dino Morelli -- License: BSD3 (see LICENSE) -- Author: Dino Morelli <dino@ui3.info>
src/Codec/Epub/Format/Metadata.hs view
@@ -1,4 +1,3 @@--- Copyright: 2010-2013 Dino Morelli -- License: BSD3 (see LICENSE) -- Author: Dino Morelli <dino@ui3.info>
src/Codec/Epub/Format/Package.hs view
@@ -1,4 +1,3 @@--- Copyright: 2010-2013 Dino Morelli -- License: BSD3 (see LICENSE) -- Author: Dino Morelli <dino@ui3.info>
src/Codec/Epub/Format/Spine.hs view
@@ -1,4 +1,3 @@--- Copyright: 2010-2013 Dino Morelli -- License: BSD3 (see LICENSE) -- Author: Dino Morelli <dino@ui3.info>
src/Codec/Epub/Format/Util.hs view
@@ -1,4 +1,3 @@--- Copyright: 2010-2013 Dino Morelli -- License: BSD3 (see LICENSE) -- Author: Dino Morelli <dino@ui3.info>
src/Codec/Epub/IO.hs view
@@ -1,4 +1,3 @@--- Copyright: 2010-2013 Dino Morelli -- License: BSD3 (see LICENSE) -- Author: Dino Morelli <dino@ui3.info> @@ -20,7 +19,7 @@ import Codec.Archive.Zip import Control.Arrow.ListArrows ( (>>>), deep ) import Control.Exception-import Control.Monad.Error+import Control.Monad.Except import qualified Data.ByteString.Char8 as BS import Data.ByteString.Lazy ( fromChunks ) import qualified Data.ByteString.Lazy as B
src/Codec/Epub/Parse.hs view
@@ -1,4 +1,3 @@--- Copyright: 2010-2013 Dino Morelli -- License: BSD3 (see LICENSE) -- Author: Dino Morelli <dino@ui3.info> @@ -21,7 +20,7 @@ where import Control.Arrow.ListArrows-import Control.Monad.Error+import Control.Monad.Except import Text.XML.HXT.Arrow.Namespace ( propagateNamespaces ) import Text.XML.HXT.Arrow.XmlState ( no, runX, withValidate ) import Text.XML.HXT.Arrow.XmlState.TypeDefs
src/Codec/Epub/Parse/Guide.hs view
@@ -1,4 +1,3 @@--- Copyright: 2010-2013 Dino Morelli -- License: BSD3 (see LICENSE) -- Author: Dino Morelli <dino@ui3.info>
src/Codec/Epub/Parse/Manifest.hs view
@@ -1,4 +1,3 @@--- Copyright: 2010-2013 Dino Morelli -- License: BSD3 (see LICENSE) -- Author: Dino Morelli <dino@ui3.info>
src/Codec/Epub/Parse/Metadata.hs view
@@ -1,4 +1,3 @@--- Copyright: 2010-2013 Dino Morelli -- License: BSD3 (see LICENSE) -- Author: Dino Morelli <dino@ui3.info>
src/Codec/Epub/Parse/Package.hs view
@@ -1,4 +1,3 @@--- Copyright: 2010-2013 Dino Morelli -- License: BSD3 (see LICENSE) -- Author: Dino Morelli <dino@ui3.info>
src/Codec/Epub/Parse/Refinements.hs view
@@ -1,4 +1,3 @@--- Copyright: 2010-2013 Dino Morelli -- License: BSD3 (see LICENSE) -- Author: Dino Morelli <dino@ui3.info>
src/Codec/Epub/Parse/Spine.hs view
@@ -1,4 +1,3 @@--- Copyright: 2010-2013 Dino Morelli -- License: BSD3 (see LICENSE) -- Author: Dino Morelli <dino@ui3.info>
src/Codec/Epub/Parse/Util.hs view
@@ -1,4 +1,3 @@--- Copyright: 2010-2013 Dino Morelli -- License: BSD3 (see LICENSE) -- Author: Dino Morelli <dino@ui3.info>
src/Codec/Epub/Util.hs view
@@ -1,4 +1,3 @@--- Copyright: 2010-2013 Dino Morelli -- License: BSD3 (see LICENSE) -- Author: Dino Morelli <dino@ui3.info>
testsuite/Archive.hs view
@@ -1,4 +1,3 @@--- Copyright: 2010-2013 Dino Morelli -- License: BSD3 (see LICENSE) -- Author: Dino Morelli <dino@ui3.info> @@ -7,7 +6,7 @@ where import Codec.Archive.Zip-import Control.Monad.Error+import Control.Monad.Except import System.Directory import System.FilePath import Test.HUnit@@ -44,7 +43,7 @@ -} testDamagedZip :: Test testDamagedZip = TestLabel "damaged zip" $ TestCase $ do- actual <- runErrorT $ getPkgXmlFromZip $ "testsuite"+ actual <- runExceptT $ getPkgXmlFromZip $ "testsuite" </> "damagedZipCentralDir.epub" actual @?= Left "Data.Binary.Get.runGet at position 138: Did not find end of central directory signature" @@ -58,7 +57,7 @@ testIllegalCharsBeforeDecl = TestCase $ do xmlString <- readFile $ "testsuite" </> "testIllegalCharsBeforeDecl.opf"- actual <- runErrorT $ getPackage xmlString+ actual <- runExceptT $ getPackage xmlString let expected = Right Package {pkgVersion = "2.0", pkgUniqueId = "uuid_id"} assertEqual "illegal chars before XML declaration" expected actual
testsuite/Epub2/ParseGuide.hs view
@@ -1,4 +1,3 @@--- Copyright: 2010-2013 Dino Morelli -- License: BSD3 (see LICENSE) -- Author: Dino Morelli <dino@ui3.info> @@ -6,7 +5,7 @@ ( tests ) where -import Control.Monad.Error+import Control.Monad.Except import System.FilePath import Test.HUnit @@ -26,7 +25,7 @@ testFull :: Test testFull = TestCase $ do xmlString <- readFile $ "testsuite" </> "epub2-full.opf"- actual <- runErrorT $ getGuide xmlString+ actual <- runExceptT $ getGuide xmlString let expected = Right [ GuideRef { grType = "title-page"@@ -47,6 +46,6 @@ testMinimal :: Test testMinimal = TestCase $ do xmlString <- liftIO $ readFile $ "testsuite" </> "epub2-minimal.opf"- actual <- runErrorT $ getGuide xmlString+ actual <- runExceptT $ getGuide xmlString let expected = Right [] assertEqual "minimal guide" expected actual
testsuite/Epub2/ParseMetadata.hs view
@@ -1,4 +1,3 @@--- Copyright: 2010-2013 Dino Morelli -- License: BSD3 (see LICENSE) -- Author: Dino Morelli <dino@ui3.info> @@ -6,7 +5,7 @@ ( tests ) where -import Control.Monad.Error+import Control.Monad.Except import System.FilePath import Test.HUnit @@ -28,7 +27,7 @@ testFull :: Test testFull = TestCase $ do xmlString <- readFile $ "testsuite" </> "epub2-full.opf"- actual <- runErrorT $ getMetadata xmlString+ actual <- runExceptT $ getMetadata xmlString let expected = Right Metadata { metaTitles =@@ -113,7 +112,7 @@ testMinimal :: Test testMinimal = TestCase $ do xmlString <- liftIO $ readFile $ "testsuite" </> "epub2-minimal.opf"- actual <- runErrorT $ getMetadata xmlString+ actual <- runExceptT $ getMetadata xmlString let expected = Right Metadata { metaTitles = [Title Nothing Nothing Nothing@@ -144,6 +143,6 @@ testMissingAll :: Test testMissingAll = TestCase $ do xmlString <- readFile $ "testsuite" </> "epub2-missingAll.opf"- actual <- runErrorT $ getMetadata xmlString+ actual <- runExceptT $ getMetadata xmlString let expected = Right emptyMetadata assertEqual "missing all" expected actual
testsuite/Epub3/ParseMetadata.hs view
@@ -1,4 +1,3 @@--- Copyright: 2010-2013 Dino Morelli -- License: BSD3 (see LICENSE) -- Author: Dino Morelli <dino@ui3.info> @@ -6,7 +5,7 @@ ( tests ) where -import Control.Monad.Error+import Control.Monad.Except import System.FilePath import Test.HUnit @@ -26,7 +25,7 @@ testFull :: Test testFull = TestCase $ do xmlString <- readFile $ "testsuite" </> "epub3-full.opf"- actual <- runErrorT $ getMetadata xmlString+ actual <- runExceptT $ getMetadata xmlString let expected = Right Metadata { metaIds =
testsuite/ParseManifest.hs view
@@ -1,4 +1,3 @@--- Copyright: 2010-2013 Dino Morelli -- License: BSD3 (see LICENSE) -- Author: Dino Morelli <dino@ui3.info> @@ -6,7 +5,7 @@ ( tests ) where -import Control.Monad.Error+import Control.Monad.Except import System.FilePath import Test.HUnit @@ -26,7 +25,7 @@ testSeveral :: Test testSeveral = TestCase $ do xmlString <- readFile $ "testsuite" </> "epub2-full.opf"- actual <- runErrorT $ getManifest xmlString+ actual <- runExceptT $ getManifest xmlString let expected = Right $ Manifest [ ManifestItem { mfiId = "ncx"@@ -52,7 +51,7 @@ testMissing :: Test testMissing = TestCase $ do xmlString <- readFile $ "testsuite" </> "epub2-missingAll.opf"- actual <- runErrorT $ getManifest xmlString+ actual <- runExceptT $ getManifest xmlString let expected = Right $ Manifest [] assertEqual "missing entirely" expected actual
testsuite/ParsePackage.hs view
@@ -1,4 +1,3 @@--- Copyright: 2010-2013 Dino Morelli -- License: BSD3 (see LICENSE) -- Author: Dino Morelli <dino@ui3.info> @@ -6,7 +5,7 @@ ( tests ) where -import Control.Monad.Error+import Control.Monad.Except import System.FilePath import Test.HUnit @@ -25,7 +24,7 @@ testEpub2 :: Test testEpub2 = TestCase $ do xmlString <- liftIO $ readFile $ "testsuite" </> "epub2-minimal.opf"- actual <- runErrorT $ getPackage xmlString+ actual <- runExceptT $ getPackage xmlString let expected = Right Package { pkgVersion = "2.0"
testsuite/ParseSpine.hs view
@@ -1,4 +1,3 @@--- Copyright: 2010-2013 Dino Morelli -- License: BSD3 (see LICENSE) -- Author: Dino Morelli <dino@ui3.info> @@ -6,7 +5,7 @@ ( tests ) where -import Control.Monad.Error+import Control.Monad.Except import System.FilePath import Test.HUnit @@ -27,7 +26,7 @@ testFull :: Test testFull = TestCase $ do xmlString <- readFile $ "testsuite" </> "epub2-full.opf"- actual <- runErrorT $ getSpine xmlString+ actual <- runExceptT $ getSpine xmlString let expected = Right Spine { spineToc = "ncx"@@ -44,7 +43,7 @@ testMinimal :: Test testMinimal = TestCase $ do xmlString <- liftIO $ readFile $ "testsuite" </> "epub2-minimal.opf"- actual <- runErrorT $ getSpine xmlString+ actual <- runExceptT $ getSpine xmlString let expected = Right Spine {spineToc = "ncx", spineItemrefs = []} assertEqual "minimal" expected actual @@ -54,6 +53,6 @@ testMissingAll :: Test testMissingAll = TestCase $ do xmlString <- readFile $ "testsuite" </> "epub2-missingAll.opf"- actual <- runErrorT $ getSpine xmlString+ actual <- runExceptT $ getSpine xmlString let expected = Right Spine {spineToc = "", spineItemrefs = []} assertEqual "missing all" expected actual
testsuite/test-main.hs view
@@ -1,4 +1,3 @@--- Copyright: 2010-2013 Dino Morelli -- License: BSD3 (see LICENSE) -- Author: Dino Morelli <dino@ui3.info>
util/prefs/boring view
@@ -1,4 +1,11 @@-# Boring file regexps:+# This file contains a list of extended regular expressions, one per+# line. A file path matching any of these expressions will be filtered+# out during `darcs add', or when the `--look-for-adds' flag is passed+# to `darcs whatsnew' and `record'. The entries in ~/.darcs/boring (if+# it exists) supplement those in this file.+# +# Blank lines, and lines beginning with an octothorpe (#) are ignored.+# See regex(7) for a description of extended regular expressions. ### compiler and interpreter intermediate files # haskell (ghc) interfaces@@ -38,8 +45,11 @@ # cabal intermediates \.installed-pkg-config \.setup-config+# cabal sandbox+^\.cabal-sandbox(/|$)+cabal\.sandbox\.config # standard cabal build dir, might not be boring for everybody-# ^dist(/|$)+^dist(/|$) # autotools (^|/)autom4te\.cache($|/) (^|/)config\.(log|status)$@@ -111,7 +121,3 @@ (^|/)\.lock-wscript$ # mac os finder (^|/)\.DS_Store$-# cabal-(^|/)dist($|/)--(^|/)bin($|/)
util/show-opf.hs view
@@ -1,6 +1,5 @@ #! /usr/bin/runhaskell -isrc --- Copyright: 2010-2013 Dino Morelli -- License: BSD3 (see LICENSE) -- Author: Dino Morelli <dino@ui3.info>