Skip to content

Commit

Permalink
add to help; fixup after #13212 isRelativeTo got merged
Browse files Browse the repository at this point in the history
  • Loading branch information
timotheecour committed Jan 23, 2020
1 parent a6d8717 commit 41c02ab
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion compiler/docgen.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 8 additions & 9 deletions compiler/options.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions doc/advopt.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 41c02ab

Please sign in to comment.