@@ -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,16 @@ headHtml docTitle themes mathjax_url =
142
145
, " }"
143
146
, " });" ]
144
147
148
+ quickJumpButtonLi :: Bool -- ^ With Quick Jump?
149
+ -> Maybe Html
150
+ -- The TrueScript 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
+
157
+
145
158
srcButton :: SourceURLs -> Maybe Interface -> Maybe Html
146
159
srcButton (Just src_base_url, _, _, _) Nothing =
147
160
Just (anchor ! [href src_base_url] << " Source" )
@@ -180,20 +193,18 @@ indexButton maybe_index_url
180
193
bodyHtml :: String -> Maybe Interface
181
194
-> SourceURLs -> WikiURLs
182
195
-> Maybe String -> Maybe String
196
+ -> Bool -- ^ With Quick Jump?
183
197
-> Html -> Html
184
198
bodyHtml doctitle iface
185
199
maybe_source_url maybe_wiki_url
186
200
maybe_contents_url maybe_index_url
201
+ withQuickjump
187
202
pageContent =
188
203
body << [
189
204
divPackageHeader << [
190
205
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" ]
206
+ ulist ! [theclass " links" , identifier " page-menu" ]
207
+ << catMaybes (quickJumpButtonLi withQuickjump : otherButtonLis)
197
208
],
198
209
divContent << pageContent,
199
210
divFooter << paragraph << (
@@ -202,6 +213,13 @@ bodyHtml doctitle iface
202
213
(" version " ++ projectVersion)
203
214
)
204
215
]
216
+ where
217
+ otherButtonLis = (fmap . fmap ) (li << )
218
+ [ srcButton maybe_source_url iface
219
+ , wikiButton maybe_wiki_url (ifaceMod <$> iface)
220
+ , contentsButton maybe_contents_url
221
+ , indexButton maybe_index_url
222
+ ]
205
223
206
224
moduleInfo :: Interface -> Html
207
225
moduleInfo iface =
@@ -267,14 +285,16 @@ ppHtmlContents
267
285
-> Maybe String
268
286
-> SourceURLs
269
287
-> WikiURLs
288
+ -> Bool -- ^ With Quick Jump?
270
289
-> [InstalledInterface ] -> Bool -> Maybe (MDoc GHC. RdrName )
271
290
-> Bool
272
291
-> Maybe Package -- ^ Current package
273
292
-> Qualification -- ^ How to qualify names
274
293
-> IO ()
275
294
ppHtmlContents dflags odir doctitle _maybe_package
276
295
themes mathjax_url maybe_index_url
277
- maybe_source_url maybe_wiki_url ifaces showPkgs prologue debug pkg qual = do
296
+ maybe_source_url maybe_wiki_url withQuickjump
297
+ ifaces showPkgs prologue debug pkg qual = do
278
298
let tree = mkModuleTree dflags showPkgs
279
299
[(instMod iface, toInstalledDescription iface)
280
300
| iface <- ifaces
@@ -287,7 +307,7 @@ ppHtmlContents dflags odir doctitle _maybe_package
287
307
headHtml doctitle themes mathjax_url +++
288
308
bodyHtml doctitle Nothing
289
309
maybe_source_url maybe_wiki_url
290
- Nothing maybe_index_url << [
310
+ Nothing maybe_index_url withQuickjump << [
291
311
ppPrologue pkg qual doctitle prologue,
292
312
ppSignatureTree pkg qual sig_tree,
293
313
ppModuleTree pkg qual tree
@@ -420,11 +440,12 @@ ppHtmlIndex :: FilePath
420
440
-> Maybe String
421
441
-> SourceURLs
422
442
-> WikiURLs
443
+ -> Bool -- ^ With Quick Jump?
423
444
-> [InstalledInterface ]
424
445
-> Bool
425
446
-> IO ()
426
447
ppHtmlIndex odir doctitle _maybe_package themes
427
- maybe_mathjax_url maybe_contents_url maybe_source_url maybe_wiki_url ifaces debug = do
448
+ maybe_mathjax_url maybe_contents_url maybe_source_url maybe_wiki_url withQuickjump ifaces debug = do
428
449
let html = indexPage split_indices Nothing
429
450
(if split_indices then [] else index)
430
451
@@ -443,7 +464,7 @@ ppHtmlIndex odir doctitle _maybe_package themes
443
464
headHtml (doctitle ++ " (" ++ indexName ch ++ " )" ) themes maybe_mathjax_url +++
444
465
bodyHtml doctitle Nothing
445
466
maybe_source_url maybe_wiki_url
446
- maybe_contents_url Nothing << [
467
+ maybe_contents_url Nothing withQuickjump << [
447
468
if showLetters then indexInitialLetterLinks else noHtml,
448
469
if null items then noHtml else
449
470
divIndex << [sectionName << indexName ch, buildIndex items]
@@ -541,11 +562,14 @@ ppHtmlIndex odir doctitle _maybe_package themes
541
562
ppHtmlModule
542
563
:: FilePath -> String -> Themes
543
564
-> Maybe String -> SourceURLs -> WikiURLs
544
- -> Maybe String -> Maybe String -> Bool -> Maybe Package -> QualOption
565
+ -> Maybe String -> Maybe String
566
+ -> Bool -- ^ With Quick Jump?
567
+ -> Bool -> Maybe Package -> QualOption
545
568
-> Bool -> Interface -> IO ()
546
569
ppHtmlModule odir doctitle themes
547
570
maybe_mathjax_url maybe_source_url maybe_wiki_url
548
- maybe_contents_url maybe_index_url unicode pkg qual debug iface = do
571
+ maybe_contents_url maybe_index_url withQuickjump
572
+ unicode pkg qual debug iface = do
549
573
let
550
574
mdl = ifaceMod iface
551
575
aliases = ifaceModuleAliases iface
@@ -565,7 +589,7 @@ ppHtmlModule odir doctitle themes
565
589
headHtml mdl_str_annot themes maybe_mathjax_url +++
566
590
bodyHtml doctitle (Just iface)
567
591
maybe_source_url maybe_wiki_url
568
- maybe_contents_url maybe_index_url << [
592
+ maybe_contents_url maybe_index_url withQuickjump << [
569
593
divModuleHeader << (moduleInfo iface +++ (sectionName << mdl_str_linked)),
570
594
ifaceToHtml maybe_source_url maybe_wiki_url iface unicode pkg real_qual
571
595
]
0 commit comments