epub-tools 2.2 → 2.3
raw patch · 14 files changed
+614/−437 lines, 14 filesdep ~epub-metadata
Dependency ranges changed: epub-metadata
Files
- epub-tools.cabal +5/−5
- src/EpubTools/EpubMeta/Display.hs +13/−4
- src/EpubTools/EpubMeta/Export.hs +3/−3
- src/EpubTools/EpubMeta/Import.hs +2/−3
- src/EpubTools/EpubMeta/Opts.hs +8/−5
- src/EpubTools/EpubName/Format/Author.hs +11/−11
- src/EpubTools/EpubName/Format/Format.hs +6/−6
- src/EpubTools/EpubName/Format/PubYear.hs +11/−6
- src/EpubTools/EpubName/Format/Util.hs +3/−1
- src/EpubTools/EpubName/Opts.hs +27/−8
- src/EpubTools/EpubZip/Opts.hs +6/−3
- src/EpubTools/epubname.hs +22/−18
- src/EpubTools/epubzip.hs +8/−9
- testsuite/EpubTools/Test/EpubName/Format.hs +489/−355
epub-tools.cabal view
@@ -1,6 +1,6 @@ name: epub-tools cabal-version: >= 1.8-version: 2.2+version: 2.3 build-type: Simple license: BSD3 license-file: LICENSE@@ -24,7 +24,7 @@ executable epubmeta main-is: EpubTools/epubmeta.hs build-depends: base >= 3 && < 5, bytestring, directory,- epub-metadata >= 3.0, filepath, mtl, process,+ epub-metadata >= 4.0, filepath, mtl, process, zip-archive hs-source-dirs: src other-modules: EpubTools.EpubMeta.Display@@ -37,7 +37,7 @@ executable epubname main-is: EpubTools/epubname.hs- build-depends: base >= 3 && < 5, directory, epub-metadata >= 3.0,+ build-depends: base >= 3 && < 5, directory, epub-metadata >= 4.0, filepath, mtl, parsec, regex-compat hs-source-dirs: src other-modules: EpubTools.EpubName.Doc.Dsl@@ -57,14 +57,14 @@ test-suite epubname-tests type: exitcode-stdio-1.0 main-is: EpubTools/test-epubname.hs- build-depends: base, directory, epub-metadata >= 3.0, filepath,+ build-depends: base, directory, epub-metadata >= 4.0, filepath, HUnit, mtl, parsec, regex-compat hs-source-dirs: src testsuite ghc-options: -Wall -rtsopts -with-rtsopts=-K32m executable epubzip main-is: EpubTools/epubzip.hs- build-depends: base >= 3 && < 5, directory, epub-metadata >= 3.0,+ build-depends: base >= 3 && < 5, directory, epub-metadata >= 4.0, filepath, mtl, parsec, regex-compat hs-source-dirs: src other-modules: EpubTools.EpubZip.Opts
src/EpubTools/EpubMeta/Display.hs view
@@ -5,8 +5,8 @@ module EpubTools.EpubMeta.Display where -import Codec.Epub2.Opf.Format.Package-import Codec.Epub2.Opf.Parse+import Codec.Epub+import Control.Monad ( when ) import EpubTools.EpubMeta.Opts import EpubTools.EpubMeta.Util@@ -14,5 +14,14 @@ display :: Options -> FilePath -> EM () display opts zipPath = do- meta <- parseEpub2Opf zipPath- liftIO $ putStr $ formatPackage (optVerbose opts) meta+ xml <- getPkgXmlFromZip zipPath++ pkg <- format `fmap` getPackage xml+ meta <- format `fmap` getMetadata xml+ liftIO $ mapM_ putStr [pkg, meta]++ when (optVerbose opts) $ do+ mf <- format `fmap` getManifest xml+ spine <- format `fmap` getSpine xml+ guide <- format `fmap` getGuide xml+ liftIO $ mapM_ putStr [mf, spine, guide]
src/EpubTools/EpubMeta/Export.hs view
@@ -6,7 +6,7 @@ ( exportOpf ) where -import Codec.Epub2.IO+import Codec.Epub.IO import System.FilePath import EpubTools.EpubMeta.Opts@@ -26,11 +26,11 @@ export' :: Export -> FilePath -> EM () export' Existing zipPath = do- (fullPath, contents) <- opfContentsFromZip zipPath+ (fullPath, contents) <- getPkgPathXmlFromZip zipPath write (takeFileName fullPath) contents export' (ToPath path) zipPath = do- (_, contents) <- opfContentsFromZip zipPath+ contents <- getPkgXmlFromZip zipPath write path contents export' NoExport _ = undefined
src/EpubTools/EpubMeta/Import.hs view
@@ -7,8 +7,7 @@ where import Codec.Archive.Zip ( Entry (..), addEntryToArchive, readEntry, toArchive )-import Codec.Epub2.Archive ( writeArchive )-import Codec.Epub2.IO ( opfContentsFromBS )+import Codec.Epub.IO ( getPkgPathXmlFromBS, writeArchive ) import qualified Data.ByteString as BS import qualified Data.ByteString.Lazy as BL import Data.Maybe ( fromJust )@@ -28,7 +27,7 @@ -- The path in the book where new file must go strictBytes <- liftIO $ BS.readFile zipPath- (pathToOldFile, _) <- opfContentsFromBS strictBytes+ (pathToOldFile, _) <- getPkgPathXmlFromBS strictBytes -- Adjust the entry's path let newEntry = tempEntry { eRelativePath = pathToOldFile }
src/EpubTools/EpubMeta/Opts.hs view
@@ -92,16 +92,19 @@ where header = init $ unlines [ "Usage: epubmeta [OPTIONS] EPUBFILE"- , "View or edit EPUB2 OPF package data"+ , "View or edit epub book metadata" , ""+ , "Note that 'edit' here means you get dumped into an editor with the XML document and are on your own."+ , "" , "Options:" ] footer = init $ unlines- [ "When -v or no options are given, epubmeta will display the OPF package data in a human-readable form."+ [ "The -e feature will look for an editor in this order: the EDITOR environment variable, the VISUAL environment variable, vi" , ""- , "The -e feature will look for an editor in this order: the EDITOR environment variable, the VISUAL environment variable, vi"+ , "For more information on the epub format:"+ , " epub2: http://idpf.org/epub/20/spec/OPF_2.0.1_draft.htm"+ , " epub3: http://www.idpf.org/epub/30/spec/epub30-publications.html" , ""- , "For more information please see the IDPF OPF specification found here: http://idpf.org/epub/20/spec/OPF_2.0.1_draft.htm" , ""- , "Version 2.2 Dino Morelli <dino@ui3.info>"+ , "Version 2.3 Dino Morelli <dino@ui3.info>" ]
src/EpubTools/EpubName/Format/Author.hs view
@@ -8,7 +8,7 @@ ) where -import Codec.Epub2.Opf.Package+import Codec.Epub.Data.Metadata import Control.Monad import Data.List ( intercalate ) import Data.Maybe ( isJust )@@ -33,22 +33,22 @@ separateOne :: Creator -> [Creator]-separateOne c@(Creator r _ di) =+separateOne c@(Creator r _ _ di) = case (splitRegex (mkRegex " (&|and) ") di) of -- If there was only one, leave the file-as alone! [_] -> [c] -- Otherwise, explode them into separate CreatorS- ss -> map (Creator r Nothing) ss+ ss -> map (Creator r Nothing Nothing) ss formatSingleAuthor :: Creator -> String -formatSingleAuthor (Creator _ (Just fa) di) = +formatSingleAuthor (Creator _ (Just fa) _ di) = if ((fa == di) && all (/= ',') fa)- then formatSingleAuthor $ Creator Nothing Nothing di+ then formatSingleAuthor $ Creator Nothing Nothing Nothing di else authorSingle [fa] -formatSingleAuthor (Creator _ _ di) = +formatSingleAuthor (Creator _ _ _ di) = authorSingle . reverse . nameParts $ di @@ -71,8 +71,8 @@ ] lastName :: Creator -> String-lastName (Creator _ (Just fa) _ ) = lastName' fa-lastName (Creator _ _ di) = lastName' di+lastName (Creator _ (Just fa) _ _ ) = lastName' fa+lastName (Creator _ _ _ di) = lastName' di formatMultiAuthors :: [Creator] -> String@@ -82,8 +82,8 @@ justAuthors :: Metadata -> [Creator] justAuthors = (filter isAut) . metaCreators where- isAut (Creator (Just "aut") _ _) = True- isAut (Creator Nothing _ _) = True+ isAut (Creator (Just "aut") _ _ _) = True+ isAut (Creator Nothing _ _ _) = True isAut _ = False @@ -100,7 +100,7 @@ -} authorMatches :: String -> EN () authorMatches re = do- let authorMatches' (Creator _ _ di) =+ let authorMatches' (Creator _ _ _ di) = matchRegex (mkRegex re) di md <- asks gMetadata
src/EpubTools/EpubName/Format/Format.hs view
@@ -15,7 +15,7 @@ ) where -import Codec.Epub2.Opf.Package+import Codec.Epub.Data.Metadata import Control.Monad.Error import Data.List ( isPrefixOf ) import Data.Maybe ( isJust )@@ -158,7 +158,7 @@ extractTitle re = do md <- asks gMetadata - (Title _ oldTitle) <- case metaTitles md of+ (Title _ _ _ oldTitle) <- case metaTitles md of [] -> throwError "format failed, no title present" ts -> return . head $ ts @@ -188,9 +188,9 @@ succeeds or none do -} tryFormatting :: (MonadIO m, MonadError String m) =>- Options -> [Formatter] -> Metadata -> FilePath -> m (String, FilePath)-tryFormatting opts fs meta oldPath =- either throwError return $ runEN (Globals opts meta) $+ Globals -> [Formatter] -> FilePath -> m (String, FilePath)+tryFormatting gs fs oldPath =+ either throwError return $ runEN gs $ foldr mplus (throwError $ printf "%s [ERROR No formatter found]" oldPath) $ map tryFormatter fs@@ -202,7 +202,7 @@ (foldr mplus Nothing (map maybePub $ metaContributors md)) where- maybePub (Creator (Just "bkp") (Just fa) _ ) = Just fa+ maybePub (Creator (Just "bkp") (Just fa) _ _ ) = Just fa maybePub _ = Nothing
src/EpubTools/EpubName/Format/PubYear.hs view
@@ -8,7 +8,8 @@ ) where -import Codec.Epub2.Opf.Package+import Codec.Epub.Data.Metadata+import Codec.Epub.Data.Package import Control.Monad import Text.Regex @@ -22,11 +23,15 @@ getPubYear = do yearHandling <- asks $ optPubYear . gOpts md <- asks gMetadata+ version <- asks $ pkgVersion . gPackage - case yearHandling of- Publication -> getPubYear' md pubAttrs- AnyDate -> getPubYear' md $ pubAttrs ++ [getFirstDate]- NoDate -> return ""+ case (version, yearHandling) of+ ('3' : _ , Publication) -> getPubYear' md $ [getFirstDate]+ ('3' : _ , AnyDate ) -> getPubYear' md $ [getFirstDate]+ ('2' : _ , Publication) -> getPubYear' md pubAttrs+ ('2' : _ , AnyDate ) -> getPubYear' md $+ pubAttrs ++ [getFirstDate]+ (_ , _ ) -> return "" where getPubYear' md = return . maybe "" ('_' :) . foldr mplus Nothing .@@ -48,7 +53,7 @@ getFirstDate :: [Date] -> Maybe String getFirstDate ((Date _ d) : _) = extractYear d-getFirstDate _ = Nothing+getFirstDate _ = Nothing extractYear :: String -> Maybe String
src/EpubTools/EpubName/Format/Util.hs view
@@ -12,7 +12,8 @@ ) where -import Codec.Epub2.Opf.Package+import Codec.Epub.Data.Metadata+import Codec.Epub.Data.Package import Control.Monad.Error import Control.Monad.Identity import Control.Monad.Reader@@ -25,6 +26,7 @@ data Globals = Globals { gOpts :: Options+ , gPackage :: Package , gMetadata :: Metadata }
src/EpubTools/EpubName/Opts.hs view
@@ -22,8 +22,10 @@ data PubYear- = Publication -- Default, use date event='publication' or 'original-publication'- | AnyDate -- Use first date element found+ = Publication -- Default+ -- epub3: use first date of any kind+ -- epub2: use date 'original-publication' or event='publication'+ | AnyDate -- Failing above, use any date found | NoDate -- Don't do publication date at all @@ -133,7 +135,7 @@ where header = init $ unlines [ "USAGE: epubname [OPTIONS] FILES"- , "Rename EPUB2 book files with clear names based on their metadata"+ , "Rename epub book files with clear names based on their metadata" , "" , "OPTIONS:" , ""@@ -167,12 +169,27 @@ , "" , "Only creator tags with either a role attribute of 'aut' or no role at all are considered authors. If a file-as attribute is present, this will be the preferred string. If not, the program tries to do some intelligent parsing of the name." , ""- , "The OPF spec suggests there may be a <dc:date opf:event='publication'>2011</dc:date> element representing original publication date. If this (or opf:event='original-publication') is present, it will be used by default for _year as in the above examples. The --any-date switch will use the first date tag found, regardless of attributes. The year can be parsed out of many date formats, it's very flexible."+ , "PUBLICATION DATE:" , ""- , "Publisher: I wanted to provide a way to have multiple copies of the same book produced by different publishers and name them sort-of unambiguously. I came up with the idea of expecting a contributor tag with role attribute of 'bkp' (so far, this is fairly normal). And then use a file-as attribute on that tag to contain a small string to be used in the filename. The idea here is short and sweet for the file-as."+ , "This software will attempt to locate a publication date to use at the end of the filename. This can be suppressed with the --no-date switch. How the date is found depends on the document epub version:" , ""- , "MORE COMPLICATED NAMING:"+ , "epub2: metadata/date elements like the examples below will be looked for in this order:"+ , " <dc:date opf:event='original-publication'>2013-09-17</dc:date>"+ , " <dc:date opf:event='publication'>2013-09-17T12:00:00Z</dc:date>" , ""+ , "The --any-date switch will force the use of the first date found in epub2 documents."+ , ""+ , "epub3: the single allowed (but optional) metadata/date element will be used and would look like this:"+ , " <dc:date>2013-09-17T12:00:00Z</dc:date>"+ , ""+ , "My understanding is it doesn't have to be a complete date string, this software will fish the year out of whatever it can find."+ , ""+ , "PUBLISHER:"+ , ""+ , "I wanted to provide a way to have multiple copies of the same book produced by different publishers and name them sort-of unambiguously. I came up with the idea of expecting a contributor tag with role attribute of 'bkp' (so far, this is fairly normal). And then use a file-as attribute on that tag to contain a small string to be used in the filename. The idea here is short and sweet for the file-as."+ , ""+ , "MORE COMPLICATED NAMING: MAGAZINES AND COLLECTIONS"+ , "" , "Magazines are kind of a sticky problem in that it's often desireable to have edition and/or date info in the filename. There's a lot of chaos out there with titling the epub editions of magazines. The solution in this software is to do some pattern matching on multiple fields in the magazine's metadata combined with custom naming rules for specific magazines." , "" , "This software ships with a set of rules to properly name over 20 magazines and compilations that are commonly purchased by the developer. These default rules can be extended to add new publications, and used as an example."@@ -190,8 +207,10 @@ , "Please see --help-rules for more information on the syntax of the DSL in the rules file." , "" , ""- , "For more information on the EPUB2 format, please see the IDPF OPF specification found here: http://idpf.org/epub/20/spec/OPF_2.0.1_draft.htm"+ , "For more information on the epub format:"+ , " epub2: http://idpf.org/epub/20/spec/OPF_2.0.1_draft.htm"+ , " epub3: http://www.idpf.org/epub/30/spec/epub30-publications.html" , "" , ""- , "Version 2.2 Dino Morelli <dino@ui3.info>"+ , "Version 2.3 Dino Morelli <dino@ui3.info>" ]
src/EpubTools/EpubZip/Opts.hs view
@@ -48,7 +48,7 @@ header = init $ unlines [ "Usage: epubzip [OPTIONS] DESTDIR" , " epubzip [OPTIONS] DESTDIR/EPUBFILE"- , "Construct an EPUB2 zip archive from files in the current directory"+ , "Construct an epub zip archive from files in the current directory" , "" , "Options:" ]@@ -66,7 +66,10 @@ , " $ cd TEMPDIR" , " $ unzip EPUBFILE" , ""- , "For more information please see the IDPF OPF specification found here: http://idpf.org/epub/20/spec/OPF_2.0.1_draft.htm"+ , "For more information on the epub format:"+ , " epub2: http://idpf.org/epub/20/spec/OPF_2.0.1_draft.htm"+ , " epub3: http://www.idpf.org/epub/30/spec/epub30-publications.html" , ""- , "Version 2.2 Dino Morelli <dino@ui3.info>"+ , ""+ , "Version 2.3 Dino Morelli <dino@ui3.info>" ]
src/EpubTools/epubname.hs view
@@ -4,9 +4,10 @@ {-# LANGUAGE FlexibleContexts #-} -import Codec.Epub2.Opf.Format.Package-import Codec.Epub2.Opf.Package-import Codec.Epub2.Opf.Parse+import Codec.Epub+import Codec.Epub.Data.Metadata+import Codec.Epub.Data.Package+import Control.Applicative import Control.Monad import Control.Monad.Error import System.Directory ( doesDirectoryExist, doesFileExist, renameFile )@@ -21,6 +22,7 @@ import qualified EpubTools.EpubName.Doc.Dsl as Dsl import qualified EpubTools.EpubName.Doc.Rules as Rules import EpubTools.EpubName.Format.Format ( Formatter (..), tryFormatting )+import EpubTools.EpubName.Format.Util import EpubTools.EpubName.Main import EpubTools.EpubName.Opts ( Options (..), parseOpts, usageText ) import EpubTools.EpubName.Prompt ( PromptResult (..), prompt, continue )@@ -29,22 +31,22 @@ {- Construct additional verbose output -}-formatF :: (String, Package) -> String-formatF (fmtUsed, _) = printf "\n formatter: %s" fmtUsed+formatF :: (String, Package, Metadata) -> String+formatF (fmtUsed, _, _) = printf "\n formatter: %s" fmtUsed -formatFM :: (String, Package) -> String-formatFM (fmtUsed, pkg) =- printf "\n formatter: %s\n%s" fmtUsed- (formatPackage False pkg)+formatFM :: (String, Package, Metadata) -> String+formatFM (fmtUsed, pkg, md) =+ printf "\n formatter: %s\n%s\n%s" fmtUsed+ (format pkg) (format md) {- Format and display output for a book that was processed -}-displayResults :: (MonadError String m, MonadIO m) =>- Options -> FilePath -> FilePath -> String -> Package -> m ()-displayResults opts oldPath newPath fmtUsed pkg =+displayResults :: (MonadError String m, MonadIO m) => Options+ -> FilePath -> FilePath -> String -> Package -> Metadata -> m ()+displayResults opts oldPath newPath fmtUsed pkg md = liftIO $ printf "%s -> %s%s\n" oldPath newPath- (additional (optVerbose opts) (fmtUsed, pkg))+ (additional (optVerbose opts) (fmtUsed, pkg, md)) where additional Nothing = const "" additional (Just 1) = formatF@@ -70,14 +72,16 @@ file path. Failures here will otherwise get lost in the output when multiple books are processed at once. -}- epkg <- runErrorT $ parseEpub2Opf oldPath- pkg <- either+ epm <- runErrorT $ do+ xml <- getPkgXmlFromZip oldPath+ (,) <$> getPackage xml <*> getMetadata xml+ (pkg, md) <- either ( \msg -> throwError $ printf "ERROR: File %s: %s" oldPath msg- ) return epkg+ ) return epm (fmtUsed, shortPath) <-- tryFormatting opts formatters (opMeta pkg) oldPath+ tryFormatting (Globals opts pkg md) formatters oldPath let newPath = optTargetDir opts </> shortPath @@ -85,7 +89,7 @@ when fileExists $ throwError $ printf "File %s already exists. No change." newPath - displayResults opts oldPath newPath fmtUsed pkg+ displayResults opts oldPath newPath fmtUsed pkg md promptResult <- liftIO $ case (optInteractive opts) of True -> prompt
src/EpubTools/epubzip.hs view
@@ -2,10 +2,7 @@ -- License: BSD3 (see LICENSE) -- Author: Dino Morelli <dino@ui3.info> -import Codec.Epub2.Archive ( mkEpubArchive, writeArchive )-import Codec.Epub2.IO-import Codec.Epub2.Opf.Package-import Codec.Epub2.Opf.Parse+import Codec.Epub import Control.Monad import Control.Monad.Error import System.Directory@@ -18,6 +15,7 @@ import Text.Printf import EpubTools.EpubName.Format.Format ( tryFormatting )+import EpubTools.EpubName.Format.Util import EpubTools.EpubName.Main import qualified EpubTools.EpubName.Opts as EN import EpubTools.EpubZip.Opts@@ -45,12 +43,13 @@ dos <- liftIO EN.defaultOptions fs <- initialize dos runErrorT $ do- package <- do- (_, contents) <- opfContentsFromDir "."- parseXmlToOpf contents+ xml <- snd `fmap` getPkgPathXmlFromDir "."+ pkg <- getPackage xml+ metadata <- getMetadata xml - (_, newPath) <- tryFormatting dos fs- (opMeta package) "CURRENT DIRECTORY"+ (_, newPath) <- tryFormatting+ (Globals dos pkg metadata) fs+ "CURRENT DIRECTORY" return $ inputPath </> newPath else return . Right $ inputPath
testsuite/EpubTools/Test/EpubName/Format.hs view
@@ -7,25 +7,32 @@ ) where -import Codec.Epub2.Opf.Package+import Codec.Epub.Data.Metadata+import Codec.Epub.Data.Package import Control.Monad.Error import Test.HUnit ( Test (..), assertEqual ) import Test.HUnit.Base ( Assertion ) import EpubTools.EpubName.Format.Format+import EpubTools.EpubName.Format.Util import EpubTools.EpubName.Opts +pkg2, pkg3 :: Package+pkg2 = Package "2.01" ""+pkg3 = Package "3.0" ""++ formatTests :: Options -> [Formatter] -> Test formatTests opts fs = TestLabel "Format" $ TestList $- map (\f -> f (opts, fs))+ map (\f -> f ((Globals opts pkg2 emptyMetadata), fs)) [ testAuthorMinimal , testAuthorOneName , testAuthorRole , testAuthorFileas , testAuthorFull- , testAuthorSeveral- , testSeveralAuthors+ , testMultiAutCreators+ , testMultiAutOneString , testNoAuthor , testCreatorsNoAuthor , testCreatorsNoAuthorPubDate@@ -34,9 +41,13 @@ , testBracketTitle , testNoTitle , testAllPunctuation- , testPubYear- , testPubYearAny- , testPubYearUnwanted+ , testPubYearNoDatesPresent+ , testPubYearEpub3+ , testPubYearEpub3Unwanted+ , testPubYearEpub2+ , testPubYearEpub2Any+ , testPubYearEpub2Orig+ , testPubYearEpub2Unwanted , testMagAeon , testMagAEon , testMagApexLong@@ -83,21 +94,22 @@ ] -assertNewName :: Options -> [Formatter] -> String -> Metadata+assertNewName :: Globals -> [Formatter] -> String -> (String, String) -> Assertion-assertNewName opts fs desc meta expected = do- result <- runErrorT $ tryFormatting opts fs meta ""+assertNewName globals fs desc expected = do+ result <- runErrorT $ tryFormatting globals fs "" let actual = either (\em -> ("NO FORMATTER", em)) id result assertEqual desc expected actual -testAuthorMinimal :: (Options, [Formatter]) -> Test-testAuthorMinimal (opts, fs) = TestCase $- assertNewName opts fs "minimal author" meta expected+testAuthorMinimal :: (Globals, [Formatter]) -> Test+testAuthorMinimal (gs, fs) = TestCase $+ assertNewName gs { gMetadata = meta } fs "minimal author" expected where meta = emptyMetadata- { metaCreators = [Creator Nothing Nothing "Herman Melville"]- , metaTitles = [Title Nothing "Moby Dick"]+ { metaCreators = [Creator Nothing Nothing Nothing+ "Herman Melville"]+ , metaTitles = [Title Nothing Nothing Nothing "Moby Dick"] } expected = ( "ordinary_book"@@ -105,13 +117,15 @@ ) -testAuthorOneName :: (Options, [Formatter]) -> Test-testAuthorOneName (opts, fs) = TestCase $- assertNewName opts fs "author is a single word" meta expected+testAuthorOneName :: (Globals, [Formatter]) -> Test+testAuthorOneName (gs, fs) = TestCase $+ assertNewName gs { gMetadata = meta } fs+ "author is a single word" expected where meta = emptyMetadata- { metaCreators = [Creator Nothing Nothing "Melville"]- , metaTitles = [Title Nothing "Moby Dick"]+ { metaCreators = [Creator Nothing Nothing Nothing+ "Melville"]+ , metaTitles = [Title Nothing Nothing Nothing "Moby Dick"] } expected = ( "ordinary_book"@@ -119,14 +133,14 @@ ) -testAuthorRole :: (Options, [Formatter]) -> Test-testAuthorRole (opts, fs) = TestCase $- assertNewName opts fs "author with role" meta expected+testAuthorRole :: (Globals, [Formatter]) -> Test+testAuthorRole (gs, fs) = TestCase $+ assertNewName gs { gMetadata = meta } fs "author with role" expected where meta = emptyMetadata { metaCreators = [Creator (Just "aut") Nothing- "Herman Melville"]- , metaTitles = [Title Nothing "Moby Dick"]+ Nothing "Herman Melville"]+ , metaTitles = [Title Nothing Nothing Nothing "Moby Dick"] } expected = ( "ordinary_book"@@ -134,15 +148,16 @@ ) -testAuthorFileas :: (Options, [Formatter]) -> Test-testAuthorFileas (opts, fs) = TestCase $- assertNewName opts fs "author with file-as" meta expected+testAuthorFileas :: (Globals, [Formatter]) -> Test+testAuthorFileas (gs, fs) = TestCase $+ assertNewName gs { gMetadata = meta } fs "author with file-as" expected where meta = emptyMetadata { metaCreators = [Creator Nothing (Just "Melville, Herman")+ Nothing "Herman Melville"]- , metaTitles = [Title Nothing "Moby Dick"]+ , metaTitles = [Title Nothing Nothing Nothing "Moby Dick"] } expected = ( "ordinary_book"@@ -150,15 +165,16 @@ ) -testAuthorFull :: (Options, [Formatter]) -> Test-testAuthorFull (opts, fs) = TestCase $- assertNewName opts fs "author fully filled out" meta expected+testAuthorFull :: (Globals, [Formatter]) -> Test+testAuthorFull (gs, fs) = TestCase $+ assertNewName gs { gMetadata = meta } fs "author fully filled out" expected where meta = emptyMetadata { metaCreators = [Creator (Just "aut") (Just "Melville, Herman")+ Nothing "Herman Melville"]- , metaTitles = [Title Nothing "Moby Dick"]+ , metaTitles = [Title Nothing Nothing Nothing "Moby Dick"] } expected = ( "ordinary_book"@@ -166,20 +182,20 @@ ) -testAuthorSeveral :: (Options, [Formatter]) -> Test-testAuthorSeveral (opts, fs) = TestCase $- assertNewName opts fs "several authors" meta expected+testMultiAutCreators :: (Globals, [Formatter]) -> Test+testMultiAutCreators (gs, fs) = TestCase $+ assertNewName gs { gMetadata = meta } fs "several authors" expected where meta = emptyMetadata { metaCreators = [ Creator (Just "aut") Nothing- "James Patrick Kelly"+ Nothing "James Patrick Kelly" , Creator (Just "aut") (Just "Kessel, John")- "John Kessel"+ Nothing "John Kessel" , Creator (Just "aut") Nothing- "Jonathan Lethem"+ Nothing "Jonathan Lethem" ]- , metaTitles = [Title Nothing+ , metaTitles = [Title Nothing Nothing Nothing "Ninety Percent of Everything"] } expected =@@ -188,13 +204,28 @@ ) -testNoAuthor :: (Options, [Formatter]) -> Test-testNoAuthor (opts, fs) = TestCase $- assertNewName opts fs "no creator(s) at all" meta expected+testMultiAutOneString :: (Globals, [Formatter]) -> Test+testMultiAutOneString (gs, fs) = TestCase $+ assertNewName gs { gMetadata = meta } fs "more than one author separated by & and/or and" expected where meta = emptyMetadata+ { metaCreators = [Creator Nothing Nothing Nothing+ "Yvonne Q. Anderson & Eva Tunglewacker and Jefferson Milner"]+ , metaTitles = [Title Nothing Nothing Nothing "Big Trouble"]+ }+ expected =+ ( "ordinary_book"+ , "Anderson_Tunglewacker_Milner-BigTrouble.epub"+ )+++testNoAuthor :: (Globals, [Formatter]) -> Test+testNoAuthor (gs, fs) = TestCase $+ assertNewName gs { gMetadata = meta } fs "no creator(s) at all" expected+ where+ meta = emptyMetadata { metaCreators = []- , metaTitles = [Title Nothing+ , metaTitles = [Title Nothing Nothing Nothing "Some Collection of Fine Stories, Volume 1"] } expected =@@ -203,18 +234,19 @@ ) -testCreatorsNoAuthor :: (Options, [Formatter]) -> Test-testCreatorsNoAuthor (opts, fs) = TestCase $- assertNewName opts fs "creators, but no author(s) at all" meta expected+testCreatorsNoAuthor :: (Globals, [Formatter]) -> Test+testCreatorsNoAuthor (gs, fs) = TestCase $+ assertNewName gs { gMetadata = meta } fs+ "creators, but no author(s) at all" expected where meta = emptyMetadata { metaCreators = [ Creator (Just "edt") Nothing- "Graham Spindlewest"+ Nothing "Graham Spindlewest" , Creator (Just "ill") Nothing- "Eva Tunglewacker"+ Nothing "Eva Tunglewacker" ]- , metaTitles = [Title Nothing+ , metaTitles = [Title Nothing Nothing Nothing "Some Collection of Fine Stories, Volume 1"] } expected =@@ -223,19 +255,19 @@ ) -testCreatorsNoAuthorPubDate :: (Options, [Formatter]) -> Test-testCreatorsNoAuthorPubDate (opts, fs) = TestCase $- assertNewName opts fs "creators, but no author(s) at all, with pub date" - meta expected+testCreatorsNoAuthorPubDate :: (Globals, [Formatter]) -> Test+testCreatorsNoAuthorPubDate (gs, fs) = TestCase $+ assertNewName gs { gMetadata = meta } fs+ "creators, but no author(s) at all, with pub date" expected where meta = emptyMetadata { metaCreators = [ Creator (Just "edt") Nothing- "Graham Spindlewest"+ Nothing "Graham Spindlewest" , Creator (Just "ill") Nothing- "Eva Tunglewacker"+ Nothing "Eva Tunglewacker" ]- , metaTitles = [Title Nothing+ , metaTitles = [Title Nothing Nothing Nothing "Some Collection of Fine Stories, Volume 1"] , metaDates = [Date (Just "publication") "2008"]@@ -246,28 +278,13 @@ ) -testSeveralAuthors :: (Options, [Formatter]) -> Test-testSeveralAuthors (opts, fs) = TestCase $- assertNewName opts fs "more than one author separated by & and/or and" meta expected- where- meta = emptyMetadata- { metaCreators = [Creator Nothing Nothing- "Yvonne Q. Anderson & Eva Tunglewacker and Jefferson Milner"]- , metaTitles = [Title Nothing "Big Trouble"]- }- expected =- ( "ordinary_book"- , "Anderson_Tunglewacker_Milner-BigTrouble.epub"- )---testCapsTitle :: (Options, [Formatter]) -> Test-testCapsTitle (opts, fs) = TestCase $- assertNewName opts fs "title all caps" meta expected+testCapsTitle :: (Globals, [Formatter]) -> Test+testCapsTitle (gs, fs) = TestCase $+ assertNewName gs { gMetadata = meta } fs "title all caps" expected where meta = emptyMetadata- { metaCreators = [Creator Nothing Nothing "Greg Bear"]- , metaTitles = [Title Nothing "EON"]+ { metaCreators = [Creator Nothing Nothing Nothing "Greg Bear"]+ , metaTitles = [Title Nothing Nothing Nothing "EON"] } expected = ( "ordinary_book"@@ -275,13 +292,15 @@ ) -testColon :: (Options, [Formatter]) -> Test-testColon (opts, fs) = TestCase $- assertNewName opts fs "colon becomes underscore" meta expected+testColon :: (Globals, [Formatter]) -> Test+testColon (gs, fs) = TestCase $+ assertNewName gs { gMetadata = meta } fs+ "colon becomes underscore" expected where meta = emptyMetadata- { metaCreators = [Creator Nothing Nothing "Ed Howdershelt"]- , metaTitles = [Title Nothing + { metaCreators = [Creator Nothing Nothing Nothing+ "Ed Howdershelt"]+ , metaTitles = [Title Nothing Nothing Nothing "Book 1: 3rd World Products, Inc."] } expected =@@ -290,13 +309,15 @@ ) -testBracketTitle :: (Options, [Formatter]) -> Test-testBracketTitle (opts, fs) = TestCase $- assertNewName opts fs "title with brackets" meta expected+testBracketTitle :: (Globals, [Formatter]) -> Test+testBracketTitle (gs, fs) = TestCase $+ assertNewName gs { gMetadata = meta } fs+ "title with brackets" expected where meta = emptyMetadata- { metaCreators = [Creator Nothing Nothing "Mercedes Lackey"]- , metaTitles = [Title Nothing "SKitty [Shipscat series #1]"]+ { metaCreators = [Creator Nothing Nothing Nothing "Mercedes Lackey"]+ , metaTitles = [Title Nothing Nothing Nothing+ "SKitty [Shipscat series #1]"] } expected = ( "ordinary_book"@@ -304,13 +325,13 @@ ) -testNoTitle :: (Options, [Formatter]) -> Test-testNoTitle (opts, fs) = TestCase $- assertNewName opts fs "missing title" meta expected+testNoTitle :: (Globals, [Formatter]) -> Test+testNoTitle (gs, fs) = TestCase $+ assertNewName gs { gMetadata = meta } fs "missing title" expected where meta = emptyMetadata { metaCreators = [Creator Nothing Nothing- "Nobody McCrankypants"]+ Nothing "Nobody McCrankypants"] } expected = ( "NO FORMATTER"@@ -318,14 +339,14 @@ ) -testAllPunctuation :: (Options, [Formatter]) -> Test-testAllPunctuation (opts, fs) = TestCase $- assertNewName opts fs "big test of all punctuation" meta expected+testAllPunctuation :: (Globals, [Formatter]) -> Test+testAllPunctuation (gs, fs) = TestCase $+ assertNewName gs { gMetadata = meta } fs "big test of all punctuation" expected where meta = emptyMetadata { metaCreators = [Creator Nothing Nothing- "Dino Morelli"]- , metaTitles = [Title Nothing+ Nothing "Dino Morelli"]+ , metaTitles = [Title Nothing Nothing Nothing "The *crazy*: Sand-box. Of Smedley's discontent/loathing, fear & Malnourishment? (Maybe not!); [Part #2]"] } expected =@@ -334,64 +355,143 @@ ) -testPubYear :: (Options, [Formatter]) -> Test-testPubYear (opts, fs) = TestCase $- assertNewName opts fs "book with a publication year" meta expected+testPubYearNoDatesPresent :: (Globals, [Formatter]) -> Test+testPubYearNoDatesPresent (gs, fs) = TestCase $+ assertNewName gs { gMetadata = meta} fs+ "book with no dates at all" expected where meta = emptyMetadata- { metaCreators = [Creator Nothing Nothing "Jim Jones"]- , metaTitles = [Title Nothing "A Timeless Story"]- , metaDates = [Date (Just "publication") "2003"]+ { metaCreators = [Creator Nothing Nothing Nothing "Jim Jones"]+ , metaTitles = [Title Nothing Nothing Nothing "A Timeless Story"] } expected = ( "ordinary_book"+ , "JonesJim-ATimelessStory.epub"+ )+++testPubYearEpub3 :: (Globals, [Formatter]) -> Test+testPubYearEpub3 (gs, fs) = TestCase $+ assertNewName gs { gPackage = pkg3, gMetadata = meta} fs+ "book with epub3 style (simple) date" expected+ where+ meta = emptyMetadata+ { metaCreators = [Creator Nothing Nothing Nothing "Jim Jones"]+ , metaTitles = [Title Nothing Nothing Nothing "A Timeless Story"]+ , metaDates = [ Date Nothing "2003" ]+ }+ expected =+ ( "ordinary_book" , "JonesJim-ATimelessStory_2003.epub" ) -testPubYearAny :: (Options, [Formatter]) -> Test-testPubYearAny (opts, fs) = TestCase $- assertNewName testOpts fs- "book with original-publication attr and --any-date"- meta expected+testPubYearEpub3Unwanted :: (Globals, [Formatter]) -> Test+testPubYearEpub3Unwanted (gs, fs) = TestCase $+ assertNewName gs { gOpts = testOpts, gPackage = pkg3,+ gMetadata = meta } fs+ "epub3 book with a publication year but we don't want"+ expected where- testOpts = opts { optPubYear = AnyDate }+ testOpts = (gOpts gs) { optPubYear = NoDate } meta = emptyMetadata- { metaCreators = [Creator Nothing Nothing "Jim Jones"]- , metaTitles = [Title Nothing "A Timeless Story"]- , metaDates = [Date (Just "original-publication") "2003"]+ { metaCreators = [Creator Nothing Nothing Nothing "Jim Jones"]+ , metaTitles = [Title Nothing Nothing Nothing "A Timeless Story"]+ , metaDates =+ [ Date Nothing "2001"+ , Date (Just "some date") "2000"+ ] } expected = ( "ordinary_book"+ , "JonesJim-ATimelessStory.epub"+ )+++testPubYearEpub2 :: (Globals, [Formatter]) -> Test+testPubYearEpub2 (gs, fs) = TestCase $+ assertNewName gs { gMetadata = meta} fs+ "book with epub2 style (simple) date" expected+ where+ meta = emptyMetadata+ { metaCreators = [Creator Nothing Nothing Nothing "Jim Jones"]+ , metaTitles = [Title Nothing Nothing Nothing "A Timeless Story"]+ , metaDates = [ Date Nothing "2003" ]+ }+ expected =+ ( "ordinary_book"+ , "JonesJim-ATimelessStory.epub"+ )+++testPubYearEpub2Any :: (Globals, [Formatter]) -> Test+testPubYearEpub2Any (gs, fs) = TestCase $+ assertNewName gs { gOpts = testOpts, gMetadata = meta} fs+ "book with epub2 style (simple) date, any switch" expected+ where+ testOpts = (gOpts gs) { optPubYear = AnyDate }+ meta = emptyMetadata+ { metaCreators = [Creator Nothing Nothing Nothing "Jim Jones"]+ , metaTitles = [Title Nothing Nothing Nothing "A Timeless Story"]+ , metaDates = [ Date Nothing "2003" ]+ }+ expected =+ ( "ordinary_book" , "JonesJim-ATimelessStory_2003.epub" ) -testPubYearUnwanted :: (Options, [Formatter]) -> Test-testPubYearUnwanted (opts, fs) = TestCase $- assertNewName testOpts fs- "book with a publication year but we don't want"- meta expected+testPubYearEpub2Orig :: (Globals, [Formatter]) -> Test+testPubYearEpub2Orig (gs, fs) = TestCase $+ assertNewName gs { gMetadata = meta } fs+ "book with epub2 style dates, orig attr" expected where- testOpts = opts { optPubYear = NoDate } meta = emptyMetadata- { metaCreators = [Creator Nothing Nothing "Jim Jones"]- , metaTitles = [Title Nothing "A Timeless Story"]- , metaDates = [Date (Just "original-publication") "2003"]+ { metaCreators = [Creator Nothing Nothing Nothing "Jim Jones"]+ , metaTitles = [Title Nothing Nothing Nothing "A Timeless Story"]+ , metaDates =+ [ Date Nothing "2001"+ , Date (Just "publication") "2003"+ , Date (Just "some date") "2000"+ , Date (Just "original-publication") "2002"+ ] } expected = ( "ordinary_book"+ , "JonesJim-ATimelessStory_2002.epub"+ )+++testPubYearEpub2Unwanted :: (Globals, [Formatter]) -> Test+testPubYearEpub2Unwanted (gs, fs) = TestCase $+ assertNewName gs { gOpts = testOpts, gMetadata = meta } fs+ "epub2 book with a publication year but we don't want"+ expected+ where+ testOpts = (gOpts gs) { optPubYear = NoDate }+ meta = emptyMetadata+ { metaCreators = [Creator Nothing Nothing Nothing "Jim Jones"]+ , metaTitles = [Title Nothing Nothing Nothing "A Timeless Story"]+ , metaDates =+ [ Date Nothing "2001"+ , Date (Just "publication") "2003"+ , Date (Just "some date") "2000"+ , Date (Just "original-publication") "2002"+ ]+ }+ expected =+ ( "ordinary_book" , "JonesJim-ATimelessStory.epub" ) -testMagAeon :: (Options, [Formatter]) -> Test-testMagAeon (opts, fs) = TestCase $- assertNewName opts fs "Aeon magazine" meta expected+testMagAeon :: (Globals, [Formatter]) -> Test+testMagAeon (gs, fs) = TestCase $+ assertNewName gs { gMetadata = meta } fs "Aeon magazine" expected where meta = emptyMetadata- { metaCreators = [Creator Nothing Nothing "Aeon Authors"]- , metaTitles = [Title Nothing "Aeon Eight"]+ { metaCreators = [Creator Nothing Nothing Nothing "Aeon Authors"]+ , metaTitles = [Title Nothing Nothing Nothing "Aeon Eight"] } expected = ( "magAeon"@@ -399,13 +499,13 @@ ) -testMagAEon :: (Options, [Formatter]) -> Test-testMagAEon (opts, fs) = TestCase $- assertNewName opts fs "AEon magazine" meta expected+testMagAEon :: (Globals, [Formatter]) -> Test+testMagAEon (gs, fs) = TestCase $+ assertNewName gs { gMetadata = meta } fs "AEon magazine" expected where meta = emptyMetadata- { metaCreators = [Creator Nothing Nothing "AEon Authors"]- , metaTitles = [Title Nothing "Aeon Thirteen"]+ { metaCreators = [Creator Nothing Nothing Nothing "AEon Authors"]+ , metaTitles = [Title Nothing Nothing Nothing "Aeon Thirteen"] } expected = ( "magAeon"@@ -413,14 +513,15 @@ ) -testMagApexLong :: (Options, [Formatter]) -> Test-testMagApexLong (opts, fs) = TestCase $- assertNewName opts fs "Apex Magazine, older, long title" meta expected+testMagApexLong :: (Globals, [Formatter]) -> Test+testMagApexLong (gs, fs) = TestCase $+ assertNewName gs { gMetadata = meta } fs+ "Apex Magazine, older, long title" expected where meta = emptyMetadata { metaCreators = [Creator (Just "aut") Nothing- "Apex Authors"]- , metaTitles = [Title Nothing+ Nothing "Apex Authors"]+ , metaTitles = [Title Nothing Nothing Nothing "Apex Science Fiction and Horror Digest #9"] } expected =@@ -429,14 +530,15 @@ ) -testMagApexShort :: (Options, [Formatter]) -> Test-testMagApexShort (opts, fs) = TestCase $- assertNewName opts fs "Apex Magazine, newer, short title" meta expected+testMagApexShort :: (Globals, [Formatter]) -> Test+testMagApexShort (gs, fs) = TestCase $+ assertNewName gs { gMetadata = meta } fs+ "Apex Magazine, newer, short title" expected where meta = emptyMetadata { metaCreators = [Creator (Just "aut") Nothing- "Apex Authors"]- , metaTitles = [Title Nothing+ Nothing "Apex Authors"]+ , metaTitles = [Title Nothing Nothing Nothing "Apex Magazine Issue 17"] } expected =@@ -445,15 +547,15 @@ ) -testChallengingDestinyShort :: (Options, [Formatter]) -> Test-testChallengingDestinyShort (opts, fs) = TestCase $- assertNewName opts fs- "Challenging Destiny Magazine, short title" meta expected+testChallengingDestinyShort :: (Globals, [Formatter]) -> Test+testChallengingDestinyShort (gs, fs) = TestCase $+ assertNewName gs { gMetadata = meta } fs+ "Challenging Destiny Magazine, short title" expected where meta = emptyMetadata { metaCreators = [Creator Nothing Nothing- "Crystalline Sphere Authors"]- , metaTitles = [Title Nothing+ Nothing "Crystalline Sphere Authors"]+ , metaTitles = [Title Nothing Nothing Nothing "Challenging Destiny #23"] } expected =@@ -462,15 +564,15 @@ ) -testChallengingDestinyLong :: (Options, [Formatter]) -> Test-testChallengingDestinyLong (opts, fs) = TestCase $- assertNewName opts fs- "Challenging Destiny Magazine, long title" meta expected+testChallengingDestinyLong :: (Globals, [Formatter]) -> Test+testChallengingDestinyLong (gs, fs) = TestCase $+ assertNewName gs { gMetadata = meta } fs+ "Challenging Destiny Magazine, long title" expected where meta = emptyMetadata { metaCreators = [Creator Nothing Nothing - "Crystalline Sphere Authors"]- , metaTitles = [Title Nothing + Nothing "Crystalline Sphere Authors"]+ , metaTitles = [Title Nothing Nothing Nothing "Challenging Destiny #24: August 2007"] } expected =@@ -479,14 +581,14 @@ ) -testAnalog :: (Options, [Formatter]) -> Test-testAnalog (opts, fs) = TestCase $- assertNewName opts fs "Analog" meta expected+testAnalog :: (Globals, [Formatter]) -> Test+testAnalog (gs, fs) = TestCase $+ assertNewName gs { gMetadata = meta } fs "Analog" expected where meta = emptyMetadata { metaCreators = [Creator Nothing Nothing- "Dell Magazine Authors"]- , metaTitles = [Title Nothing+ Nothing "Dell Magazine Authors"]+ , metaTitles = [Title Nothing Nothing Nothing "Analog SFF, July-August 2003"] } expected =@@ -495,14 +597,14 @@ ) -testAsimovs :: (Options, [Formatter]) -> Test-testAsimovs (opts, fs) = TestCase $- assertNewName opts fs "Asimovs" meta expected+testAsimovs :: (Globals, [Formatter]) -> Test+testAsimovs (gs, fs) = TestCase $+ assertNewName gs { gMetadata = meta } fs "Asimovs" expected where meta = emptyMetadata { metaCreators = [Creator Nothing Nothing- "Dell Magazine Authors"]- , metaTitles = [Title Nothing+ Nothing "Dell Magazine Authors"]+ , metaTitles = [Title Nothing Nothing Nothing "Asimov's SF, August 2003"] } expected =@@ -510,21 +612,21 @@ , "AsimovsSF2003-08.epub" ) -testFantasyMagazine :: (Options, [Formatter]) -> Test-testFantasyMagazine (opts, fs) = TestCase $- assertNewName opts fs "Fantasy Magazine" meta expected+testFantasyMagazine :: (Globals, [Formatter]) -> Test+testFantasyMagazine (gs, fs) = TestCase $+ assertNewName gs { gMetadata = meta } fs "Fantasy Magazine" expected where meta = emptyMetadata { metaCreators =- [ Creator (Just "aut") (Just "Howard, Kat & Tanzer, Molly & Beagle, Peter S. & Howard, Jonathan L. & Valentine, Genevieve & Vaughn, Carrie & Pilinovsky, Helen") "Kat Howard"- , Creator (Just "aut") Nothing "Molly Tanzer"- , Creator (Just "aut") Nothing "Peter S. Beagle"- , Creator (Just "aut") Nothing "Jonathan L. Howard"- , Creator (Just "aut") Nothing "Genevieve Valentine"- , Creator (Just "aut") Nothing "Carrie Vaughn"- , Creator (Just "aut") Nothing "Helen Pilinovsky"+ [ Creator (Just "aut") (Just "Howard, Kat & Tanzer, Molly & Beagle, Peter S. & Howard, Jonathan L. & Valentine, Genevieve & Vaughn, Carrie & Pilinovsky, Helen") Nothing "Kat Howard"+ , Creator (Just "aut") Nothing Nothing "Molly Tanzer"+ , Creator (Just "aut") Nothing Nothing "Peter S. Beagle"+ , Creator (Just "aut") Nothing Nothing "Jonathan L. Howard"+ , Creator (Just "aut") Nothing Nothing "Genevieve Valentine"+ , Creator (Just "aut") Nothing Nothing "Carrie Vaughn"+ , Creator (Just "aut") Nothing Nothing "Helen Pilinovsky" ]- , metaTitles = [Title Nothing+ , metaTitles = [Title Nothing Nothing Nothing "Fantasy Magazine Issue 49"] } expected =@@ -533,14 +635,15 @@ ) -testFsfShort :: (Options, [Formatter]) -> Test-testFsfShort (opts, fs) = TestCase $- assertNewName opts fs "FSF Magazine, short" meta expected+testFsfShort :: (Globals, [Formatter]) -> Test+testFsfShort (gs, fs) = TestCase $+ assertNewName gs { gMetadata = meta } fs+ "FSF Magazine, short" expected where meta = emptyMetadata { metaCreators = [Creator Nothing Nothing- "Spilogale Authors"]- , metaTitles = [Title Nothing "FSF Oct/Nov 2003"]+ Nothing "Spilogale Authors"]+ , metaTitles = [Title Nothing Nothing Nothing "FSF Oct/Nov 2003"] } expected = ( "magFsf"@@ -548,14 +651,15 @@ ) -testFsfShortComma :: (Options, [Formatter]) -> Test-testFsfShortComma (opts, fs) = TestCase $- assertNewName opts fs "FSF Magazine, short, comma" meta expected+testFsfShortComma :: (Globals, [Formatter]) -> Test+testFsfShortComma (gs, fs) = TestCase $+ assertNewName gs { gMetadata = meta } fs+ "FSF Magazine, short, comma" expected where meta = emptyMetadata { metaCreators = [Creator Nothing Nothing- "Spilogale Authors"]- , metaTitles = [Title Nothing "FSF, April 2008"]+ Nothing "Spilogale Authors"]+ , metaTitles = [Title Nothing Nothing Nothing "FSF, April 2008"] } expected = ( "magFsf"@@ -563,14 +667,15 @@ ) -testFsfLong :: (Options, [Formatter]) -> Test-testFsfLong (opts, fs) = TestCase $- assertNewName opts fs "FSF Magazine, long" meta expected+testFsfLong :: (Globals, [Formatter]) -> Test+testFsfLong (gs, fs) = TestCase $+ assertNewName gs { gMetadata = meta } fs+ "FSF Magazine, long" expected where meta = emptyMetadata { metaCreators = [Creator Nothing Nothing - "Spilogale Authors"]- , metaTitles = [Title Nothing + Nothing "Spilogale Authors"]+ , metaTitles = [Title Nothing Nothing Nothing "FSF Magazine, April 2006"] } expected =@@ -579,14 +684,15 @@ ) -testFsfAmpersand :: (Options, [Formatter]) -> Test-testFsfAmpersand (opts, fs) = TestCase $- assertNewName opts fs "FSF Magazine, ampersand" meta expected+testFsfAmpersand :: (Globals, [Formatter]) -> Test+testFsfAmpersand (gs, fs) = TestCase $+ assertNewName gs { gMetadata = meta } fs+ "FSF Magazine, ampersand" expected where meta = emptyMetadata { metaCreators = [Creator Nothing Nothing- "Spilogale"]- , metaTitles = [Title Nothing "F&SF, Apr 2004"]+ Nothing "Spilogale"]+ , metaTitles = [Title Nothing Nothing Nothing "F&SF, Apr 2004"] } expected = ( "magFsf"@@ -594,14 +700,15 @@ ) -testFsfAmpersandSpaces :: (Options, [Formatter]) -> Test-testFsfAmpersandSpaces (opts, fs) = TestCase $- assertNewName opts fs "FSF Magazine, ampersand, spaces" meta expected+testFsfAmpersandSpaces :: (Globals, [Formatter]) -> Test+testFsfAmpersandSpaces (gs, fs) = TestCase $+ assertNewName gs { gMetadata = meta } fs+ "FSF Magazine, ampersand, spaces" expected where meta = emptyMetadata { metaCreators = [Creator Nothing Nothing- "Spilogale"]- , metaTitles = [Title Nothing "F & SF Dec 2003"]+ Nothing "Spilogale"]+ , metaTitles = [Title Nothing Nothing Nothing "F & SF Dec 2003"] } expected = ( "magFsf"@@ -609,14 +716,15 @@ ) -testMagFutureOrbits :: (Options, [Formatter]) -> Test-testMagFutureOrbits (opts, fs) = TestCase $- assertNewName opts fs "testMagFutureOrbits" meta expected+testMagFutureOrbits :: (Globals, [Formatter]) -> Test+testMagFutureOrbits (gs, fs) = TestCase $+ assertNewName gs { gMetadata = meta } fs+ "testMagFutureOrbits" expected where meta = emptyMetadata { metaCreators = [Creator Nothing Nothing - "Vander Neut Publications, L.L.C."]- , metaTitles = [Title Nothing + Nothing "Vander Neut Publications, L.L.C."]+ , metaTitles = [Title Nothing Nothing Nothing "Future Orbits Issue 5, June/July 2002"] } expected =@@ -625,14 +733,15 @@ ) -testGudShort :: (Options, [Formatter]) -> Test-testGudShort (opts, fs) = TestCase $- assertNewName opts fs "Gud Magazine, short" meta expected+testGudShort :: (Globals, [Formatter]) -> Test+testGudShort (gs, fs) = TestCase $+ assertNewName gs { gMetadata = meta } fs+ "Gud Magazine, short" expected where meta = emptyMetadata { metaCreators = [Creator Nothing Nothing - "GUD Magazine Authors"]- , metaTitles = [Title Nothing + Nothing "GUD Magazine Authors"]+ , metaTitles = [Title Nothing Nothing Nothing "GUD Magazine Issue 0 :: Spring 2007"] } expected =@@ -641,14 +750,15 @@ ) -testGudLong :: (Options, [Formatter]) -> Test-testGudLong (opts, fs) = TestCase $- assertNewName opts fs "Gud Magazine, long" meta expected+testGudLong :: (Globals, [Formatter]) -> Test+testGudLong (gs, fs) = TestCase $+ assertNewName gs { gMetadata = meta } fs+ "Gud Magazine, long" expected where meta = emptyMetadata { metaCreators = [Creator Nothing Nothing - "GUD Magazine Authors, Jeff Somers, Jeremy Shipp"]- , metaTitles = [Title Nothing + Nothing "GUD Magazine Authors, Jeff Somers, Jeremy Shipp"]+ , metaTitles = [Title Nothing Nothing Nothing "GUD Magazine Issue 2 :: Spring 2008"] } expected =@@ -657,14 +767,15 @@ ) -testGudVeryLong :: (Options, [Formatter]) -> Test-testGudVeryLong (opts, fs) = TestCase $- assertNewName opts fs "Gud Magazine, very long" meta expected+testGudVeryLong :: (Globals, [Formatter]) -> Test+testGudVeryLong (gs, fs) = TestCase $+ assertNewName gs { gMetadata = meta } fs+ "Gud Magazine, very long" expected where meta = emptyMetadata { metaCreators = [Creator Nothing Nothing - "GUD Magazine Authors"]- , metaTitles = [Title Nothing + Nothing "GUD Magazine Authors"]+ , metaTitles = [Title Nothing Nothing Nothing "Greatest Uncommon Denominator Magazine Issue 4 :: Spring 2009"] } expected =@@ -673,14 +784,15 @@ ) -testInterzoneOldShort :: (Options, [Formatter]) -> Test-testInterzoneOldShort (opts, fs) = TestCase $- assertNewName opts fs "Interzone Magazine, old style, short" meta expected+testInterzoneOldShort :: (Globals, [Formatter]) -> Test+testInterzoneOldShort (gs, fs) = TestCase $+ assertNewName gs { gMetadata = meta } fs+ "Interzone Magazine, old style, short" expected where meta = emptyMetadata { metaCreators = [Creator Nothing Nothing - "TTA Press Authors"]- , metaTitles = [Title Nothing + Nothing "TTA Press Authors"]+ , metaTitles = [Title Nothing Nothing Nothing "Interzone SFF #212"] } expected =@@ -689,14 +801,15 @@ ) -testInterzoneOldLong :: (Options, [Formatter]) -> Test-testInterzoneOldLong (opts, fs) = TestCase $- assertNewName opts fs "Interzone Magazine, old style, long" meta expected+testInterzoneOldLong :: (Globals, [Formatter]) -> Test+testInterzoneOldLong (gs, fs) = TestCase $+ assertNewName gs { gMetadata = meta } fs+ "Interzone Magazine, old style, long" expected where meta = emptyMetadata { metaCreators = [Creator Nothing Nothing - "TTA Press Authors"]- , metaTitles = [Title Nothing + Nothing "TTA Press Authors"]+ , metaTitles = [Title Nothing Nothing Nothing "Interzone Science Fiction and Fantasy Magazine #216"] } expected =@@ -705,14 +818,15 @@ ) -testInterzone :: (Options, [Formatter]) -> Test-testInterzone (opts, fs) = TestCase $- assertNewName opts fs "Interzone Magazine, Smashwords style" meta expected+testInterzone :: (Globals, [Formatter]) -> Test+testInterzone (gs, fs) = TestCase $+ assertNewName gs { gMetadata = meta } fs+ "Interzone Magazine, Smashwords style" expected where meta = emptyMetadata { metaCreators = [Creator Nothing Nothing - "TTA Press"]- , metaTitles = [Title Nothing + Nothing "TTA Press"]+ , metaTitles = [Title Nothing Nothing Nothing "Interzone 233 Mar - Apr 2011"] } expected =@@ -721,14 +835,15 @@ ) -testNemesisShort :: (Options, [Formatter]) -> Test-testNemesisShort (opts, fs) = TestCase $- assertNewName opts fs "Nemesis Magazine, short" meta expected+testNemesisShort :: (Globals, [Formatter]) -> Test+testNemesisShort (gs, fs) = TestCase $+ assertNewName gs { gMetadata = meta } fs+ "Nemesis Magazine, short" expected where meta = emptyMetadata { metaCreators = [Creator Nothing Nothing - "Stephen Adams"]- , metaTitles = [Title Nothing + Nothing "Stephen Adams"]+ , metaTitles = [Title Nothing Nothing Nothing "Nemesis Magazine #2"] } expected =@@ -737,14 +852,15 @@ ) -testNemesisLong :: (Options, [Formatter]) -> Test-testNemesisLong (opts, fs) = TestCase $- assertNewName opts fs "Nemesis Magazine, long" meta expected+testNemesisLong :: (Globals, [Formatter]) -> Test+testNemesisLong (gs, fs) = TestCase $+ assertNewName gs { gMetadata = meta } fs+ "Nemesis Magazine, long" expected where meta = emptyMetadata { metaCreators = [Creator Nothing Nothing - "Stephen Adams"]- , metaTitles = [Title Nothing + Nothing "Stephen Adams"]+ , metaTitles = [Title Nothing Nothing Nothing "Nemesis Magazine #7: Featuring Victory Rose in Death Stalks the Ruins"] } expected =@@ -753,14 +869,15 @@ ) -testMagSomethingWicked :: (Options, [Formatter]) -> Test-testMagSomethingWicked (opts, fs) = TestCase $- assertNewName opts fs "Something Wicked Magazine" meta expected+testMagSomethingWicked :: (Globals, [Formatter]) -> Test+testMagSomethingWicked (gs, fs) = TestCase $+ assertNewName gs { gMetadata = meta } fs+ "Something Wicked Magazine" expected where meta = emptyMetadata- { metaCreators = [Creator Nothing Nothing + { metaCreators = [Creator Nothing Nothing Nothing "Something Wicked Authors"]- , metaTitles = [Title Nothing + , metaTitles = [Title Nothing Nothing Nothing "Something Wicked SF and Horror Magazine #5"] } expected =@@ -769,15 +886,17 @@ ) -testMagSomethingWickedMonth :: (Options, [Formatter]) -> Test-testMagSomethingWickedMonth (opts, fs) = TestCase $- assertNewName opts fs "Something Wicked Magazine, month in title" meta expected+testMagSomethingWickedMonth :: (Globals, [Formatter]) -> Test+testMagSomethingWickedMonth (gs, fs) = TestCase $+ assertNewName gs { gMetadata = meta } fs+ "Something Wicked Magazine, month in title" expected where meta = emptyMetadata { metaCreators = [Creator (Just "aut") (Just "Authors, Something Wicked")+ Nothing "Something Wicked Authors"]- , metaTitles = [Title Nothing + , metaTitles = [Title Nothing Nothing Nothing "Something Wicked #14 (October 2011)"] } expected =@@ -786,14 +905,15 @@ ) -testSFBestOf :: (Options, [Formatter]) -> Test-testSFBestOf (opts, fs) = TestCase $- assertNewName opts fs "Science Fiction: The Best of the Year" meta expected+testSFBestOf :: (Globals, [Formatter]) -> Test+testSFBestOf (gs, fs) = TestCase $+ assertNewName gs { gMetadata = meta } fs+ "Science Fiction: The Best of the Year" expected where meta = emptyMetadata { metaCreators = [Creator Nothing Nothing - "Rich Horton"]- , metaTitles = [Title Nothing + Nothing "Rich Horton"]+ , metaTitles = [Title Nothing Nothing Nothing "Science Fiction: The Best of the Year, 2007 Edition"] , metaSubjects = ["anthology"] }@@ -803,16 +923,17 @@ ) -testBestSF :: (Options, [Formatter]) -> Test-testBestSF (opts, fs) = TestCase $- assertNewName opts fs "The Best Science Fiction and Fantasy of the Year"- meta expected+testBestSF :: (Globals, [Formatter]) -> Test+testBestSF (gs, fs) = TestCase $+ assertNewName gs { gMetadata = meta } fs+ "The Best Science Fiction and Fantasy of the Year" expected where meta = emptyMetadata { metaCreators = [Creator (Just "aut") (Just "Strahan, Jonathan")+ Nothing "Jonathan Strahan"]- , metaTitles = [Title Nothing + , metaTitles = [Title Nothing Nothing Nothing "The Best Science Fiction and Fantasy of the Year: Volume 2"] , metaSubjects = ["anthology"] }@@ -822,14 +943,15 @@ ) -testYearsBest :: (Options, [Formatter]) -> Test-testYearsBest (opts, fs) = TestCase $- assertNewName opts fs "The Year's Best SF" meta expected+testYearsBest :: (Globals, [Formatter]) -> Test+testYearsBest (gs, fs) = TestCase $+ assertNewName gs { gMetadata = meta } fs+ "The Year's Best SF" expected where meta = emptyMetadata- { metaCreators = [Creator (Just "aut") Nothing + { metaCreators = [Creator (Just "aut") Nothing Nothing "Rich Horton, Michael Swanwick, Karen Joy Fowler"]- , metaTitles = [Title Nothing + , metaTitles = [Title Nothing Nothing Nothing "The Year's Best Science Fiction: 2008 Edition"] , metaSubjects = ["anthology"] }@@ -839,14 +961,15 @@ ) -testMagBlackStatic :: (Options, [Formatter]) -> Test-testMagBlackStatic (opts, fs) = TestCase $- assertNewName opts fs "Black Static Magazine" meta expected+testMagBlackStatic :: (Globals, [Formatter]) -> Test+testMagBlackStatic (gs, fs) = TestCase $+ assertNewName gs { gMetadata = meta } fs+ "Black Static Magazine" expected where meta = emptyMetadata { metaCreators = [Creator Nothing Nothing - "TTA Press Authors"]- , metaTitles = [Title Nothing + Nothing "TTA Press Authors"]+ , metaTitles = [Title Nothing Nothing Nothing "Black Static Horror Magazine #5"] } expected =@@ -855,14 +978,15 @@ ) -testRageMachineMag :: (Options, [Formatter]) -> Test-testRageMachineMag (opts, fs) = TestCase $- assertNewName opts fs "Rage Machine Magazine" meta expected+testRageMachineMag :: (Globals, [Formatter]) -> Test+testRageMachineMag (gs, fs) = TestCase $+ assertNewName gs { gMetadata = meta } fs+ "Rage Machine Magazine" expected where meta = emptyMetadata { metaCreators = [Creator (Just "edt") Nothing - "G. W. Thomas"]- , metaTitles = [Title Nothing + Nothing "G. W. Thomas"]+ , metaTitles = [Title Nothing Nothing Nothing "Rage Machine Magazine #1--December 2005"] } expected =@@ -871,15 +995,17 @@ ) -testEclipseMagWord :: (Options, [Formatter]) -> Test-testEclipseMagWord (opts, fs) = TestCase $- assertNewName opts fs "Eclipse Magazine" meta expected+testEclipseMagWord :: (Globals, [Formatter]) -> Test+testEclipseMagWord (gs, fs) = TestCase $+ assertNewName gs { gMetadata = meta } fs+ "Eclipse Magazine" expected where meta = emptyMetadata { metaCreators = [Creator (Just "aut") (Just "Strahan, Jonathan")+ Nothing "Jonathan Strahan"]- , metaTitles = [Title Nothing + , metaTitles = [Title Nothing Nothing Nothing "Eclipse One"] } expected =@@ -888,15 +1014,17 @@ ) -testEclipseMagNum :: (Options, [Formatter]) -> Test-testEclipseMagNum (opts, fs) = TestCase $- assertNewName opts fs "Eclipse Magazine" meta expected+testEclipseMagNum :: (Globals, [Formatter]) -> Test+testEclipseMagNum (gs, fs) = TestCase $+ assertNewName gs { gMetadata = meta } fs+ "Eclipse Magazine" expected where meta = emptyMetadata { metaCreators = [Creator (Just "aut") (Just "Strahan, Jonathan")+ Nothing "Jonathan Strahan"]- , metaTitles = [Title Nothing + , metaTitles = [Title Nothing Nothing Nothing "Eclipse 4: New Science Fiction and Fantasy"] } expected =@@ -905,20 +1033,23 @@ ) -testBcs :: (Options, [Formatter]) -> Test-testBcs (opts, fs) = TestCase $- assertNewName opts fs "Beneath Ceaseless Skies Magazine" meta expected+testBcs :: (Globals, [Formatter]) -> Test+testBcs (gs, fs) = TestCase $+ assertNewName gs { gMetadata = meta } fs+ "Beneath Ceaseless Skies Magazine" expected where meta = emptyMetadata { metaCreators = [ Creator (Just "aut") (Just "Tidwell, Erin A.")+ Nothing "Hoover, Kenneth Mark" , Creator (Just "aut") (Just "Tidwell, Erin A.")+ Nothing "Tidwell, Erin A." ]- , metaTitles = [Title Nothing + , metaTitles = [Title Nothing Nothing Nothing "Beneath Ceaseless Skies #32"] } expected =@@ -927,19 +1058,19 @@ ) -testBkpFileAs :: (Options, [Formatter]) -> Test-testBkpFileAs (opts, fs) = TestCase $- assertNewName testOpts fs+testBkpFileAs :: (Globals, [Formatter]) -> Test+testBkpFileAs (gs, fs) = TestCase $+ assertNewName gs { gOpts = testOpts, gMetadata = meta } fs "book publisher suffix requested and present in file-as"- meta expected+ expected where- testOpts = opts { optPublisher = True }+ testOpts = (gOpts gs) { optPublisher = True } meta = emptyMetadata { metaCreators = [Creator (Just "aut") Nothing- "Herman Melville"]+ Nothing "Herman Melville"] , metaContributors = [Creator (Just "bkp") (Just "acme") - "Acme Publishing, Inc."]- , metaTitles = [Title Nothing "Moby Dick"]+ Nothing "Acme Publishing, Inc."]+ , metaTitles = [Title Nothing Nothing Nothing "Moby Dick"] } expected = ( "ordinary_book"@@ -947,19 +1078,19 @@ ) -testBkpText :: (Options, [Formatter]) -> Test-testBkpText (opts, fs) = TestCase $- assertNewName testOpts fs+testBkpText :: (Globals, [Formatter]) -> Test+testBkpText (gs, fs) = TestCase $+ assertNewName gs { gOpts = testOpts, gMetadata = meta } fs "book publisher suffix requested and present in text"- meta expected+ expected where- testOpts = opts { optPublisher = True }+ testOpts = (gOpts gs) { optPublisher = True } meta = emptyMetadata { metaCreators = [Creator (Just "aut") Nothing- "Herman Melville"]+ Nothing "Herman Melville"] , metaContributors = [Creator (Just "bkp") Nothing- "Acme Publishing, Inc."]- , metaTitles = [Title Nothing "Moby Dick"]+ Nothing "Acme Publishing, Inc."]+ , metaTitles = [Title Nothing Nothing Nothing "Moby Dick"] } expected = ( "ordinary_book"@@ -967,17 +1098,17 @@ ) -testBkpMissing :: (Options, [Formatter]) -> Test-testBkpMissing (opts, fs) = TestCase $- assertNewName testOpts fs+testBkpMissing :: (Globals, [Formatter]) -> Test+testBkpMissing (gs, fs) = TestCase $+ assertNewName gs { gOpts = testOpts, gMetadata = meta } fs "book publisher suffix requested and not present"- meta expected+ expected where- testOpts = opts { optPublisher = True }+ testOpts = (gOpts gs) { optPublisher = True } meta = emptyMetadata { metaCreators = [Creator (Just "aut") Nothing- "Herman Melville"]- , metaTitles = [Title Nothing "Moby Dick"]+ Nothing "Herman Melville"]+ , metaTitles = [Title Nothing Nothing Nothing "Moby Dick"] } expected = ( "ordinary_book"@@ -985,17 +1116,17 @@ ) -testMagUniverse :: (Options, [Formatter]) -> Test-testMagUniverse (opts, fs) = TestCase $- assertNewName testOpts fs- "Jim Baen's Universe Magazine"- meta expected+testMagUniverse :: (Globals, [Formatter]) -> Test+testMagUniverse (gs, fs) = TestCase $+ assertNewName gs { gOpts = testOpts, gMetadata = meta } fs+ "Jim Baen's Universe Magazine" expected where- testOpts = opts { optPublisher = True }+ testOpts = (gOpts gs) { optPublisher = True } meta = emptyMetadata { metaCreators = [Creator (Just "aut") Nothing- "Jim Baen's Universe"]- , metaTitles = [Title Nothing "Jim Baen's Universe-Vol 4 Num 6"]+ Nothing "Jim Baen's Universe"]+ , metaTitles = [Title Nothing Nothing Nothing+ "Jim Baen's Universe-Vol 4 Num 6"] } expected = ( "magUniverse"@@ -1003,15 +1134,16 @@ ) -testMagClarkesworld :: (Options, [Formatter]) -> Test-testMagClarkesworld (opts, fs) = TestCase $- assertNewName opts fs "Clarkesworld Magazine" meta expected+testMagClarkesworld :: (Globals, [Formatter]) -> Test+testMagClarkesworld (gs, fs) = TestCase $+ assertNewName gs { gMetadata = meta } fs+ "Clarkesworld Magazine" expected where meta = emptyMetadata { metaCreators = [Creator (Just "aut")- (Just "Kowal, Mary Robinette")+ (Just "Kowal, Mary Robinette") Nothing "Mary Robinette Kowal"]- , metaTitles = [Title Nothing+ , metaTitles = [Title Nothing Nothing Nothing "Clarkesworld Magazine - Issue 21"] } expected =@@ -1020,14 +1152,15 @@ ) -testLightspeedDate :: (Options, [Formatter]) -> Test-testLightspeedDate (opts, fs) = TestCase $- assertNewName opts fs "Lightspeed Magazine, date in title" meta expected+testLightspeedDate :: (Globals, [Formatter]) -> Test+testLightspeedDate (gs, fs) = TestCase $+ assertNewName gs { gMetadata = meta } fs+ "Lightspeed Magazine, date in title" expected where meta = emptyMetadata- { metaCreators = [Creator (Just "aut") Nothing+ { metaCreators = [Creator (Just "aut") Nothing Nothing "Edited by John Joseph Adams"]- , metaTitles = [Title Nothing + , metaTitles = [Title Nothing Nothing Nothing "Lightspeed Magazine, June 2010"] } expected =@@ -1036,14 +1169,14 @@ ) -testLightspeedMagIssue :: (Options, [Formatter]) -> Test-testLightspeedMagIssue (opts, fs) = TestCase $- assertNewName opts fs- "Lightspeed Magazine, issue number in title" meta expected+testLightspeedMagIssue :: (Globals, [Formatter]) -> Test+testLightspeedMagIssue (gs, fs) = TestCase $+ assertNewName gs { gMetadata = meta } fs+ "Lightspeed Magazine, issue number in title" expected where meta = emptyMetadata- { metaCreators = [Creator (Just "aut") (Just "Magazine, Lightspeed & Clark, Maggie & Valentine, Genevieve & Baxter, Stephen & Okorafor, Nnedi & Wilison, Daniel H. & Reed, Robert & Sedia, Ekaterina") "Lightspeed Magazine"]- , metaTitles = [Title Nothing + { metaCreators = [Creator (Just "aut") (Just "Magazine, Lightspeed & Clark, Maggie & Valentine, Genevieve & Baxter, Stephen & Okorafor, Nnedi & Wilison, Daniel H. & Reed, Robert & Sedia, Ekaterina") Nothing "Lightspeed Magazine"]+ , metaTitles = [Title Nothing Nothing Nothing "Lightspeed Magazine Issue 10"] } expected =@@ -1052,13 +1185,13 @@ ) -testLightspeedIssue :: (Options, [Formatter]) -> Test-testLightspeedIssue (opts, fs) = TestCase $- assertNewName opts fs- "Lightspeed Magazine, issue number in title" meta expected+testLightspeedIssue :: (Globals, [Formatter]) -> Test+testLightspeedIssue (gs, fs) = TestCase $+ assertNewName gs { gMetadata = meta } fs+ "Lightspeed Magazine, issue number in title" expected where meta = emptyMetadata- { metaTitles = [Title Nothing + { metaTitles = [Title Nothing Nothing Nothing "Lightspeed Issue 33"] } expected =@@ -1067,18 +1200,19 @@ ) -testMagWeirdTales :: (Options, [Formatter]) -> Test-testMagWeirdTales (opts, fs) = TestCase $- assertNewName opts fs "Weird Tales magazine" meta expected+testMagWeirdTales :: (Globals, [Formatter]) -> Test+testMagWeirdTales (gs, fs) = TestCase $+ assertNewName gs { gMetadata = meta } fs+ "Weird Tales magazine" expected where meta = emptyMetadata { metaCreators =- [ Creator (Just "aut") Nothing "VanderMeer"- , Creator (Just "aut") Nothing "Ann"- , Creator (Just "aut") Nothing "Spinrad"- , Creator (Just "aut") Nothing "Norman"+ [ Creator (Just "aut") Nothing Nothing "VanderMeer"+ , Creator (Just "aut") Nothing Nothing "Ann"+ , Creator (Just "aut") Nothing Nothing "Spinrad"+ , Creator (Just "aut") Nothing Nothing "Norman" ]- , metaTitles = [Title Nothing + , metaTitles = [Title Nothing Nothing Nothing "Weird Tales #350"] } expected =@@ -1087,16 +1221,16 @@ ) -testAnthology :: (Options, [Formatter]) -> Test-testAnthology (opts, fs) = TestCase $- assertNewName opts fs "anthology" meta expected+testAnthology :: (Globals, [Formatter]) -> Test+testAnthology (gs, fs) = TestCase $+ assertNewName gs { gMetadata = meta } fs "anthology" expected where meta = emptyMetadata- { metaTitles = [Title Nothing "Creepy Secrets"]+ { metaTitles = [Title Nothing Nothing Nothing "Creepy Secrets"] , metaCreators =- [ Creator (Just "aut") (Just "Snively, Mortimer")+ [ Creator (Just "aut") (Just "Snively, Mortimer") Nothing "Mortimer Snively"- , Creator (Just "aut") (Just "Baxter, Joanne")+ , Creator (Just "aut") (Just "Baxter, Joanne") Nothing "Joanne Baxter" ] , metaDates = [Date (Just "publication") "2010-11-01"]