diagrams-haddock 0.2.1.2 → 0.2.1.3
raw patch · 7 files changed
+42/−59 lines, 7 filesdep ~diagrams-libdep ~diagrams-svgsetup-changed
Dependency ranges changed: diagrams-lib, diagrams-svg
Files
- CHANGES.md +7/−0
- README.md +23/−23
- Setup.hs +2/−27
- diagrams-haddock.cabal +5/−4
- diagrams/greenCircle.svg +0/−4
- diagrams/src_Diagrams_Haddock_greenCircle.svg +4/−0
- src/Diagrams/Haddock.hs +1/−1
CHANGES.md view
@@ -1,3 +1,10 @@+0.2.1.3 (24 November 2013)+--------------------------++ - update `README`: `extra-doc-files` field in `.cabal` is now supported+ by Hackage+ - allow diagrams-lib-1.0 and diagrams-svg-1.0+ 0.2.1.2 (14 November 2013) --------------------------
README.md view
@@ -224,42 +224,42 @@ ### Using external images -By default, `diagrams-haddock` generates external SVG image files. This-makes for a much less invasive changes to your source files, but-requires some extra work to manage the extra files. To use this method,+By default, `diagrams-haddock` generates external SVG image files.+This makes for much less invasive changes to your source files, but+requires some work to manage the extra files. To use this method, 1. Include inline diagrams code and URLs in your source code. 2. Run `diagrams-haddock`.-3. Commit the resulting URL changes to your source files *and* the produced SVG files.+3. Commit the resulting URL changes to your source files *and* the+ produced SVG files. 4. Arrange to have the SVG files installed along with your package's Haddock documentation (more on this below). -The generated SVG files need to be copied alongside the generated-Haddock documentation. There are two good ways to accomplish this:+The generated SVG files need to be copied in alongside the generated+Haddock documentation. There are two ways to accomplish this: -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+1. As of `Cabal-1.18`, the `.cabal` file format has acquired+ an `extra-doc-files` field, specifying files which should be+ copied in alongside generated Haddock documentation. So the+ preferred method is to add something like ```+ extra-source-files: README.md, CHANGES.md, diagrams/*.svg extra-doc-files: diagrams/*.svg ``` - 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.+ to your `.cabal` file. Note that you must list the generated+ images in *both* the `extra-source-files` field (so they will be+ included in your package tarball) and the `extra-doc-files` field+ (so they will be copied alongside generated Haddock+ documentation). Hackage is now built on `Cabal-1.18`, so+ uploading a package using the `extra-doc-files` field in this way+ works just fine. -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- Haddock documentation is generated. Add something like+2. If you need to make your documentation buildable with a pre-`1.18`+ version of `cabal-install`, it is possible to take advantage of+ `cabal`'s system of user hooks to manually copy the images right+ after the Haddock documentation is generated. Add something like ``` build-type: Custom
Setup.hs view
@@ -1,27 +1,2 @@-import Data.List (isSuffixOf)-import Distribution.Simple-import Distribution.Simple.Setup (Flag (..), HaddockFlags,- haddockDistPref)-import Distribution.Simple.Utils (copyFiles)-import Distribution.Text (display)-import Distribution.Verbosity (normal)-import System.Directory (getDirectoryContents)-import System.FilePath ((</>))---- Ugly hack, logic copied from Distribution.Simple.Haddock-haddockOutputDir :: Package pkg => HaddockFlags -> pkg -> FilePath-haddockOutputDir flags pkg = destDir- where- baseDir = case haddockDistPref flags of- NoFlag -> "."- Flag x -> x- destDir = baseDir </> "doc" </> "html" </> display (packageName pkg)--main :: IO ()-main = defaultMainWithHooks simpleUserHooks- { postHaddock = \args flags pkg lbi -> do- dias <- filter ("svg" `isSuffixOf`) `fmap` getDirectoryContents "diagrams"- copyFiles normal (haddockOutputDir flags pkg)- (map (\d -> ("", "diagrams" </> d)) dias)- postHaddock simpleUserHooks args flags pkg lbi- }+import Distribution.Simple+main = defaultMain
diagrams-haddock.cabal view
@@ -1,5 +1,5 @@ name: diagrams-haddock-version: 0.2.1.2+version: 0.2.1.3 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@@ -22,9 +22,10 @@ maintainer: diagrams-discuss@googlegroups.com bug-reports: https://github.com/diagrams/diagrams-haddock/issues category: Graphics-build-type: Custom+build-type: Simple cabal-version: >=1.10 extra-source-files: README.md, CHANGES.md, diagrams/*.svg+extra-doc-files: diagrams/*.svg Source-repository head type: git@@ -44,8 +45,8 @@ haskell-src-exts >= 1.14 && < 1.15, blaze-svg >= 0.3 && < 0.4, diagrams-builder >= 0.3 && < 0.5,- diagrams-lib >= 0.6 && < 0.8,- diagrams-svg >= 0.8.0.1 && < 0.9,+ diagrams-lib >= 0.6 && < 1.1,+ diagrams-svg >= 0.8.0.1 && < 1.1, vector-space >= 0.8 && < 0.9, lens >= 3.8 && < 3.11, cpphs >= 1.15,
− diagrams/greenCircle.svg
@@ -1,4 +0,0 @@-<?xml version="1.0" encoding="UTF-8"?>-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"- "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">-<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="200.0" height="199.99999999999997" font-size="1" viewBox="0 0 200 200"><g><g transform="matrix(90.9090909090909,0.0,0.0,90.9090909090909,99.99999999999999,100.0)"><g stroke="rgb(0,0,0)" stroke-opacity="1.0" fill="rgb(0,128,0)" fill-opacity="1.0" stroke-width="1.0e-2" font-size="1.0em"><path d="M 1.0,0.0 c 0.0,-0.5522847498307935 -0.44771525016920644,-1.0 -0.9999999999999998 -1.0c -0.5522847498307935,-3.3817687554908895e-17 -1.0,0.4477152501692064 -1.0 0.9999999999999997c -6.763537510981779e-17,0.5522847498307935 0.4477152501692063,1.0 0.9999999999999996 1.0c 0.5522847498307935,1.0145306266472669e-16 1.0,-0.44771525016920627 1.0 -0.9999999999999994Z" /></g></g></g></svg>
+ diagrams/src_Diagrams_Haddock_greenCircle.svg view
@@ -0,0 +1,4 @@+<?xml version="1.0" encoding="UTF-8"?>+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"+ "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="200.0" height="199.99999999999997" font-size="1" viewBox="0 0 200 200"><g><g stroke="rgb(0,0,0)" stroke-opacity="1.0" fill="rgb(0,0,0)" fill-opacity="0.0" stroke-width="1.0e-2" stroke-linecap="butt" stroke-linejoin="miter" font-size="1.0em" stroke-miterlimit="10.0"><g transform="matrix(90.9090909090909,0.0,0.0,90.9090909090909,99.99999999999999,100.0)"><g fill="rgb(0,128,0)" fill-opacity="1.0"><path d="M 1.0,0.0 c 0.0,-0.5522847498307935 -0.44771525016920644,-1.0 -0.9999999999999998 -1.0c -0.5522847498307935,-3.3817687554908895e-17 -1.0,0.4477152501692064 -1.0 0.9999999999999997c -6.763537510981779e-17,0.5522847498307935 0.4477152501692063,1.0 0.9999999999999996 1.0c 0.5522847498307935,1.0145306266472669e-16 1.0,-0.44771525016920627 1.0000000000000002 -0.9999999999999997Z" /></g></g></g></g></svg>
src/Diagrams/Haddock.hs view
@@ -11,7 +11,7 @@ -- Include inline diagrams code in Haddock documentation! For -- example, here is a green circle: ----- <<diagrams/greenCircle.svg#diagram=greenCircle&width=200>>+-- <<diagrams/src_Diagrams_Haddock_greenCircle.svg#diagram=greenCircle&width=200>> -- -- which was literally produced by this code: --