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

Commit 24ccb9b

Browse files
committed
Include subordinates in content index
1 parent 9d1a32f commit 24ccb9b

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

haddock-api/resources/html/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ var App = createClass({
8282
threshold: 0.4,
8383
caseSensitive: true,
8484
includeScore: true,
85-
keys: ["name"]
85+
tokenize: true,
86+
keys: ["name", "module"]
8687
}),
8788
moduleResults: []
8889
});

haddock-api/src/Haddock/Backends/Xhtml.hs

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -374,19 +374,22 @@ ppJsonIndex odir maybe_source_url maybe_wiki_url unicode qual_opt ifaces = do
374374
mdl = ifaceMod iface
375375

376376
goExport :: Module -> Qualification -> ExportItem DocName -> [Value]
377-
goExport mdl qual item =
378-
case processExport True links_info unicode qual item of
379-
Nothing -> []
380-
Just html ->
381-
[ Object
382-
[ "display_html" .= String (showHtmlFragment html)
377+
goExport mdl qual item
378+
| Just item_html <- processExport True links_info unicode qual item
379+
= [ Object
380+
[ "display_html" .= String (showHtmlFragment item_html)
383381
, "name" .= String (intercalate " " (map nameString names))
384382
, "module" .= String (moduleString mdl)
385383
, "link" .= String (fromMaybe "" (listToMaybe (map (nameLink mdl) names)))
386384
]
387-
]
385+
]
386+
| otherwise = []
388387
where
389-
names = exportName item
388+
names = exportName item ++ exportSubs item
389+
390+
exportSubs :: ExportItem DocName -> [DocName]
391+
exportSubs ExportDecl { expItemSubDocs } = map fst expItemSubDocs
392+
exportSubs _ = []
390393

391394
exportName :: ExportItem DocName -> [DocName]
392395
exportName ExportDecl { expItemDecl } = getMainDeclBinder $ unLoc expItemDecl

0 commit comments

Comments
 (0)