feat: parameterize the URL root for links in the HTML
parent
49fdb6279d
commit
82f63cb613
|
@ -14,9 +14,8 @@ namespace DocGen4
|
|||
|
||||
open Lean Std IO System Output
|
||||
|
||||
def htmlOutput (result : AnalyzerResult) : IO Unit := do
|
||||
-- TODO: parameterize this
|
||||
let config := { root := "/", result := result, currentName := none}
|
||||
def htmlOutput (result : AnalyzerResult) (root : String) : IO Unit := do
|
||||
let config := { root := root, result := result, currentName := none}
|
||||
let basePath := FilePath.mk "./build/doc/"
|
||||
let indexHtml := ReaderT.run index config
|
||||
let notFoundHtml := ReaderT.run notFound config
|
||||
|
|
|
@ -4,9 +4,10 @@ import Lean
|
|||
open DocGen4 Lean IO
|
||||
|
||||
def main (args : List String) : IO Unit := do
|
||||
let modules := args
|
||||
let root := args.head!
|
||||
let modules := args.tail!
|
||||
let path ← lakeSetupSearchPath (←getLakePath) modules.toArray
|
||||
IO.println s!"Loading modules from: {path}"
|
||||
let doc ← load $ modules.map Name.mkSimple
|
||||
IO.println "Outputting HTML"
|
||||
htmlOutput doc
|
||||
htmlOutput doc root
|
||||
|
|
|
@ -4,9 +4,10 @@ Document Generator for Lean 4
|
|||
## Usage
|
||||
You can call `doc-gen4` from the top of a Lake project like this:
|
||||
```sh
|
||||
$ /path/to/doc-gen4 Module
|
||||
$ /path/to/doc-gen4 / Module
|
||||
```
|
||||
Where `Module` is one or more of the top level modules you want to document.
|
||||
Where the `/` is the root URL the HTML will refer to and `Module` is one or
|
||||
more of the top level modules you want to document.
|
||||
The tool will then proceed to compile the project using lake (if that hasn't happened yet),
|
||||
analyze it and put the result in `./build/doc`.
|
||||
You could e.g. host the files locally with the built-in Python webserver:
|
||||
|
|
|
@ -23,7 +23,7 @@ fi
|
|||
|
||||
# generate the docs
|
||||
cd $1
|
||||
../$2/build/bin/doc-gen4 Mathlib
|
||||
../$2/build/bin/doc-gen4 /mathlib4_docs/ Mathlib
|
||||
|
||||
if [ "$3" = "true" ]; then
|
||||
cd ..
|
||||
|
|
Loading…
Reference in New Issue