Skip to content
This repository has been archived by the owner on Aug 3, 2024. It is now read-only.

Commit

Permalink
Better support for multiple packages (#1277)
Browse files Browse the repository at this point in the history
* FromJSON class

Aeson style FromJSON class with Parsec based json parser.

* doc-index.json file for multiple packages

When creating haddock summary page for multiple packages render
doc-index.json file using contents of all found 'doc-index.json' files.

* Render doc-index.json

When rendering html, render doc-index.json file independently of
maybe_index_url option.  doc-index.json file is useful now even if
maybe_index_url is not `Nothing`.

* base url option

New `Flag_BaseURL` which configures from where static files are loaded
(--base-url).  If given and not equal "." static files are not coppied,
as this indicates that they are not read from the the directory where
we'd copy them.  The default value is ".".
  • Loading branch information
coot authored Apr 11, 2021
1 parent 2dd423f commit 119ad93
Show file tree
Hide file tree
Showing 14 changed files with 7,010 additions and 119 deletions.
7 changes: 7 additions & 0 deletions doc/invoking.rst
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,13 @@ The following options are available:
Reserved for future use (output documentation in DocBook XML
format).

.. option:: --base-url=<url>

Base url for static assets (eg. css, javascript, json files etc.).
When present, static assets are not copied. This option is useful
when creating documentation for multiple packages, it allows to have
a single copy of static assets served from the given url.

.. option:: --source-base=<url>
--source-module=<url>
--source-entity=<url>
Expand Down
6 changes: 6 additions & 0 deletions haddock-api/haddock-api.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ library
, ghc-paths ^>= 0.1.0.9
, haddock-library ^>= 1.10.0
, xhtml ^>= 3000.2.2
, parsec ^>= 3.1.13.0

-- Versions for the dependencies below are transitively pinned by
-- the non-reinstallable `ghc` package and hence need no version
Expand Down Expand Up @@ -93,6 +94,8 @@ library
Haddock.Parser
Haddock.Utils
Haddock.Utils.Json
Haddock.Utils.Json.Types
Haddock.Utils.Json.Parser
Haddock.Backends.Xhtml
Haddock.Backends.Xhtml.Decl
Haddock.Backends.Xhtml.DocMarkup
Expand Down Expand Up @@ -169,6 +172,8 @@ test-suite spec
Haddock.Types
Haddock.Utils
Haddock.Utils.Json
Haddock.Utils.Json.Types
Haddock.Utils.Json.Parser
Haddock.Version
Paths_haddock_api
Haddock.Backends.Hyperlinker.ParserSpec
Expand All @@ -180,6 +185,7 @@ test-suite spec
, haddock-library ^>= 1.10.0
, xhtml ^>= 3000.2.2
, hspec >= 2.4.4 && < 2.8
, parsec ^>= 3.1.13.0
, QuickCheck >= 2.11 && ^>= 2.14

-- Versions for the dependencies below are transitively pinned by
Expand Down
2 changes: 1 addition & 1 deletion haddock-api/resources/html/haddock-bundle.min.js

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion haddock-api/resources/html/js-src/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ function onDomReady(callback: () => void) {
onDomReady(() => {
document.body.classList.add('js-enabled');
styleMenu.init();
quickJump.init();
detailsHelper.init();
let head = document.getElementById('head');
let baseURL = ".";
if (head !== null) {
baseURL = head.getAttribute('data-base-url') || '.';
}
quickJump.init(baseURL);
});
Loading

0 comments on commit 119ad93

Please sign in to comment.