Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
swh-docs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Vincent Sellier
swh-docs
Commits
951fb7fd
Commit
951fb7fd
authored
4 years ago
by
vlorentz
Browse files
Options
Downloads
Patches
Plain Diff
Fix 'View page source' link for all pages outside swh-docs/
parent
5ad54e70
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
docs/_templates/breadcrumbs.html
+16
-0
16 additions, 0 deletions
docs/_templates/breadcrumbs.html
swh/docs/sphinx/view_in_phabricator.py
+9
-6
9 additions, 6 deletions
swh/docs/sphinx/view_in_phabricator.py
with
25 additions
and
6 deletions
docs/_templates/breadcrumbs.html
0 → 100644
+
16
−
0
View file @
951fb7fd
{% extends "!breadcrumbs.html" %}
{# Overrides RTD's default "View page source" link formatting, which
forces the full page name in the link; but we don't want it because
page names include the repo, eg. "swh-model/index".
The view_in_phabricator.py extension sets swh_source_url to
".../source/swh-model/browse/master/docs/index"
#}
{%- block breadcrumbs_aside %}
foo
<li
class=
"wy-breadcrumbs-aside"
>
{%- if hasdoc(pagename) and display_vcs_links %}
<a
href=
"{{ swh_source_url }}{{ page_source_suffix }}"
>
{{ _('View page source') }}
</a>
{% endif %}
</li>
{%- endblock %}
This diff is collapsed.
Click to expand it.
swh/docs/sphinx/view_in_phabricator.py
+
9
−
6
View file @
951fb7fd
...
...
@@ -16,15 +16,18 @@ def html_page_context(app, pagename, templatename, context, doctree):
return
elif
pagename
.
startswith
(
"
swh-
"
):
# .rst from a package's docs/ directory
repository
=
pagename
.
split
(
"
/
"
,
1
)[
0
]
path
=
"
docs/
"
(
repository
,
_
,
path
)
=
pagename
.
partition
(
"
/
"
)
else
:
# .rst from swh-docs/docs/
repository
=
"
swh-docs
"
path
=
"
docs/
"
context
[
"
source_url_prefix
"
]
=
f
"
https://forge.softwareheritage.org/source/
{
repository
}
/browse/master/
{
path
}
"
path
=
pagename
source_url
=
(
f
"
https://forge.softwareheritage.org/source/
{
repository
}
"
f
"
/browse/master/docs/
{
path
}
"
)
# Set a variable that can be used by swh-docs/docs/_templates/breadcrumbs.html:
context
[
"
swh_source_url
"
]
=
source_url
def
setup
(
app
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment