-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
#463 - Add github, gitlab, bitbucket page arguments option #464
Conversation
I do not have a strong opinion on this so @ericholscher or @agjohnson should chime in here. But you also need to edit the |
@Blendify Didn't see other options documented in theme.conf for the bitbucket/github/etc urls, so I was reluctant to add empty ones there. What do you recommend? |
I would still add the options to the |
These should be documented, and added as theme options, if we are going to officially support them. Seems like a reasonable change, though 👍 |
I don't think this will work for GitLab (at least for linking to editing mode). The link is currently https://SERVER/USER/REPO/blob/BRANCH/FILENAME.ext, and the URL for editing replaces |
Bitbucket has no way to control how we interact with there file viewer
All review comments have been covered. |
README.rst
Outdated
.. code:: python | ||
|
||
html_context = { | ||
'pageview_mode': '' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs a prefix to clarify that it sets the way links to the version control system are formatted, rather than something related to RTD or the theme. github_pageview_mode
is not suitable because the setting is used for GitHub, GitLab and BitBucket. What about vcs_pageview_mode
?
I think this also needs documentation for bitbucket_user
etc.
Updated Var name but I'll handle the rest of the HTML context options in a separate PR. |
sphinx_rtd_theme/breadcrumbs.html
Outdated
@@ -42,21 +42,21 @@ | |||
<!-- User defined GitHub URL --> | |||
<a href="{{ meta['github_url'] }}" class="fa fa-github"> {{ _('Edit on GitHub') }}</a> | |||
{% else %} | |||
<a href="https://{{ github_host|default("github.com") }}/{{ github_user }}/{{ github_repo }}/blob/{{ github_version }}{{ conf_py_path }}{{ pagename }}{{ suffix }}" class="fa fa-github"> {{ _('Edit on GitHub') }}</a> | |||
<a href="https://{{ github_host|default("github.com") }}/{{ github_user }}/{{ github_repo }}/{{ vcs_pageview_mode|default("blob") }}/{{ github_version }}{{ conf_py_path }}{{ pagename }}{{ suffix }}" class="fa fa-github"> {{ _('Edit on GitHub') }}</a> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think theme.conf
is a better place to put the default pageview mode so we have all defaults in one file, rather than spread over a conf file and the html template
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See my other reply. I will wait to see if you agree before updating.
README.rst
Outdated
|
||
.. code:: python | ||
|
||
html_context = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it technically possible to move this option (and the other VCS stuff later) to html_theme_options
instead of html_context
? It can be confusing to users that there are two places where project-wide configuration changes can be made (also see #529)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think so the way I see it is html_context
are things that we would want to know about the project while html_theme_options
are things we want to configure how the theme looks and interacts. So I am ok moving this new option the html_theme_options
but I think the rest should stay.
All changes have been done. Time for review again. |
LGTM, only nit: "Changes how to view files when using |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This worked well for me.
docs/configuring.rst
Outdated
@@ -44,9 +48,12 @@ Base options | |||
* ``prev_next_buttons_location`` String. can take the value ``bottom``, ``top``, ``both`` , or ``None`` | |||
and will display the "Next" and "Previous" buttons accordingly. | |||
* ``style_external_links`` Bool. Add an icon next to external links. Defaults to ``False``. | |||
* ``vcs_pageview_mode`` String. Changes how to view files when using `display_github`, `display_gitlab`, ect. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As @jessetan mentioned ect.
-> etc.
HTML Context Options | ||
-------------------- | ||
|
||
TODO. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the plan for this separately from Base options
?
I generally try to have TODO free code but if the plan is to quickly put something there I'm ok with this as a stopgap. I would just say remove it and add it completely in another PR. That's probably better than having a TODO.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I'll write a new PR right after this one is merged and before the release.
* rtfd/master: (252 commits) Docs: restructure (readthedocs#573) Docs: Fix typos (readthedocs#584) add missing quotes (bottom should be a string) (readthedocs#580) Typo: Contibuting => Contributing Allow versions popup to scroll (readthedocs#576) Add document block and rename bodycontent content Add a block around the page content Docs: httpdomain package name uses dash instead of period Update changlog for 0.2.5 (readthedocs#570) Run Grunt (readthedocs#568) Create CODE_OF_CONDUCT.md (readthedocs#562) readthedocs#463 - Add github, gitlab, bitbucket page arguments option (readthedocs#464) Remove from theme.conf Remove from docs Update footer.html (readthedocs#561) Refactor docs: split up & slim down read me Fix readthedocs#305 Move 1400px media-query to 1100px (readthedocs#396) Only output div.articleComments if the block has content (readthedocs#555) Readme cleanup (readthedocs#554) Add GitHub templates (readthedocs#410) ...
This adds a few fast options that a user can specify in sphinx
conf.py
to augment the default URLs that we redirect to -- for example, bitbucket can append?mode=edit
rather than whatever defaults are available. Fixes #463