Permalink
Browse files

Getting ready for hackage release

  • Loading branch information...
1 parent 599b51d commit e93a1d29ef9a4ab5285d7ba48b484b85a3d6c6f3 Andy Gimblett committed Jul 15, 2011
Showing with 61 additions and 38 deletions.
  1. +17 −13 README.md
  2. +39 −19 docidx.cabal
  3. BIN example.png
  4. +3 −4 src/Distribution/DocIdx/Config.hs
  5. +2 −2 src/Distribution/DocIdx/Html.hs
View
@@ -4,11 +4,11 @@ docidx.hs - create an HTML index of your installed Haskell packages.
## Overview
-`docidx` is a simple tool which creates an HTML index of your
-installed Haskell packages, with links to each package's Haddock docs
-locally and on Hackage. While `cabal install` now creates and
-maintains an index "by module", sometimes it's nice to have this other
-view (and the quick links to Hackage).
+`docidx` is a small tool which creates an HTML index of your installed
+Haskell packages, with links to each package's Haddock docs locally
+and on Hackage. While `cabal install` now creates and maintains an
+index "by module", sometimes it's nice to have this other view (and
+the quick links to Hackage).
`docidx` works by querying your global and user package databases (via
`ghc-pkg`, via the `Cabal` package) for information on all installed
@@ -25,32 +25,35 @@ to local `ghc` documentation, to the Haskell report, etc. - whatever
you want).
The distribution includes
-[an example of the output](http://github.com/gimbo/docidx.hs/blob/master/examples/example.html).
+[an example of the output HTML](http://github.com/gimbo/docidx.hs/blob/master/examples/example.html) and [a partial screenshot](http://github.com/gimbo/docidx.hs/blob/master/examples/example.png) of how that page looks..
## Installation
-The tool hasn't been released to hackage yet, so just download the
-source from the
+Either just use `cabal install` to pull the latest version from
+[hackage](http://hackage.haskell.org/package/docidx) and install it,
+or download the source from the
[project home page](http://github.com/gimbo/docidx.hs) and
build/install it using the usual `cabal` mechanism.
## Usage
...is very simple:
-
+
docidx
-
+
on its own will write its output (a single HTML page) to `stdout`,
whereas:
docidx filename
-
+
will attempt to write its output to the specified file.
Warnings and errors (e.g. if `Cabal` reports that a package has
Haddock docs, but they can't be found/read) go to `stderr`.
-I run it every hour from `cron`, personally.
+I run it every hour from `cron`, personally, piping its results to
+`~/.cabal/share/doc/docidx.html` - which I then use as the entry point
+for all my Haskell documentation needs.
## Configuration
@@ -74,7 +77,8 @@ the program's code:
* Page title.
- * CSS (currently just references hackage's).
+ * CSS (currently just references hackage's and local version of
+ haddock's).
* Favicon (currently uses the hackage package list bullet point).
View
@@ -1,26 +1,46 @@
-Name: docidx
-Version: 0.1.0
-Stability: Alpha
-Synopsis: A HTML index generator for installed package documentation.
-Description:
- A HTML index generator for installed package documentation.
+name: docidx
+version: 0.1.0
+license: BSD3
+license-file: LICENSE
+category: Documentation
+copyright: Andy Gimblett <haskell@gimbo.org.uk>, Andy Price <andy@andrewprice.me.uk>
+author: Andy Gimblett <haskell@gimbo.org.uk>, Andy Price <andy@andrewprice.me.uk>
+maintainer: Andy Gimblett <haskell@gimbo.org.uk>
+stability: Beta
+synopsis: Generate an HTML index of installed Haskell packages and their documentation.
+cabal-Version: >=1.6
+homepage: http://github.com/gimbo/docidx.hs
+bug-reports: http://github.com/gimbo/docidx.hs/issues
+build-type: Simple
+description:
- Based on: http://gimbo.org.uk/blog/2009/09/23/generating-an-index-of-haskell-haddock-docs-automatically/
+ docidx is a small tool which creates an HTML index of your
+ installed Haskell packages, with links to each package's Haddock
+ docs locally and on Hackage. While "cabal install" now creates
+ and maintains an index by module, sometimes it's nice to have this
+ other view (and the quick links to Hackage).
-Category: Utils
-License: BSD3
-License-file: LICENSE
-Copyright: Andy Price <andy@andrewprice.me.uk>, Andy Gimblett <haskell@gimbo.org.uk>
-Author: Andy Price <andy@andrewprice.me.uk>, Andy Gimblett <haskell@gimbo.org.uk>
-Maintainer: Andy Price <andy@andrewprice.me.uk>, Andy Gimblett <haskell@gimbo.org.uk>
-Build-Type: Simple
-Cabal-Version: >=1.6
+ docidx queries your global and user package databases (via
+ ghc-pkg, via the Cabal package), to build an index of all
+ installed packages - including version numbers where more than one
+ version is present, package synopses, links to the local Haddock
+ docs, and a link to the package on Hackage.
-Executable docidx
+ Packages are grouped by first letter, and there's an A-Z index at
+ the top of the page, which can be easily extended via a config
+ file to include extra links you think are handy - e.g. to the
+ per-module index, to local ghc documentation, to the Haskell
+ report, etc. - whatever you want).
+
+executable docidx
hs-source-dirs: src
- Main-is: docidx.hs
- Build-Depends: base >= 4, Cabal >= 1.8, containers >= 0.3,
+ main-is: docidx.hs
+ build-depends: base >= 4, Cabal >= 1.8, containers >= 0.3,
directory >= 1.0, filepath >= 1.1, html >= 1.0,
- MissingH >= 1.1, monads-tf, old-locale, tagsoup >= 0.11,
+ MissingH >= 1.1, mtl >= 2, old-locale, tagsoup >= 0.11,
time >= 1.1
ghc-options: -fwarn-tabs -Wall
+
+source-repository head
+ type: git
+ location: http://github.com/gimbo/docidx.hs
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -1,11 +1,9 @@
-{-# LANGUAGE PackageImports #-}
-
-- Configuration for docidx.
module Distribution.DocIdx.Config where
import Control.Monad
-import "monads-tf" Control.Monad.Writer
+import Control.Monad.Writer
import Data.Maybe
import System.Directory
import System.FilePath
@@ -30,7 +28,8 @@ data DocIdxCfg = DocIdxCfg {
defaultConfig :: DocIdxCfg
defaultConfig = DocIdxCfg {
pageTitle = "Local Haskell package docs"
- , pageCss = ["http://hackage.haskell.org/packages/hackage.css"]
+ , pageCss = ["http://hackage.haskell.org/packages/hackage.css"
+ ,"file:///Library/Frameworks/GHC.framework/Versions/Current/usr/share/doc/ghc/html/libraries/haddock.css"]
, favIcon = "http://hackage.haskell.org/images/Cabal-tiny.png"
, tocExtras = []
}
@@ -21,7 +21,7 @@ import Distribution.GhcPkgList
-- | Project homepage, for footer.
homePage :: String
-homePage = "http://github.com/gimbo/docidx.hs"
+homePage = "http://hackage.haskell.org/package/docidx"
-- | Create and render entire page.
htmlPage :: DocIdxCfg -> PackageMap HaddockInfo -> UTCTime -> String
@@ -145,7 +145,7 @@ pvSyn = maybe noHtml (\x -> mdash +++ stringToHtml x) . msum . map pvSynopsis
maybeURL :: String -> Maybe String -> Html
maybeURL nm Nothing = stringToHtml nm
maybeURL nm (Just path) = anchor ![href $ joinPath [path, "index.html"]] << nm
-
+
-- | Compute the URL to a package's page on hackage.
hackagePath :: PkgVersion -> String
hackagePath pv = "http://hackage.haskell.org/package/" ++ pvTag

0 comments on commit e93a1d2

Please sign in to comment.