diff --git a/compiler/docgen.nim b/compiler/docgen.nim index 3e64b086757ce..cdc1a6b9d2f00 100644 --- a/compiler/docgen.nim +++ b/compiler/docgen.nim @@ -17,7 +17,7 @@ import packages/docutils/rst, packages/docutils/rstgen, json, xmltree, cgi, trees, types, typesrenderer, astalgo, lineinfos, intsets, - pathutils, trees, nimconf + pathutils, trees const exportSection = skField diff --git a/compiler/options.nim b/compiler/options.nim index 41f1bc0faac84..58feae5705e45 100644 --- a/compiler/options.nim +++ b/compiler/options.nim @@ -261,9 +261,7 @@ type implicitIncludes*: seq[string] # modules that are to be implicitly included docSeeSrcUrl*: string # if empty, no seeSrc will be generated. \ # The string uses the formatting variables `path` and `line`. - docRoot*: AbsoluteDir - # `nim doc --docRoot:foo --project --outdir:docs foo/sub/main.nim` - # genrates: docs/sub/main.html + docRoot*: AbsoluteDir ## see nim --fullhelp for --docRoot # the used compiler cIncludes*: seq[AbsoluteDir] # directories to search for included files @@ -659,12 +657,13 @@ template patchModule(conf: ConfigRef) {.dirty.} = let ov = conf.moduleOverrides[key] if ov.len > 0: result = AbsoluteFile(ov) -proc isRelativeTo(path: string, base: string): bool= - # PENDING #13212 - let path = path.normalizedPath - let base = base.normalizedPath - let ret = relativePath(path, base) - result = path.len > 0 and not ret.startsWith ".." +when (NimMajor, NimMinor) < (1, 1) or not declared(isRelativeTo): + proc isRelativeTo(path, base: string): bool = + # pending #13212 use os.isRelativeTo + let path = path.normalizedPath + let base = base.normalizedPath + let ret = relativePath(path, base) + result = path.len > 0 and not ret.startsWith ".." proc getRelativePathFromConfigPath*(conf: ConfigRef; f: AbsoluteFile): RelativeFile = let f = $f diff --git a/doc/advopt.txt b/doc/advopt.txt index d53acc111d06d..64a25b9e5a23f 100644 --- a/doc/advopt.txt +++ b/doc/advopt.txt @@ -67,6 +67,8 @@ Advanced options: --clib:LIBNAME link an additional C library (you should omit platform-specific extensions) --project document the whole project (doc2) + --docRoot:path nim doc --docRoot:foo --project --outdir:docs foo/sub/main.nim + generates: docs/sub/main.html --docSeeSrcUrl:url activate 'see source' for doc and doc2 commands (see doc.item.seesrc in config/nimdoc.cfg) --docInternal also generate documentation for non-exported symbols