fix: port the SITE_ROOT fix to find.js
parent
67402506c7
commit
3ac6ddd1ab
|
@ -84,7 +84,7 @@ def htmlOutput (result : AnalyzerResult) (ws : Lake.Workspace) (leanHash: String
|
|||
let config : SiteContext := { depthToRoot := 0, result := result, currentName := none, sourceLinker := ←sourceLinker ws leanHash}
|
||||
let basePath := FilePath.mk "." / "build" / "doc"
|
||||
let indexHtml := ReaderT.run index config
|
||||
let findHtml := ReaderT.run find config
|
||||
let findHtml := ReaderT.run find { config with depthToRoot := 1 }
|
||||
let notFoundHtml := ReaderT.run notFound config
|
||||
FS.createDirAll basePath
|
||||
FS.createDirAll (basePath / "find")
|
||||
|
|
|
@ -11,6 +11,7 @@ def find : HtmlM Html := do
|
|||
<html lang="en">
|
||||
<head>
|
||||
<link rel="preload" href={s!"{←getRoot}declaration-data.bmp"}/>
|
||||
<script>{s!"const SITE_ROOT={String.quote (←getRoot)};"}</script>
|
||||
<script type="module" async="true" src={s!"./find.js"}></script>
|
||||
</head>
|
||||
<body></body>
|
||||
|
|
|
@ -60,6 +60,7 @@ async function findAndRedirect(pattern, strict, view) {
|
|||
// TODO: better url semantic for 404, current implementation will lead to duplicate search for fuzzy match if not found.
|
||||
window.location.replace(`${SITE_ROOT}404.html#${pattern ?? ""}`);
|
||||
} else {
|
||||
result.docLink = SITE_ROOT + result.docLink;
|
||||
// success, redirect to doc or source page, or to the semantic rdf.
|
||||
if (!view) {
|
||||
window.location.replace(result.link);
|
||||
|
|
Loading…
Reference in New Issue