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

#463 - Add github, gitlab, bitbucket page arguments option #464

Merged
merged 18 commits into from
Feb 1, 2018

Conversation

jpsenior
Copy link
Contributor

@jpsenior jpsenior commented Sep 16, 2017

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

@Blendify
Copy link
Member

I do not have a strong opinion on this so @ericholscher or @agjohnson should chime in here. But you also need to edit the theme.conf file

@jpsenior
Copy link
Contributor Author

@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?

@Blendify
Copy link
Member

I would still add the options to the theme.conf

@ericholscher
Copy link
Member

These should be documented, and added as theme options, if we are going to officially support them. Seems like a reasonable change, though 👍

@jessetan
Copy link
Contributor

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 blob with edit: https://SERVER/USER/REPO/edit/BRANCH/FILENAME.ext

- use `pageview_mode` as option
- Fix logic for some websites
Bitbucket has no way to control how we interact with there file viewer
@Blendify
Copy link
Member

All review comments have been covered.

@Blendify Blendify requested a review from davidfischer January 18, 2018 18:35
README.rst Outdated
.. code:: python

html_context = {
'pageview_mode': ''
Copy link
Contributor

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.

@Blendify
Copy link
Member

Updated Var name but I'll handle the rest of the HTML context options in a separate PR.

@@ -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>
Copy link
Contributor

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

Copy link
Member

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 = {
Copy link
Contributor

@jessetan jessetan Jan 23, 2018

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)

Copy link
Member

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.

@Blendify Blendify mentioned this pull request Jan 25, 2018
8 tasks
@Blendify
Copy link
Member

All changes have been done. Time for review again.

@jessetan
Copy link
Contributor

LGTM, only nit: "Changes how to view files when using display_github, display_gitlab, ect." -> "etc."

Copy link
Contributor

@davidfischer davidfischer left a 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.

@@ -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.
Copy link
Contributor

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.
Copy link
Contributor

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.

Copy link
Member

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.

@Blendify Blendify merged commit 04520a0 into readthedocs:master Feb 1, 2018
emilyemorehouse added a commit to cuttlesoft/sphinx_rtd_theme that referenced this pull request Mar 6, 2018
* 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)
  ...
@agjohnson agjohnson added this to the v0.3.0 milestone Mar 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants