@@ -88,13 +88,15 @@ ppHtml dflags doctitle maybe_package ifaces reexported_ifaces odir prologue
88
88
when (isNothing maybe_contents_url) $
89
89
ppHtmlContents dflags odir doctitle maybe_package
90
90
themes maybe_mathjax_url maybe_index_url maybe_source_url maybe_wiki_url
91
+ withQuickjump
91
92
(map toInstalledIface visible_ifaces ++ reexported_ifaces)
92
93
False -- we don't want to display the packages in a single-package contents
93
94
prologue debug pkg (makeContentsQual qual)
94
95
95
96
when (isNothing maybe_index_url) $ do
96
97
ppHtmlIndex odir doctitle maybe_package
97
98
themes maybe_mathjax_url maybe_contents_url maybe_source_url maybe_wiki_url
99
+ withQuickjump
98
100
(map toInstalledIface visible_ifaces ++ reexported_ifaces) debug
99
101
100
102
when withQuickjump $
@@ -103,7 +105,8 @@ ppHtml dflags doctitle maybe_package ifaces reexported_ifaces odir prologue
103
105
104
106
mapM_ (ppHtmlModule odir doctitle themes
105
107
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
107
110
108
111
109
112
copyHtmlBits :: FilePath -> FilePath -> Themes -> Bool -> IO ()
@@ -142,6 +145,15 @@ headHtml docTitle themes mathjax_url =
142
145
, " }"
143
146
, " });" ]
144
147
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
+
145
157
srcButton :: SourceURLs -> Maybe Interface -> Maybe Html
146
158
srcButton (Just src_base_url, _, _, _) Nothing =
147
159
Just (anchor ! [href src_base_url] << " Source" )
@@ -180,20 +192,18 @@ indexButton maybe_index_url
180
192
bodyHtml :: String -> Maybe Interface
181
193
-> SourceURLs -> WikiURLs
182
194
-> Maybe String -> Maybe String
195
+ -> Bool -- ^ With Quick Jump?
183
196
-> Html -> Html
184
197
bodyHtml doctitle iface
185
198
maybe_source_url maybe_wiki_url
186
199
maybe_contents_url maybe_index_url
200
+ withQuickjump
187
201
pageContent =
188
202
body << [
189
203
divPackageHeader << [
190
204
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)
197
207
],
198
208
divContent << pageContent,
199
209
divFooter << paragraph << (
@@ -202,6 +212,13 @@ bodyHtml doctitle iface
202
212
(" version " ++ projectVersion)
203
213
)
204
214
]
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
+ ]
205
222
206
223
moduleInfo :: Interface -> Html
207
224
moduleInfo iface =
@@ -267,14 +284,16 @@ ppHtmlContents
267
284
-> Maybe String
268
285
-> SourceURLs
269
286
-> WikiURLs
287
+ -> Bool -- ^ With Quick Jump?
270
288
-> [InstalledInterface ] -> Bool -> Maybe (MDoc GHC. RdrName )
271
289
-> Bool
272
290
-> Maybe Package -- ^ Current package
273
291
-> Qualification -- ^ How to qualify names
274
292
-> IO ()
275
293
ppHtmlContents dflags odir doctitle _maybe_package
276
294
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
278
297
let tree = mkModuleTree dflags showPkgs
279
298
[(instMod iface, toInstalledDescription iface)
280
299
| iface <- ifaces
@@ -287,7 +306,7 @@ ppHtmlContents dflags odir doctitle _maybe_package
287
306
headHtml doctitle themes mathjax_url +++
288
307
bodyHtml doctitle Nothing
289
308
maybe_source_url maybe_wiki_url
290
- Nothing maybe_index_url << [
309
+ Nothing maybe_index_url withQuickjump << [
291
310
ppPrologue pkg qual doctitle prologue,
292
311
ppSignatureTree pkg qual sig_tree,
293
312
ppModuleTree pkg qual tree
@@ -420,11 +439,12 @@ ppHtmlIndex :: FilePath
420
439
-> Maybe String
421
440
-> SourceURLs
422
441
-> WikiURLs
442
+ -> Bool -- ^ With Quick Jump?
423
443
-> [InstalledInterface ]
424
444
-> Bool
425
445
-> IO ()
426
446
ppHtmlIndex 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
428
448
let html = indexPage split_indices Nothing
429
449
(if split_indices then [] else index)
430
450
@@ -443,7 +463,7 @@ ppHtmlIndex odir doctitle _maybe_package themes
443
463
headHtml (doctitle ++ " (" ++ indexName ch ++ " )" ) themes maybe_mathjax_url +++
444
464
bodyHtml doctitle Nothing
445
465
maybe_source_url maybe_wiki_url
446
- maybe_contents_url Nothing << [
466
+ maybe_contents_url Nothing withQuickjump << [
447
467
if showLetters then indexInitialLetterLinks else noHtml,
448
468
if null items then noHtml else
449
469
divIndex << [sectionName << indexName ch, buildIndex items]
@@ -541,11 +561,14 @@ ppHtmlIndex odir doctitle _maybe_package themes
541
561
ppHtmlModule
542
562
:: FilePath -> String -> Themes
543
563
-> 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
545
567
-> Bool -> Interface -> IO ()
546
568
ppHtmlModule odir doctitle themes
547
569
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
549
572
let
550
573
mdl = ifaceMod iface
551
574
aliases = ifaceModuleAliases iface
@@ -565,7 +588,7 @@ ppHtmlModule odir doctitle themes
565
588
headHtml mdl_str_annot themes maybe_mathjax_url +++
566
589
bodyHtml doctitle (Just iface)
567
590
maybe_source_url maybe_wiki_url
568
- maybe_contents_url maybe_index_url << [
591
+ maybe_contents_url maybe_index_url withQuickjump << [
569
592
divModuleHeader << (moduleInfo iface +++ (sectionName << mdl_str_linked)),
570
593
ifaceToHtml maybe_source_url maybe_wiki_url iface unicode pkg real_qual
571
594
]
0 commit comments