Repository navigation
Add support for GitLab repositories - #1435
Conversation
waylan
left a comment
There was a problem hiding this comment.
Thanks. Other than the one minor nit-pick, this looks good.
| **default**: `edit/master/docs/` or `src/default/docs/` for GitHub or Bitbucket | ||
| repos, respectively, if `repo_url` matches those domains, otherwise `null` | ||
| **default**: `edit/master/docs/` or `src/default/docs/` GitHub, GitLab or | ||
| Bitbucket repos, respectively, if `repo_url` matches those domains, |
There was a problem hiding this comment.
Missing "for" before "GitHub". Although, "respectively" doesn't really work as there are two items in the first list and three in the second. Sure, users in the know will understand, but we should not assume users will know that GitHub and Gitlab share the same URL scheme. How about:
**default**: `edit/master/docs/` for GitHub and GitLab repos or `src/default/docs/` for a Bitbucket repo...
|
In view of #1378 I'm wondering if we should even bother with this. Yes, this gives GitLab equal footing with GitHub, which is not a bad thing. However, every time a new service comes along, I don't want to have to add support for it like this. That would be a maintenance nightmare. Perhaps if we take the approach proposed in #1378, then we might be able to avoid the need for this. What I would really like to do is to rip all of the repo specific stuff out and implement it as a plugin. That gives us the freedom to add all sorts of configuration without adding to the main config. And as new services come along, any third party could create a plugin which worked with that services' specific needs. My hesitation involves how to deal with themes. Plugins can't inject template code into an existing theme unless they override/replace an entire file. And getting a plugin to provide template code that works across all themes, including third party themes, would be nigh impossible. I'm thinking perhaps the solution would be to have the plugin provide a documented list of template variables and templates would need to provide the logic to display those variables (this is more-or-less the approach taken by the search plugin). For example, one of the variables could be the "name" of the icon to display. What names would be valid would depend on the theme you use. For example, a theme which uses FontAwesome might support different names than a theme that used some other mechanism for displaying icons. Consider the following template snippet which would work in the readthedocs theme: class="icon icon-{{ icon_name }}"Of course, Thoughts? |
Note that the icons in the themes will not show up until FontAwesome is updated to at least version 4.6 and/or an up-to-date version of the upstream readthedocs css is imported. This commit also fixes a slight documentation error regarding the default value of `repo_name` and removes some tautological tests.
|
Hey - I've made the change you suggested. My wording was indeed a bit wonky. As far as the larger issue is concerned it is certainly true that maintaining the list of potential services here and replicated in all the themes seems unsustainable. I've only opened this PR because I noticed the icon was missing in cinder and that bugged me. Adding a variable for the service/icon name seems reasonable, and maybe a service name is enough (currently the icon name would only be However, unless you are planning to implement this soon, I'd still suggest merging this PR. Ripping it out again later does no harm. |
|
One more thing I just realized: Currently I can set |
|
As this is a fully working implementation for GitLab we'll merge this now. That way, if/when we address the other issues, we'll be sure to include GitLab. Otherwise it may get forgotten about. @tribut thanks again for doing the work on this. |
This adds support for GitLab repositories in the same way that already exists for GitHub and Bitbucket.
Note that the icons in the themes will not show up until FontAwesome is updated to at least version 4.6 and/or an up-to-date version of the upstream readthedocs css is imported.
This commit also fixes a slight documentation error regarding the default value of
repo_nameand removes some tautological tests.