Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GitLab support for the docgen git.url #16642

Open
artemklevtsov opened this issue Jan 8, 2021 · 5 comments
Open

GitLab support for the docgen git.url #16642

artemklevtsov opened this issue Jan 8, 2021 · 5 comments
Labels
Documentation Generation Related to documentation generation (but not content). Feature

Comments

@artemklevtsov
Copy link
Contributor

Now docgen support only GitHub. It would be nice to add others.

@timotheecour
Copy link
Member

Now docgen support only GitHub.

what do you mean? does --git.url:https://gitlab.com/myusername/myproject not work?

@artemklevtsov
Copy link
Contributor Author

artemklevtsov commented Jan 9, 2021

Template is https://{host}/{username}/{projname}/-/blob/{ref}/${filename}#L{numline}.

@timotheecour
Copy link
Member

timotheecour commented Jan 9, 2021

indeed,

PR welcome. it doesn't sound hard to fix.

doc.item.seesrc = """&nbsp;&nbsp;<a
href="${url}/tree/${commit}/${path}#L${line}"
class="link-seesrc" target="_blank">Source</a>

=>

doc.item.seesrc = """&nbsp;&nbsp;<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

  • and then update the See source switch paragraph in docs

@artemklevtsov
Copy link
Contributor Author

artemklevtsov commented Jan 10, 2021

I 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 = """&nbsp;&nbsp;<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>
"""

@timotheecour
Copy link
Member

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 #16642 (comment) should work

@Yardanico Yardanico added the Documentation Generation Related to documentation generation (but not content). label Feb 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation Generation Related to documentation generation (but not content). Feature
Projects
None yet
Development

No branches or pull requests

4 participants