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
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions docs/configuring.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ You can configure different parts of the theme.
Project-wide Configuration
==========================

HTML Theme Options
------------------

The theme's project-wide options are defined in the ``sphinx_rtd_theme/theme.conf``
file of this repository, and can be defined in your project's ``conf.py`` via
``html_theme_options``. For example:
Expand All @@ -21,6 +24,7 @@ file of this repository, and can be defined in your project's ``conf.py`` via
'display_version': True,
'prev_next_buttons_location': bottom,
'style_external_links': False,
'vcs_pageview_mode': '',
# Toc options
'collapse_navigation': False,
'sticky_navigation': True,
Expand All @@ -32,7 +36,7 @@ file of this repository, and can be defined in your project's ``conf.py`` via
The following options are available:

Base options
------------
~~~~~~~~~~~~

* ``canonical_url`` String. This will specify a `canonical url <https://en.wikipedia.org/wiki/Canonical_link_element>`__
to let search engines know they should give higher ranking to latest version of the docs.
Expand All @@ -42,9 +46,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`, etc.
When using Github or Gitlab this can be: `blob` (default), `edit`, or `raw`,
on Bitbucket, this can be either: `view` (default) or `edit`.

TOC Options
-----------
~~~~~~~~~~~

These effect how we display the Table of Contents in the side bar. You can read more about them here: http://www.sphinx-doc.org/en/stable/templating.html#toctree

Expand All @@ -55,6 +62,12 @@ These effect how we display the Table of Contents in the side bar. You can read
* ``includehidden`` Bool. Specifies if the sidebar includes toctrees marked with the ``:hidden:`` option
* ``titles_only`` Bool. If True, removes headers within a page from the sidebar.

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.



Page-level Configuration
========================

Expand Down
6 changes: 3 additions & 3 deletions sphinx_rtd_theme/breadcrumbs.html
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}/{{ theme_vcs_pageview_mode|default("blob") }}/{{ github_version }}{{ conf_py_path }}{{ pagename }}{{ suffix }}" class="fa fa-github"> {{ _('Edit on GitHub') }}</a>
{% endif %}
{% elif display_bitbucket %}
{% if check_meta and 'bitbucket_url' in meta %}
<!-- User defined Bitbucket URL -->
<a href="{{ meta['bitbucket_url'] }}" class="fa fa-bitbucket"> {{ _('Edit on Bitbucket') }}</a>
{% else %}
<a href="https://bitbucket.org/{{ bitbucket_user }}/{{ bitbucket_repo }}/src/{{ bitbucket_version}}{{ conf_py_path }}{{ pagename }}{{ suffix }}" class="fa fa-bitbucket"> {{ _('Edit on Bitbucket') }}</a>
<a href="https://bitbucket.org/{{ bitbucket_user }}/{{ bitbucket_repo }}/src/{{ bitbucket_version}}{{ conf_py_path }}{{ pagename }}{{ suffix }}?mode={{ theme_vcs_pageview_mode|default("view") }}" class="fa fa-bitbucket"> {{ _('Edit on Bitbucket') }}</a>
{% endif %}
{% elif display_gitlab %}
{% if check_meta and 'gitlab_url' in meta %}
<!-- User defined GitLab URL -->
<a href="{{ meta['gitlab_url'] }}" class="fa fa-gitlab"> {{ _('Edit on GitLab') }}</a>
{% else %}
<a href="https://{{ gitlab_host|default("gitlab.com") }}/{{ gitlab_user }}/{{ gitlab_repo }}/blob/{{ gitlab_version }}{{ conf_py_path }}{{ pagename }}{{ suffix }}" class="fa fa-gitlab"> {{ _('Edit on GitLab') }}</a>
<a href="https://{{ gitlab_host|default("gitlab.com") }}/{{ gitlab_user }}/{{ gitlab_repo }}/{{ theme_vcs_pageview_mode|default("blob") }}/{{ gitlab_version }}{{ conf_py_path }}{{ pagename }}{{ suffix }}" class="fa fa-gitlab"> {{ _('Edit on GitLab') }}</a>
{% endif %}
{% elif show_source and source_url_prefix %}
<a href="{{ source_url_prefix }}{{ pagename }}{{ suffix }}">{{ _('View page source') }}</a>
Expand Down
1 change: 1 addition & 0 deletions sphinx_rtd_theme/theme.conf
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ logo_only =
display_version = True
prev_next_buttons_location = bottom
style_external_links = False
vcs_pageview_mode =