@@ -88,13 +88,15 @@ ppHtml dflags doctitle maybe_package ifaces reexported_ifaces odir prologue
8888 when (isNothing maybe_contents_url) $
8989 ppHtmlContents dflags odir doctitle maybe_package
9090 themes maybe_mathjax_url maybe_index_url maybe_source_url maybe_wiki_url
91+ withQuickjump
9192 (map toInstalledIface visible_ifaces ++ reexported_ifaces)
9293 False -- we don't want to display the packages in a single-package contents
9394 prologue debug pkg (makeContentsQual qual)
9495
9596 when (isNothing maybe_index_url) $ do
9697 ppHtmlIndex odir doctitle maybe_package
9798 themes maybe_mathjax_url maybe_contents_url maybe_source_url maybe_wiki_url
99+ withQuickjump
98100 (map toInstalledIface visible_ifaces ++ reexported_ifaces) debug
99101
100102 when withQuickjump $
@@ -103,7 +105,8 @@ ppHtml dflags doctitle maybe_package ifaces reexported_ifaces odir prologue
103105
104106 mapM_ (ppHtmlModule odir doctitle themes
105107 maybe_mathjax_url maybe_source_url maybe_wiki_url
106- maybe_contents_url maybe_index_url unicode pkg qual debug) visible_ifaces
108+ maybe_contents_url maybe_index_url withQuickjump
109+ unicode pkg qual debug) visible_ifaces
107110
108111
109112copyHtmlBits :: FilePath -> FilePath -> Themes -> Bool -> IO ()
@@ -142,6 +145,15 @@ headHtml docTitle themes mathjax_url =
142145 , " }"
143146 , " });" ]
144147
148+ quickJumpButtonLi :: Bool -- ^ With Quick Jump?
149+ -> Maybe Html
150+ -- The TypeScript should replace this <li> element, given its id. However, in
151+ -- case it does not, the element is given content here too.
152+ quickJumpButtonLi True = Just $ li ! [identifier " quick-jump-button" ]
153+ << anchor ! [href " #" ] << " Quick Jump"
154+
155+ quickJumpButtonLi False = Nothing
156+
145157srcButton :: SourceURLs -> Maybe Interface -> Maybe Html
146158srcButton (Just src_base_url, _, _, _) Nothing =
147159 Just (anchor ! [href src_base_url] << " Source" )
@@ -180,20 +192,18 @@ indexButton maybe_index_url
180192bodyHtml :: String -> Maybe Interface
181193 -> SourceURLs -> WikiURLs
182194 -> Maybe String -> Maybe String
195+ -> Bool -- ^ With Quick Jump?
183196 -> Html -> Html
184197bodyHtml doctitle iface
185198 maybe_source_url maybe_wiki_url
186199 maybe_contents_url maybe_index_url
200+ withQuickjump
187201 pageContent =
188202 body << [
189203 divPackageHeader << [
190204 nonEmptySectionName << doctitle,
191- unordList (catMaybes [
192- srcButton maybe_source_url iface,
193- wikiButton maybe_wiki_url (ifaceMod <$> iface),
194- contentsButton maybe_contents_url,
195- indexButton maybe_index_url])
196- ! [theclass " links" , identifier " page-menu" ]
205+ ulist ! [theclass " links" , identifier " page-menu" ]
206+ << catMaybes (quickJumpButtonLi withQuickjump : otherButtonLis)
197207 ],
198208 divContent << pageContent,
199209 divFooter << paragraph << (
@@ -202,6 +212,13 @@ bodyHtml doctitle iface
202212 (" version " ++ projectVersion)
203213 )
204214 ]
215+ where
216+ otherButtonLis = (fmap . fmap ) (li << )
217+ [ srcButton maybe_source_url iface
218+ , wikiButton maybe_wiki_url (ifaceMod <$> iface)
219+ , contentsButton maybe_contents_url
220+ , indexButton maybe_index_url
221+ ]
205222
206223moduleInfo :: Interface -> Html
207224moduleInfo iface =
@@ -267,14 +284,16 @@ ppHtmlContents
267284 -> Maybe String
268285 -> SourceURLs
269286 -> WikiURLs
287+ -> Bool -- ^ With Quick Jump?
270288 -> [InstalledInterface ] -> Bool -> Maybe (MDoc GHC. RdrName )
271289 -> Bool
272290 -> Maybe Package -- ^ Current package
273291 -> Qualification -- ^ How to qualify names
274292 -> IO ()
275293ppHtmlContents dflags odir doctitle _maybe_package
276294 themes mathjax_url maybe_index_url
277- maybe_source_url maybe_wiki_url ifaces showPkgs prologue debug pkg qual = do
295+ maybe_source_url maybe_wiki_url withQuickjump
296+ ifaces showPkgs prologue debug pkg qual = do
278297 let tree = mkModuleTree dflags showPkgs
279298 [(instMod iface, toInstalledDescription iface)
280299 | iface <- ifaces
@@ -287,7 +306,7 @@ ppHtmlContents dflags odir doctitle _maybe_package
287306 headHtml doctitle themes mathjax_url +++
288307 bodyHtml doctitle Nothing
289308 maybe_source_url maybe_wiki_url
290- Nothing maybe_index_url << [
309+ Nothing maybe_index_url withQuickjump << [
291310 ppPrologue pkg qual doctitle prologue,
292311 ppSignatureTree pkg qual sig_tree,
293312 ppModuleTree pkg qual tree
@@ -420,11 +439,12 @@ ppHtmlIndex :: FilePath
420439 -> Maybe String
421440 -> SourceURLs
422441 -> WikiURLs
442+ -> Bool -- ^ With Quick Jump?
423443 -> [InstalledInterface ]
424444 -> Bool
425445 -> IO ()
426446ppHtmlIndex odir doctitle _maybe_package themes
427- maybe_mathjax_url maybe_contents_url maybe_source_url maybe_wiki_url ifaces debug = do
447+ maybe_mathjax_url maybe_contents_url maybe_source_url maybe_wiki_url withQuickjump ifaces debug = do
428448 let html = indexPage split_indices Nothing
429449 (if split_indices then [] else index)
430450
@@ -443,7 +463,7 @@ ppHtmlIndex odir doctitle _maybe_package themes
443463 headHtml (doctitle ++ " (" ++ indexName ch ++ " )" ) themes maybe_mathjax_url +++
444464 bodyHtml doctitle Nothing
445465 maybe_source_url maybe_wiki_url
446- maybe_contents_url Nothing << [
466+ maybe_contents_url Nothing withQuickjump << [
447467 if showLetters then indexInitialLetterLinks else noHtml,
448468 if null items then noHtml else
449469 divIndex << [sectionName << indexName ch, buildIndex items]
@@ -541,11 +561,14 @@ ppHtmlIndex odir doctitle _maybe_package themes
541561ppHtmlModule
542562 :: FilePath -> String -> Themes
543563 -> Maybe String -> SourceURLs -> WikiURLs
544- -> Maybe String -> Maybe String -> Bool -> Maybe Package -> QualOption
564+ -> Maybe String -> Maybe String
565+ -> Bool -- ^ With Quick Jump?
566+ -> Bool -> Maybe Package -> QualOption
545567 -> Bool -> Interface -> IO ()
546568ppHtmlModule odir doctitle themes
547569 maybe_mathjax_url maybe_source_url maybe_wiki_url
548- maybe_contents_url maybe_index_url unicode pkg qual debug iface = do
570+ maybe_contents_url maybe_index_url withQuickjump
571+ unicode pkg qual debug iface = do
549572 let
550573 mdl = ifaceMod iface
551574 aliases = ifaceModuleAliases iface
@@ -565,7 +588,7 @@ ppHtmlModule odir doctitle themes
565588 headHtml mdl_str_annot themes maybe_mathjax_url +++
566589 bodyHtml doctitle (Just iface)
567590 maybe_source_url maybe_wiki_url
568- maybe_contents_url maybe_index_url << [
591+ maybe_contents_url maybe_index_url withQuickjump << [
569592 divModuleHeader << (moduleInfo iface +++ (sectionName << mdl_str_linked)),
570593 ifaceToHtml maybe_source_url maybe_wiki_url iface unicode pkg real_qual
571594 ]
0 commit comments