-
- Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Description
nim doc --project doesn't work when:
- there are relative imports eg
import ".." / utils - there are multiple modules in the project with the same basename
Example
nim doc --index:on --project --outdir:htmldocs /pathto/msub/main.nim
# /pathto/msub/main.nim: from ".."/utils as m1 import nil from "."/utils as m2 import nil # note: would still be buggy if that clashing module is imported from somewhere else # /pathto/msub/utils.nim proc fun1*() = discard # /pathto/utils.nim proc fun2*() = discardCurrent Output
- depending on which import comes first, (
from "."/utils as m2 import nilorfrom ".."/utils as m1 import nil), you'll get one module generated or the other (clashing location) - you'll get a 404 error when clicking on the import
../utilsas the link will be wrong
Possible Solution
the most robust solution is to flatten the hierarchy in exactly the same way as done for nim c
find /tmp/d28/*.c /tmp/d28/@m..@sthello2.nim.c /tmp/d28/@mthello2.nim.c /tmp/d28/@mthello3.nim.c /tmp/d28/stdlib_io.nim.c /tmp/d28/stdlib_system.nim.c perhaps the particular mangling scheme can be adapted for urls but idea is identical.
note
One additional advantage of a flat hierarchy is that we'd be able to use relative instead of absolute href:
href <link rel="stylesheet" type="text/css" href="nimdoc.css"> # instead of `href="/nimdoc.css"` and it would work with both httpserver and open pathto/main.html
currently both absolute and relative hrefs would not work depending on situations
Additional Information
- nim devel 9fc04a5
- fix #12998 nim doc regression #13117 does not fix this, as this is a long pre-existing issue
kaushalmodi and juancarlospaco
Metadata
Metadata
Assignees
Labels
No labels