|
1 |
| -{%- if meta is defined and meta is not none %} |
2 |
| - {%- set check_meta = True %} |
3 |
| -{%- else %} |
4 |
| - {%- set check_meta = False %} |
5 |
| -{%- endif %} |
6 |
| - |
7 |
| -{%- if check_meta and 'github_url' in meta %} |
8 |
| - {%- set display_github = True %} |
| 1 | +{%- if display_github %} |
| 2 | + {% set github_sourcelink %} |
| 3 | + {%- if meta and 'github_url' in meta %} |
| 4 | + {#- "meta" or "front matter" is data defined inside a page -#} |
| 5 | +<a href="{{ meta['github_url'] }}" class="fa fa-github"> {{ _('Edit on GitHub') }}</a> |
| 6 | + {%- else %} |
| 7 | +<a href="https://{{ github_host|default("github.com") }}/{{ github_user }}/{{ github_repo }}/{{ theme_vcs_pageview_mode or "blob" }}/{{ github_version }}{{ conf_py_path }}{{ pagename }}{{ page_source_suffix }}" class="fa fa-github"> {{ _('Edit on GitHub') }}</a> |
| 8 | + {%- endif %} |
| 9 | + {% endset %} |
9 | 10 | {%- endif %}
|
10 | 11 |
|
11 |
| -{%- if check_meta and 'bitbucket_url' in meta %} |
12 |
| - {%- set display_bitbucket = True %} |
| 12 | +{%- if display_bitbucket %} |
| 13 | + {% set bitbucket_sourcelink %} |
| 14 | + {%- if meta and 'bitbucket_url' in meta %} |
| 15 | +<a href="{{ meta['bitbucket_url'] }}" class="fa fa-bitbucket"> {{ _('Edit on Bitbucket') }}</a> |
| 16 | + {%- else %} |
| 17 | +<a href="https://bitbucket.org/{{ bitbucket_user }}/{{ bitbucket_repo }}/src/{{ bitbucket_version}}{{ conf_py_path }}{{ pagename }}{{ page_source_suffix }}?mode={{ theme_vcs_pageview_mode or "view" }}" class="fa fa-bitbucket"> {{ _('Edit on Bitbucket') }}</a> |
| 18 | + {%- endif %} |
| 19 | + {% endset %} |
13 | 20 | {%- endif %}
|
14 | 21 |
|
15 |
| -{%- if check_meta and 'gitlab_url' in meta %} |
16 |
| - {%- set display_gitlab = True %} |
| 22 | +{%- if display_gitlab %} |
| 23 | + {% set gitlab_sourcelink %} |
| 24 | + {%- if meta and 'gitlab_url' in meta %} |
| 25 | +<a href="{{ meta['gitlab_url'] }}" class="fa fa-gitlab"> {{ _('Edit on GitLab') }}</a> |
| 26 | + {%- else %} |
| 27 | +<a href="https://{{ gitlab_host|default("gitlab.com") }}/{{ gitlab_user }}/{{ gitlab_repo }}/{{ theme_vcs_pageview_mode or "blob" }}/{{ gitlab_version }}{{ conf_py_path }}{{ pagename }}{{ page_source_suffix }}" class="fa fa-gitlab"> {{ _('Edit on GitLab') }}</a> |
| 28 | + {%- endif %} |
| 29 | + {% endset %} |
17 | 30 | {%- endif %}
|
18 | 31 |
|
19 | 32 | {%- set display_vcs_links = display_vcs_links if display_vcs_links is defined else True %}
|
|
31 | 44 | {%- block breadcrumbs_aside %}
|
32 | 45 | <li class="wy-breadcrumbs-aside">
|
33 | 46 | {%- if hasdoc(pagename) and display_vcs_links %}
|
34 |
| - {%- if display_github %} |
35 |
| - {%- if check_meta and 'github_url' in meta %} |
36 |
| - <!-- User defined GitHub URL --> |
37 |
| - <a href="{{ meta['github_url'] }}" class="fa fa-github"> {{ _('Edit on GitHub') }}</a> |
38 |
| - {%- else %} |
39 |
| - <a href="https://{{ github_host|default("github.com") }}/{{ github_user }}/{{ github_repo }}/{{ theme_vcs_pageview_mode or "blob" }}/{{ github_version }}{{ conf_py_path }}{{ pagename }}{{ page_source_suffix }}" class="fa fa-github"> {{ _('Edit on GitHub') }}</a> |
40 |
| - {%- endif %} |
| 47 | + {%- if github_sourcelink %} |
| 48 | + {{ github_sourcelink }} |
41 | 49 | {%- elif display_bitbucket %}
|
42 |
| - {%- if check_meta and 'bitbucket_url' in meta %} |
43 |
| - <!-- User defined Bitbucket URL --> |
44 |
| - <a href="{{ meta['bitbucket_url'] }}" class="fa fa-bitbucket"> {{ _('Edit on Bitbucket') }}</a> |
45 |
| - {%- else %} |
46 |
| - <a href="https://bitbucket.org/{{ bitbucket_user }}/{{ bitbucket_repo }}/src/{{ bitbucket_version}}{{ conf_py_path }}{{ pagename }}{{ page_source_suffix }}?mode={{ theme_vcs_pageview_mode or "view" }}" class="fa fa-bitbucket"> {{ _('Edit on Bitbucket') }}</a> |
47 |
| - {%- endif %} |
| 50 | + {{ bitbucket_sourcelink }} |
48 | 51 | {%- elif display_gitlab %}
|
49 |
| - {%- if check_meta and 'gitlab_url' in meta %} |
50 |
| - <!-- User defined GitLab URL --> |
51 |
| - <a href="{{ meta['gitlab_url'] }}" class="fa fa-gitlab"> {{ _('Edit on GitLab') }}</a> |
52 |
| - {%- else %} |
53 |
| - <a href="https://{{ gitlab_host|default("gitlab.com") }}/{{ gitlab_user }}/{{ gitlab_repo }}/{{ theme_vcs_pageview_mode or "blob" }}/{{ gitlab_version }}{{ conf_py_path }}{{ pagename }}{{ page_source_suffix }}" class="fa fa-gitlab"> {{ _('Edit on GitLab') }}</a> |
54 |
| - {%- endif %} |
| 52 | + {{ gitlab_sourcelink }} |
55 | 53 | {%- elif show_source and source_url_prefix %}
|
56 | 54 | <a href="{{ source_url_prefix }}{{ pagename }}{{ page_source_suffix }}">{{ _('View page source') }}</a>
|
57 | 55 | {%- elif show_source and has_source and sourcename %}
|
|
0 commit comments