epub-tools 2.10 → 2.11
raw patch · 29 files changed
+144/−75 lines, 29 filessetup-changed
Files
- LICENSE +11/−28
- Setup.hs +1/−1
- changelog.md +7/−0
- epub-tools.cabal +3/−3
- src/EpubTools/EpubMeta/Display.hs +1/−1
- src/EpubTools/EpubMeta/Edit.hs +1/−1
- src/EpubTools/EpubMeta/Export.hs +1/−1
- src/EpubTools/EpubMeta/Import.hs +1/−1
- src/EpubTools/EpubMeta/Opts.hs +1/−1
- src/EpubTools/EpubMeta/Util.hs +1/−1
- src/EpubTools/EpubName/Doc/Dsl.hs +1/−1
- src/EpubTools/EpubName/Doc/Rules.hs +9/−5
- src/EpubTools/EpubName/Format/Author.hs +1/−1
- src/EpubTools/EpubName/Format/Compile.hs +1/−1
- src/EpubTools/EpubName/Format/Format.hs +8/−2
- src/EpubTools/EpubName/Format/PubYear.hs +1/−1
- src/EpubTools/EpubName/Format/Util.hs +1/−1
- src/EpubTools/EpubName/Main.hs +1/−1
- src/EpubTools/EpubName/Opts.hs +1/−1
- src/EpubTools/EpubName/Prompt.hs +3/−0
- src/EpubTools/EpubName/Util.hs +1/−1
- src/EpubTools/EpubZip/Opts.hs +1/−1
- src/EpubTools/epubmeta.hs +1/−1
- src/EpubTools/epubname.hs +1/−1
- src/EpubTools/epubzip.hs +1/−1
- testsuite/EpubTools/Test/EpubName/Format.hs +81/−14
- testsuite/EpubTools/Test/EpubName/PubYear.hs +1/−1
- testsuite/EpubTools/test-epubname.hs +1/−1
- util/install.hs +1/−2
LICENSE view
@@ -1,30 +1,13 @@-Copyright (c) 2008-2016 Dino Morelli-All rights reserved.--Redistribution and use in source and binary forms, with or without-modification, are permitted provided that the following conditions are-met:-- * Redistributions of source code must retain the above copyright- notice, this list of conditions and the following disclaimer.-- * Redistributions in binary form must reproduce the above- copyright notice, this list of conditions and the following- disclaimer in the documentation and/or other materials provided- with the distribution.+Copyright (c) 2008-2018 Dino Morelli - * Neither the name of Dino Morelli nor the names of other- contributors may be used to endorse or promote products derived- from this software without specific prior written permission.+Permission to use, copy, modify, and/or distribute this software for any purpose+with or without fee is hereby granted, provided that the above copyright notice+and this permission notice appear in all copies. -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.+THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH+REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND+FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,+INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS+OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER+TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF+THIS SOFTWARE.
Setup.hs view
@@ -1,6 +1,6 @@ #! /usr/bin/env runhaskell --- License: BSD3 (see LICENSE)+-- License: ISC (see LICENSE) -- Author: Dino Morelli <dino@ui3.info> import Distribution.Simple
changelog.md view
@@ -1,3 +1,10 @@+2.11 (2018-01-16)++ * Switched license from BSD3 to ISC+ * Fixes and additions to some epubname rules+ * Fixed a couple of cabal file issues++ 2.10 (2017-12-24) * Changed the Stackage resolver from a nightly to an lts
epub-tools.cabal view
@@ -1,10 +1,10 @@ name: epub-tools cabal-version: >= 1.10-version: 2.10+version: 2.11 build-type: Simple-license: BSD3+license: ISC license-file: LICENSE-copyright: 2008-2016 Dino Morelli+copyright: 2008-2018 Dino Morelli author: Dino Morelli maintainer: Dino Morelli <dino@ui3.info> homepage: https://github.com/dino-/epub-tools.git
src/EpubTools/EpubMeta/Display.hs view
@@ -1,4 +1,4 @@--- License: BSD3 (see LICENSE)+-- License: ISC (see LICENSE) -- Author: Dino Morelli <dino@ui3.info> module EpubTools.EpubMeta.Display
src/EpubTools/EpubMeta/Edit.hs view
@@ -1,4 +1,4 @@--- License: BSD3 (see LICENSE)+-- License: ISC (see LICENSE) -- Author: Dino Morelli <dino@ui3.info> {-# LANGUAGE ScopedTypeVariables #-}
src/EpubTools/EpubMeta/Export.hs view
@@ -1,4 +1,4 @@--- License: BSD3 (see LICENSE)+-- License: ISC (see LICENSE) -- Author: Dino Morelli <dino@ui3.info> module EpubTools.EpubMeta.Export
src/EpubTools/EpubMeta/Import.hs view
@@ -1,4 +1,4 @@--- License: BSD3 (see LICENSE)+-- License: ISC (see LICENSE) -- Author: Dino Morelli <dino@ui3.info> module EpubTools.EpubMeta.Import
src/EpubTools/EpubMeta/Opts.hs view
@@ -1,4 +1,4 @@--- License: BSD3 (see LICENSE)+-- License: ISC (see LICENSE) -- Author: Dino Morelli <dino@ui3.info> module EpubTools.EpubMeta.Opts
src/EpubTools/EpubMeta/Util.hs view
@@ -1,4 +1,4 @@--- License: BSD3 (see LICENSE)+-- License: ISC (see LICENSE) -- Author: Dino Morelli <dino@ui3.info> module EpubTools.EpubMeta.Util
src/EpubTools/EpubName/Doc/Dsl.hs view
@@ -1,4 +1,4 @@--- License: BSD3 (see LICENSE)+-- License: ISC (see LICENSE) -- Author: Dino Morelli <dino@ui3.info> module EpubTools.EpubName.Doc.Dsl
src/EpubTools/EpubName/Doc/Rules.hs view
@@ -1,4 +1,4 @@--- License: BSD3 (see LICENSE)+-- License: ISC (see LICENSE) -- Author: Dino Morelli <dino@ui3.info> module EpubTools.EpubName.Doc.Rules@@ -13,14 +13,14 @@ , " titlePat \"^A[eE]on ([^ ]+)$\"" , " name \"AeonMagazine(wordNum 2 1)\"" , ""+ , "magApex"+ , " titlePat \"^(Apex)[^0-9]*([0-9]{1,3}).*\""+ , " name \"(scrub 1)Magazine(pad 3 2)\""+ , "" , "magAnalog" , " titlePat \"^(A[^ ]*).*, ([^ ]+) ([0-9]{4})$\"" , " name \"(scrub 1)SF(3)-(monthNum 2)\"" , ""- , "magApex"- , " titlePat \"^(Apex)[^0-9]*([0-9]+)$\""- , " name \"(scrub 1)Magazine(pad 3 2)\""- , "" , "magBcs" , " titlePat \"(Beneath Ceaseless.*) #([0-9]+).*\"" , " name \"(scrub 1)_Issue(pad 3 2)\""@@ -74,6 +74,10 @@ , "magLightspeed_issue" , " titlePat \"(Lightspeed).* Issue ([^ ]+)(.*)\"" , " name \"(1)(pad 3 2)\""+ , ""+ , "magLunaStationQuarterly"+ , " titlePat \"(Luna Station Quarterly) - Issue ([0-9]+)\""+ , " name \"(scrub 1)(pad 3 2)\"" , "" , "magNemesis" , " titlePat \"(Nemesis Mag)azine #([0-9]+).*\""
src/EpubTools/EpubName/Format/Author.hs view
@@ -1,4 +1,4 @@--- License: BSD3 (see LICENSE)+-- License: ISC (see LICENSE) -- Author: Dino Morelli <dino@ui3.info> module EpubTools.EpubName.Format.Author
src/EpubTools/EpubName/Format/Compile.hs view
@@ -1,4 +1,4 @@--- License: BSD3 (see LICENSE)+-- License: ISC (see LICENSE) -- Author: Dino Morelli <dino@ui3.info> {-# OPTIONS_GHC -fno-warn-unused-do-bind #-}
src/EpubTools/EpubName/Format/Format.hs view
@@ -1,4 +1,4 @@--- License: BSD3 (see LICENSE)+-- License: ISC (see LICENSE) -- Author: Dino Morelli <dino@ui3.info> {-# LANGUAGE FlexibleContexts #-}@@ -253,15 +253,21 @@ monthStrToNumbers s | isPrefixOf s "September" = return "09" monthStrToNumbers "September-October" = return "09_10"+monthStrToNumbers "September/October" = return "09_10"+monthStrToNumbers "Sep-Oct" = return "09_10"+monthStrToNumbers "Sep/Oct" = return "09_10" monthStrToNumbers s | isPrefixOf s "October" = return "10" monthStrToNumbers "October-November" = return "10_11" monthStrToNumbers "October/November" = return "10_11" monthStrToNumbers "Oct-Nov" = return "10_11" monthStrToNumbers "Oct/Nov" = return "10_11"-monthStrToNumbers "November-December" = return "11_12" monthStrToNumbers s | isPrefixOf s "November" = return "11"+monthStrToNumbers "November-December" = return "11_12"+monthStrToNumbers "November/December" = return "11_12"+monthStrToNumbers "Nov-Dec" = return "11_12"+monthStrToNumbers "Nov/Dec" = return "11_12" monthStrToNumbers s | isPrefixOf s "December" = return "12" monthStrToNumbers s =
src/EpubTools/EpubName/Format/PubYear.hs view
@@ -1,4 +1,4 @@--- License: BSD3 (see LICENSE)+-- License: ISC (see LICENSE) -- Author: Dino Morelli <dino@ui3.info> module EpubTools.EpubName.Format.PubYear
src/EpubTools/EpubName/Format/Util.hs view
@@ -1,4 +1,4 @@--- License: BSD3 (see LICENSE)+-- License: ISC (see LICENSE) -- Author: Dino Morelli <dino@ui3.info> module EpubTools.EpubName.Format.Util
src/EpubTools/EpubName/Main.hs view
@@ -1,4 +1,4 @@--- License: BSD3 (see LICENSE)+-- License: ISC (see LICENSE) -- Author: Dino Morelli <dino@ui3.info> {-# LANGUAGE FlexibleContexts #-}
src/EpubTools/EpubName/Opts.hs view
@@ -1,4 +1,4 @@--- License: BSD3 (see LICENSE)+-- License: ISC (see LICENSE) -- Author: Dino Morelli <dino@ui3.info> {-# LANGUAGE FlexibleContexts #-}
src/EpubTools/EpubName/Prompt.hs view
@@ -1,3 +1,6 @@+-- License: ISC (see LICENSE)+-- Author: Dino Morelli <dino@ui3.info>+ module EpubTools.EpubName.Prompt ( PromptResult (..) , prompt
src/EpubTools/EpubName/Util.hs view
@@ -1,4 +1,4 @@--- License: BSD3 (see LICENSE)+-- License: ISC (see LICENSE) -- Author: Dino Morelli <dino@ui3.info> module EpubTools.EpubName.Util
src/EpubTools/EpubZip/Opts.hs view
@@ -1,4 +1,4 @@--- License: BSD3 (see LICENSE)+-- License: ISC (see LICENSE) -- Author: Dino Morelli <dino@ui3.info> module EpubTools.EpubZip.Opts
src/EpubTools/epubmeta.hs view
@@ -1,4 +1,4 @@--- License: BSD3 (see LICENSE)+-- License: ISC (see LICENSE) -- Author: Dino Morelli <dino@ui3.info> import Data.Maybe
src/EpubTools/epubname.hs view
@@ -1,4 +1,4 @@--- License: BSD3 (see LICENSE)+-- License: ISC (see LICENSE) -- Author: Dino Morelli <dino@ui3.info> -- This is for GHC 7.8/7.10 compatibility with the
src/EpubTools/epubzip.hs view
@@ -1,4 +1,4 @@--- License: BSD3 (see LICENSE)+-- License: ISC (see LICENSE) -- Author: Dino Morelli <dino@ui3.info> import Codec.Epub
testsuite/EpubTools/Test/EpubName/Format.hs view
@@ -1,4 +1,4 @@--- License: BSD3 (see LICENSE)+-- License: ISC (see LICENSE) -- Author: Dino Morelli <dino@ui3.info> module EpubTools.Test.EpubName.Format@@ -56,11 +56,13 @@ , testPubYearEpub2Unwanted , testMagAeon , testMagAEon+ , testMagApexPound+ , testMagApexIssue , testMagApexLong- , testMagApexShort , testChallengingDestinyShort , testChallengingDestinyLong- , testAnalog+ , testAnalogSingle+ , testAnalogDouble , testAsimovs , testFantasyMagazine , testFsfShort@@ -68,6 +70,7 @@ , testFsfLong , testFsfAmpersand , testFsfAmpersandSpaces+ , testFsfVeryLong , testMagFutureOrbits , testGudShort , testGudLong@@ -107,6 +110,7 @@ , testWomensInstituteLib , testAnthologyDate , testAnthology+ , testMagLunaStation ] @@ -662,27 +666,27 @@ ) -testMagApexLong :: (Globals, [Formatter]) -> Test-testMagApexLong (gs, fs) = TestCase $+testMagApexPound :: (Globals, [Formatter]) -> Test+testMagApexPound (gs, fs) = TestCase $ assertNewName gs { gMetadata = meta } fs- "Apex Magazine, older, long title" expected+ "Apex Magazine, pound sign and issue number" expected where meta = emptyMetadata { metaCreators = [Creator (Just "aut") Nothing Nothing "Apex Authors"] , metaTitles = [Title Nothing Nothing Nothing- "Apex Science Fiction and Horror Digest #9"]+ "Apex Magazine #16"] } expected = ( "magApex"- , "ApexMagazine009.epub"+ , "ApexMagazine016.epub" ) -testMagApexShort :: (Globals, [Formatter]) -> Test-testMagApexShort (gs, fs) = TestCase $+testMagApexIssue :: (Globals, [Formatter]) -> Test+testMagApexIssue (gs, fs) = TestCase $ assertNewName gs { gMetadata = meta } fs- "Apex Magazine, newer, short title" expected+ "Apex Magazine, Issue number" expected where meta = emptyMetadata { metaCreators = [Creator (Just "aut") Nothing@@ -696,6 +700,23 @@ ) +testMagApexLong :: (Globals, [Formatter]) -> Test+testMagApexLong (gs, fs) = TestCase $+ assertNewName gs { gMetadata = meta } fs+ "Apex Magazine, title with month year" expected+ where+ meta = emptyMetadata+ { metaCreators = [Creator (Just "aut") Nothing+ Nothing "Apex Authors"]+ , metaTitles = [Title Nothing Nothing Nothing+ "Apex Magazine: Issue 101, October 2017"]+ }+ expected =+ ( "magApex"+ , "ApexMagazine101.epub"+ )++ testChallengingDestinyShort :: (Globals, [Formatter]) -> Test testChallengingDestinyShort (gs, fs) = TestCase $ assertNewName gs { gMetadata = meta } fs@@ -730,14 +751,30 @@ ) -testAnalog :: (Globals, [Formatter]) -> Test-testAnalog (gs, fs) = TestCase $- assertNewName gs { gMetadata = meta } fs "Analog" expected+testAnalogSingle :: (Globals, [Formatter]) -> Test+testAnalogSingle (gs, fs) = TestCase $+ assertNewName gs { gMetadata = meta } fs "Analog, single month" expected where meta = emptyMetadata { metaCreators = [Creator Nothing Nothing Nothing "Dell Magazine Authors"] , metaTitles = [Title Nothing Nothing Nothing+ "Analog SFF, November 2010"]+ }+ expected =+ ( "magAnalog"+ , "AnalogSF2010-11.epub"+ )+++testAnalogDouble :: (Globals, [Formatter]) -> Test+testAnalogDouble (gs, fs) = TestCase $+ assertNewName gs { gMetadata = meta } fs "Analog, double month" expected+ where+ meta = emptyMetadata+ { metaCreators = [Creator Nothing Nothing+ Nothing "Dell Magazine Authors"]+ , metaTitles = [Title Nothing Nothing Nothing "Analog SFF, July-August 2003"] } expected =@@ -865,6 +902,22 @@ ) +testFsfVeryLong :: (Globals, [Formatter]) -> Test+testFsfVeryLong (gs, fs) = TestCase $+ assertNewName gs { gMetadata = meta } fs+ "FSF Magazine, very long name" expected+ where+ meta = emptyMetadata+ { metaCreators = [Creator Nothing Nothing+ Nothing "Spilogale Inc."]+ , metaTitles = [Title Nothing Nothing Nothing "Fantasy & Science Fiction, November/December 2017"]+ }+ expected =+ ( "magFsf"+ , "FantasyScienceFiction2017-11_12.epub"+ )++ testMagFutureOrbits :: (Globals, [Formatter]) -> Test testMagFutureOrbits (gs, fs) = TestCase $ assertNewName gs { gMetadata = meta } fs@@ -1562,4 +1615,18 @@ expected = ( "anthology" , "CreepySecrets_2010.epub"+ )+++testMagLunaStation :: (Globals, [Formatter]) -> Test+testMagLunaStation (gs, fs) = TestCase $+ assertNewName gs { gMetadata = meta } fs "Luna Station Quarterly magazine" expected+ where+ meta = emptyMetadata+ { metaTitles = [Title Nothing Nothing Nothing+ "Luna Station Quarterly - Issue 028"]+ }+ expected =+ ( "magLunaStationQuarterly"+ , "LunaStationQuarterly028.epub" )
testsuite/EpubTools/Test/EpubName/PubYear.hs view
@@ -1,4 +1,4 @@--- License: BSD3 (see LICENSE)+-- License: ISC (see LICENSE) -- Author: Dino Morelli <dino@ui3.info> module EpubTools.Test.EpubName.PubYear
testsuite/EpubTools/test-epubname.hs view
@@ -1,4 +1,4 @@--- License: BSD3 (see LICENSE)+-- License: ISC (see LICENSE) -- Author: Dino Morelli <dino@ui3.info> module Main
util/install.hs view
@@ -6,7 +6,6 @@ import Control.Exception import Control.Monad import Data.List-import Data.Version import Distribution.Package import Distribution.PackageDescription hiding ( error, options ) import Distribution.PackageDescription.Parse@@ -55,7 +54,7 @@ -- then pass a pile of what we know to a function to create the -- installation dirs dirs <- constructDirs opts . package . packageDescription- <$> readPackageDescription normal (head cabalFiles)+ <$> readGenericPackageDescription normal (head cabalFiles) -- Perform the installation