From aca68f620beb07f9bdebdf52948c6ea670be4980 Mon Sep 17 00:00:00 2001 From: Alexander Biehl Date: Mon, 30 Oct 2017 08:45:51 +0100 Subject: Add QuickJump version to meta.json (#696) --- haddock-api/haddock-api.cabal | 2 +- haddock-api/src/Haddock.hs | 2 +- haddock-api/src/Haddock/Backends/Meta.hs | 22 -------------------- haddock-api/src/Haddock/Backends/Xhtml/Meta.hs | 28 ++++++++++++++++++++++++++ haddock.cabal | 2 +- 5 files changed, 31 insertions(+), 25 deletions(-) delete mode 100644 haddock-api/src/Haddock/Backends/Meta.hs create mode 100644 haddock-api/src/Haddock/Backends/Xhtml/Meta.hs diff --git a/haddock-api/haddock-api.cabal b/haddock-api/haddock-api.cabal index 5ce35b94..9b580a56 100644 --- a/haddock-api/haddock-api.cabal +++ b/haddock-api/haddock-api.cabal @@ -86,12 +86,12 @@ library Haddock.Backends.Xhtml.Decl Haddock.Backends.Xhtml.DocMarkup Haddock.Backends.Xhtml.Layout + Haddock.Backends.Xhtml.Meta Haddock.Backends.Xhtml.Names Haddock.Backends.Xhtml.Themes Haddock.Backends.Xhtml.Types Haddock.Backends.Xhtml.Utils Haddock.Backends.LaTeX - Haddock.Backends.Meta Haddock.Backends.HaddockDB Haddock.Backends.Hoogle Haddock.Backends.Hyperlinker diff --git a/haddock-api/src/Haddock.hs b/haddock-api/src/Haddock.hs index 17951068..a46e58b3 100644 --- a/haddock-api/src/Haddock.hs +++ b/haddock-api/src/Haddock.hs @@ -27,9 +27,9 @@ module Haddock ( import Data.Version import Haddock.Backends.Xhtml +import Haddock.Backends.Xhtml.Meta import Haddock.Backends.Xhtml.Themes (getThemes) import Haddock.Backends.LaTeX -import Haddock.Backends.Meta import Haddock.Backends.Hoogle import Haddock.Backends.Hyperlinker import Haddock.Interface diff --git a/haddock-api/src/Haddock/Backends/Meta.hs b/haddock-api/src/Haddock/Backends/Meta.hs deleted file mode 100644 index c62c1ae8..00000000 --- a/haddock-api/src/Haddock/Backends/Meta.hs +++ /dev/null @@ -1,22 +0,0 @@ -module Haddock.Backends.Meta where - -import Haddock.Utils.Json -import Haddock.Version - -import Data.ByteString.Builder (hPutBuilder) -import System.FilePath (()) -import System.IO (withFile, IOMode (WriteMode)) - --- | Writes a json encoded file containing additional --- information about the generated documentation. This --- is useful for external tools (e.g. hackage). -writeHaddockMeta :: FilePath -> IO () -writeHaddockMeta odir = do - let - meta_json :: Value - meta_json = object [ - "haddock_version" .= String projectVersion - ] - - withFile (odir "meta.json") WriteMode $ \h -> - hPutBuilder h (encodeToBuilder meta_json) \ No newline at end of file diff --git a/haddock-api/src/Haddock/Backends/Xhtml/Meta.hs b/haddock-api/src/Haddock/Backends/Xhtml/Meta.hs new file mode 100644 index 00000000..5cf03ec4 --- /dev/null +++ b/haddock-api/src/Haddock/Backends/Xhtml/Meta.hs @@ -0,0 +1,28 @@ +module Haddock.Backends.Xhtml.Meta where + +import Haddock.Utils.Json +import Haddock.Version + +import Data.ByteString.Builder (hPutBuilder) +import System.FilePath (()) +import System.IO (withFile, IOMode (WriteMode)) + +-- | Everytime breaking changes to the Quckjump api +-- happen this needs to be modified. +quickjumpVersion :: Int +quickjumpVersion = 1 + +-- | Writes a json encoded file containing additional +-- information about the generated documentation. This +-- is useful for external tools (e.g. hackage). +writeHaddockMeta :: FilePath -> IO () +writeHaddockMeta odir = do + let + meta_json :: Value + meta_json = object [ + "haddock_version" .= String projectVersion + , "quickjump_version" .= quickjumpVersion + ] + + withFile (odir "meta.json") WriteMode $ \h -> + hPutBuilder h (encodeToBuilder meta_json) \ No newline at end of file diff --git a/haddock.cabal b/haddock.cabal index 51f71272..40ccb55e 100644 --- a/haddock.cabal +++ b/haddock.cabal @@ -120,12 +120,12 @@ executable haddock Haddock.Backends.Xhtml.Decl Haddock.Backends.Xhtml.DocMarkup Haddock.Backends.Xhtml.Layout + Haddock.Backends.Xhtml.Meta Haddock.Backends.Xhtml.Names Haddock.Backends.Xhtml.Themes Haddock.Backends.Xhtml.Types Haddock.Backends.Xhtml.Utils Haddock.Backends.LaTeX - Haddock.Backends.Meta Haddock.Backends.HaddockDB Haddock.Backends.Hoogle Haddock.Backends.Hyperlinker -- cgit v1.2.3