diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2016-09-08 15:06:19 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2016-09-08 15:06:27 +0200 |
commit | dc8ec4296995d81bb6384beab579b6211c452532 (patch) | |
tree | fa6556b3a7c06dc0e5a8260c871d232c74a1174f /compiler | |
parent | 6699387c9bc1df433cb5fcefdc91cfacb125f6c4 (diff) | |
download | Nim-dc8ec4296995d81bb6384beab579b6211c452532.tar.gz |
documentation now has an 'edit' button
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/docgen.nim | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/compiler/docgen.nim b/compiler/docgen.nim index bbbec081a..9c72d5a84 100644 --- a/compiler/docgen.nim +++ b/compiler/docgen.nim @@ -459,13 +459,17 @@ proc genItem(d: PDoc, n, nameNode: PNode, k: TSymKind) = var seeSrcRope: Rope = nil let docItemSeeSrc = getConfigVar("doc.item.seesrc") - if docItemSeeSrc.len > 0 and options.docSeeSrcUrl.len > 0: - let path = n.info.toFilename.extractFilename.rope - let urlRope = ropeFormatNamedVars(options.docSeeSrcUrl, - ["path", "line"], [path, rope($n.info.line)]) + if docItemSeeSrc.len > 0: + let cwd = getCurrentDir() + var path = n.info.toFullPath + if path.startsWith(cwd): + path = path[cwd.len+1 .. ^1].replace('\\', '/') + var commit = getConfigVar("git.commit") + if commit.len == 0: commit = "master" dispA(seeSrcRope, "$1", "", [ropeFormatNamedVars(docItemSeeSrc, - ["path", "line", "url"], [path, - rope($n.info.line), urlRope])]) + ["path", "line", "url", "commit"], [rope path, + rope($n.info.line), rope getConfigVar("git.url"), + rope commit])]) add(d.section[k], ropeFormatNamedVars(getConfigVar("doc.item"), ["name", "header", "desc", "itemID", "header_plain", "itemSym", |