This repository was archived by the owner on Aug 3, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +30
-2
lines changed Expand file tree Collapse file tree 5 files changed +30
-2
lines changed Original file line number Diff line number Diff line change 2
2
3
3
* to be released
4
4
5
+ * Haddock now writes additional information about the documentation to ` meta.json `
6
+
5
7
* Fix renaming of type variables after specializing instance method signatures (#613 )
6
8
7
9
* Move markup related data types to haddock-library
Original file line number Diff line number Diff line change @@ -89,6 +89,7 @@ library
89
89
Haddock.Backends.Xhtml.Types
90
90
Haddock.Backends.Xhtml.Utils
91
91
Haddock.Backends.LaTeX
92
+ Haddock.Backends.Meta
92
93
Haddock.Backends.HaddockDB
93
94
Haddock.Backends.Hoogle
94
95
Haddock.Backends.Hyperlinker
Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ import Data.Version
29
29
import Haddock.Backends.Xhtml
30
30
import Haddock.Backends.Xhtml.Themes (getThemes )
31
31
import Haddock.Backends.LaTeX
32
+ import Haddock.Backends.Meta
32
33
import Haddock.Backends.Hoogle
33
34
import Haddock.Backends.Hyperlinker
34
35
import Haddock.Interface
@@ -319,6 +320,7 @@ render dflags flags qual ifaces installedIfaces extSrcMap = do
319
320
opt_contents_url opt_index_url unicode qual
320
321
pretty
321
322
copyHtmlBits odir libDir themes
323
+ writeHaddockMeta odir
322
324
323
325
-- TODO: we throw away Meta for both Hoogle and LaTeX right now,
324
326
-- might want to fix that if/when these two get some work on them
@@ -445,9 +447,9 @@ getHaddockLibDir flags =
445
447
exists <- doesDirectoryExist p
446
448
pure $ if exists then Just p else Nothing
447
449
448
- dirs <- mapM check res_dirs
450
+ dirs <- mapM check res_dirs
449
451
case [p | Just p <- dirs] of
450
- (p : _) -> return p
452
+ (p : _) -> return p
451
453
_ -> die " Haddock's resource directory does not exist!\n "
452
454
#endif
453
455
fs -> return (last fs)
Original file line number Diff line number Diff line change
1
+ module Haddock.Backends.Meta where
2
+
3
+ import Haddock.Utils.Json
4
+ import Haddock.Version
5
+
6
+ import Data.ByteString.Builder (hPutBuilder )
7
+ import System.FilePath ((</>) )
8
+ import System.IO (withFile , IOMode (WriteMode ))
9
+
10
+ -- | Writes a json encoded file containing additional
11
+ -- information about the generated documentation. This
12
+ -- is useful for external tools (e.g. hackage).
13
+ writeHaddockMeta :: FilePath -> IO ()
14
+ writeHaddockMeta odir = do
15
+ let
16
+ meta_json :: Value
17
+ meta_json = object [
18
+ " haddock_version" .= String projectVersion
19
+ ]
20
+
21
+ withFile (odir </> " meta.json" ) WriteMode $ \ h ->
22
+ hPutBuilder h (encodeToBuilder meta_json)
Original file line number Diff line number Diff line change @@ -125,6 +125,7 @@ executable haddock
125
125
Haddock.Backends.Xhtml.Types
126
126
Haddock.Backends.Xhtml.Utils
127
127
Haddock.Backends.LaTeX
128
+ Haddock.Backends.Meta
128
129
Haddock.Backends.HaddockDB
129
130
Haddock.Backends.Hoogle
130
131
Haddock.Backends.Hyperlinker
You can’t perform that action at this time.
0 commit comments