diagrams-haddock 0.2.1.1 → 0.2.1.2
raw patch · 6 files changed
+43/−28 lines, 6 filesdep ~basedep ~lensPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base, lens
API changes (from Hackage documentation)
Files
- CHANGES.md +11/−0
- README.md +11/−10
- diagrams-haddock.cabal +3/−3
- src/Diagrams/Haddock.hs +2/−3
- test/Tests.hs +8/−4
- tools/diagrams-haddock.hs +8/−8
CHANGES.md view
@@ -1,3 +1,14 @@+0.2.1.2 (14 November 2013)+--------------------------++ - allow base-4.7+ - allow lens-3.10++0.2.1.1 (14 October 2013)+-------------------------++ - bug fix: correctly handle hsenv environments with no name+ 0.2.1 (11 September 2013) -------------------------
README.md view
@@ -237,8 +237,9 @@ The generated SVG files need to be copied alongside the generated Haddock documentation. There are two good ways to accomplish this: -1. The `cabal` tool has recently acquired an `extra-doc-files` field- (see https://github.com/haskell/cabal/pull/1182 and+1. As of version 1.18, The `cabal` tool has acquired an+ `extra-doc-files` field (see+ https://github.com/haskell/cabal/pull/1182 and https://github.com/haskell/cabal/pull/1427), specifying files which should be copied in alongside generated Haddock documentation. So you could simply write something like@@ -247,14 +248,14 @@ extra-doc-files: diagrams/*.svg ``` - in your `.cabal` file. Unfortunately, it will still be a while- until this feature makes its way into a new release of `cabal`,- and yet longer before you can be sure that most people who may- want to build your package's documentation have the new version.- So this is currently a good option only if you have the HEAD- version of `cabal` and don't care about others being able to- build your documentation. However, in the not-too-distant future- this will become the best option.+ in your `.cabal` file. However, as of this writing (October+ 2013), Hackage is not building packages with `cabal-1.18` (see+ https://github.com/haskell/hackage-server/issues/140). So this is+ currently a good option only if you have the latest release of+ `cabal` and don't care about others (including Hackage) being able+ to build your documentation. However, in the+ hopefully-not-too-distant future (once Hackage switches to+ `cabal-1.18`) this will become the best option. 2. In the meantime, it is possible to take advantage of `cabal`'s system of user hooks to manually copy the images right after the
diagrams-haddock.cabal view
@@ -1,5 +1,5 @@ name: diagrams-haddock-version: 0.2.1.1+version: 0.2.1.2 synopsis: Preprocessor for embedding diagrams in Haddock documentation description: diagrams-haddock is a tool for compiling embedded inline diagrams code in Haddock documentation, for an@@ -32,7 +32,7 @@ library exposed-modules: Diagrams.Haddock- build-depends: base >= 4.4 && < 4.7,+ build-depends: base >= 4.4 && < 4.8, filepath, directory, mtl >= 2.0 && < 2.2,@@ -47,7 +47,7 @@ diagrams-lib >= 0.6 && < 0.8, diagrams-svg >= 0.8.0.1 && < 0.9, vector-space >= 0.8 && < 0.9,- lens >= 3.8 && < 3.10,+ lens >= 3.8 && < 3.11, cpphs >= 1.15, cautious-file >= 1.0 && < 1.1, uniplate >= 1.6 && < 1.7,
src/Diagrams/Haddock.hs view
@@ -95,8 +95,7 @@ import Language.Haskell.Exts.Annotated hiding (loc) import qualified Language.Haskell.Exts.Annotated as HSE import Language.Preprocessor.Cpphs-import System.Console.ANSI (cursorDownLine,- setCursorColumn)+import System.Console.ANSI (setCursorColumn) import System.Directory (copyFile, createDirectoryIfMissing, doesFileExist)@@ -383,7 +382,7 @@ -- blocks ultimately needed by the block which defines the desired -- identifier. transitiveClosure :: String -> [CodeBlock] -> [CodeBlock]-transitiveClosure ident blocks = tc [ident] blocks+transitiveClosure ident = tc [ident] where tc _ [] = [] tc [] _ = []
test/Tests.hs view
@@ -1,3 +1,5 @@+{-# OPTIONS_GHC -fno-warn-orphans #-}+ module Main where import Control.Applicative@@ -7,7 +9,7 @@ import qualified Data.Map as M import qualified Data.Set as S import Language.Haskell.Exts.Annotated-import Test.Framework (defaultMain)+import Test.Framework (Test, defaultMain) import Test.Framework.Providers.QuickCheck2 (testProperty) import Test.QuickCheck import qualified Text.Parsec as P@@ -34,13 +36,13 @@ instance Arbitrary SrcSpan where arbitrary = do- NonEmpty fileName <- arbitrary- Positive startLine <- arbitrary+ NonEmpty fName <- arbitrary+ Positive startLn <- arbitrary NonNegative startCol <- arbitrary NonNegative numLines <- arbitrary NonNegative numCols <- arbitrary - return $ SrcSpan fileName startLine startCol (startLine + numLines) (startCol + numCols)+ return $ SrcSpan fName startLn startCol (startLn + numLines) (startCol + numCols) instance Arbitrary Comment where arbitrary = Comment <$> arbitrary <*> arbitrary <*> arbitrary@@ -99,6 +101,7 @@ where included = transitiveClosure s blocks includedIdents = S.insert s $ S.unions (map (view codeBlockIdents) included) +tests :: [Test] tests = [ testProperty "DiagramURL display/parse" prop_parseDisplay , testProperty "CommentWithURLs display/parse" prop_parseDisplayMany@@ -109,4 +112,5 @@ , testProperty "transitiveClosure included bindings" prop_tc_included ] +main :: IO () main = defaultMain tests
tools/diagrams-haddock.hs view
@@ -135,12 +135,12 @@ Just lib -> do let buildInfo = P.libBuildInfo lib srcDirs = P.hsSourceDirs buildInfo- includes = P.includeDirs buildInfo- defines = P.cppOptions buildInfo+ incls = P.includeDirs buildInfo+ defns = P.cppOptions buildInfo opts' = opts- { includeDirs = includeDirs opts ++ includes+ { includeDirs = includeDirs opts ++ incls }- cabalDefines = parseCabalDefines defines+ cabalDefines = parseCabalDefines defns mapM_ (tryProcessFile opts' cabalDefines dir srcDirs) . map toFilePath . P.exposedModules $ lib getHsenv :: IO (Maybe String)@@ -162,18 +162,18 @@ -> [FilePath] -- ^ haskell-src-dirs -> FilePath -- ^ name of the module to look for, in \"A/B/C\" form -> IO ()-tryProcessFile opts defines dir srcDirs fileBase = do+tryProcessFile opts defns dir srcDirs fileBase = do let files = [ dir </> srcDir </> fileBase <.> ext | srcDir <- srcDirs , ext <- ["hs", "lhs"] ] forM_ files $ \f -> do e <- doesFileExist f- when e $ processFile opts defines f+ when e $ processFile opts defns f -- | Process a single file with diagrams-haddock. processFile :: DiagramsHaddock -> [(String,String)] -> FilePath -> IO ()-processFile opts defines file = do+processFile opts defns file = do errs <- processHaddockDiagrams' cpphsOpts (quiet opts) (dataURIs opts) (cacheDir opts) (outputDir opts) file case errs of [] -> return ()@@ -181,6 +181,6 @@ where cpphsOpts = defaultCpphsOptions { includes = includeDirs opts- , defines = map (,"") (cppDefines opts) ++ defines+ , defines = map (,"") (cppDefines opts) ++ defns , boolopts = defaultBoolOptions { hashline = False } }