Open artemklevtsov opened 3 years ago
Now docgen support only GitHub.
what do you mean? does --git.url:https://gitlab.com/myusername/myproject
not work?
Template is https://{host}/{username}/{projname}/-/blob/{ref}/${filename}#L{numline}
.
indeed,
PR welcome. it doesn't sound hard to fix.
doc.item.seesrc = """ <a
href="${url}/tree/${commit}/${path}#L${line}"
class="link-seesrc" target="_blank">Source</a>
=>
doc.item.seesrc = """ <a
href="${urlModif}/tree/${commit}/${path}#L${line}"
class="link-seesrc" target="_blank">Source</a>
and then in docgen.nim:
dispA(d.conf, result, "$1", "", [ropeFormatNamedVars(d.conf, docItemSeeSrc,
["path", "line", "url", "commit", "devel"], [rope path.string,
rope($line), rope gitUrl, rope commit, rope develBranch])])
compute urlModif
from url
depending on whether host is gitlab or github or other
See source switch
paragraph in docsI dived a bit into the documentation. Seems it can be solved through the configuration options. I put the following to the nimdoc.cfg
in project root directory:
git.url = "https://gitlab.com/username/projectname"
git.commit = "master"
doc.item.seesrc = """ <a href="${url}/-/blob/${commit}/${path}#L${line}" class="link-seesrc" target="_blank">Source</a>
<a href="${url}/-/edit/${commit}/${path}#L${line}" class="link-seesrc" target="_blank" >Edit</a>
"""
ya but it's better to make it work without user having to change config/nimdoc.cfg
; --git.url
should just work whether it's github or gitlab; something along the lines of https://github.com/nim-lang/Nim/issues/16642#issuecomment-757356276 should work
Now docgen support only GitHub. It would be nice to add others.