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
Model registry
Operate
Environments
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
Chaitanya
swh-docs
Commits
2ab5a4f8
Commit
2ab5a4f8
authored
2 years ago
by
Jérémy Bobbio (Lunar)
Browse files
Options
Downloads
Plain Diff
Merge branches 'restore-link-to-api-in-devel' and 'fix-edit-link-for-api'
parents
f16fc761
f13f1620
af594297
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/devel/index.rst
+1
-0
1 addition, 0 deletions
docs/devel/index.rst
swh/docs/sphinx/conf.py
+25
-0
25 additions, 0 deletions
swh/docs/sphinx/conf.py
with
26 additions
and
0 deletions
docs/devel/index.rst
+
1
−
0
View file @
2ab5a4f8
...
...
@@ -13,6 +13,7 @@ Development
faq/index
roadmap/roadmap-2022
roadmap/index
api-reference
archive-changelog
journal
statsd
...
...
This diff is collapsed.
Click to expand it.
swh/docs/sphinx/conf.py
+
25
−
0
View file @
2ab5a4f8
...
...
@@ -141,6 +141,31 @@ html_context = {
"
gitlab_repo
"
:
"
swh-docs
"
,
"
gitlab_version
"
:
"
master
"
,
"
doc_path
"
:
"
docs
"
,
# The swh-docs building process symlinks the documentation for
# individual modules into the swh-docs tree to generate a single Sphinx
# project. The “Edit this page” link therefore needs to point to the right
# repository on GitLab in these case.
# We implement this using the `edit_page_url_template` option, see:
# https://pydata-sphinx-theme.readthedocs.io/en/stable/user_guide/source-buttons.html#custom-edit-url
# We can take advantage that it’s a Jinja2 template to recognize
# that API documentation file path starts with `devel/swh-` and adjust
# accordingly. This is a bit of a hack, but we can hope it’ll be enough as
# long as we stay consistent for module paths.
# Please note the usage of `{%-` and `-%}` used to trim spaces from the
# generated string. See:
# https://jinja.palletsprojects.com/en/3.1.x/templates/#whitespace-control
"
edit_page_url_template
"
:
"""
{%- if file_name.startswith(
'
devel/swh-
'
) -%}
{% set path = file_name.split(
'
/
'
) -%}
{% set gitlab_repo = path[1] -%}
{% set doc_path -%}
docs/{{ path[2:-1] | join(
'
/
'
) }}
{%- endset -%}
{% set file_name = path[-1] -%}
{% endif -%}
{{ gitlab_url }}/{{ gitlab_user }}/{{ gitlab_repo -}}
/-/edit/{{ gitlab_version }}/{{ doc_path }}{{ file_name -}}
"""
,
# Use light mode by default until the landing page better supports dark mode
"
default_mode
"
:
"
light
"
,
}
...
...
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