Skip to content

Commit

Permalink
Add view/edit buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
kwankyu committed Jul 30, 2024
1 parent 79c047c commit f7b64b2
Show file tree
Hide file tree
Showing 29 changed files with 88 additions and 59 deletions.
5 changes: 3 additions & 2 deletions src/doc/ca/intro/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@
# contains common paths.
html_static_path = [] + html_common_static_path

# Add a small edit button.
# Add small view/edit buttons.
html_theme_options.update({
'source_edit_link': os.path.join(source_repository, 'blob/develop/src/doc/ca/intro', '{filename}'),
'source_view_link': os.path.join(source_repository, 'blob/develop/src/doc/ca/intro', '{filename}'),
'source_edit_link': os.path.join(source_repository, 'edit/develop/src/doc/ca/intro', '{filename}'),
})

# General information about the project.
Expand Down
5 changes: 3 additions & 2 deletions src/doc/de/a_tour_of_sage/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@
# contains common paths.
html_static_path = [] + html_common_static_path

# Add a small edit button.
# Add small view/edit buttons.
html_theme_options.update({
'source_edit_link': os.path.join(source_repository, 'blob/develop/src/doc/de/a_tour_of_sage', '{filename}'),
'source_view_link': os.path.join(source_repository, 'blob/develop/src/doc/de/a_tour_of_sage', '{filename}'),
'source_edit_link': os.path.join(source_repository, 'edit/develop/src/doc/de/a_tour_of_sage', '{filename}'),
})

# General information about the project.
Expand Down
5 changes: 3 additions & 2 deletions src/doc/de/thematische_anleitungen/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@
# contains common paths.
html_static_path = [] + html_common_static_path

# Add a small edit button.
# Add small view/edit buttons.
html_theme_options.update({
'source_edit_link': os.path.join(source_repository, 'blob/develop/src/doc/de/thematische_anleitungen', '{filename}'),
'source_view_link': os.path.join(source_repository, 'blob/develop/src/doc/de/thematische_anleitungen', '{filename}'),
'source_edit_link': os.path.join(source_repository, 'edit/develop/src/doc/de/thematische_anleitungen', '{filename}'),
})

# General information about the project.
Expand Down
5 changes: 3 additions & 2 deletions src/doc/de/tutorial/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@
# contains common paths.
html_static_path = [] + html_common_static_path

# Add a small edit button.
# Add small view/edit buttons.
html_theme_options.update({
'source_edit_link': os.path.join(source_repository, 'blob/develop/src/doc/de/tutorial', '{filename}'),
'source_view_link': os.path.join(source_repository, 'blob/develop/src/doc/de/tutorial', '{filename}'),
'source_edit_link': os.path.join(source_repository, 'edit/develop/src/doc/de/tutorial', '{filename}'),
})

# General information about the project.
Expand Down
5 changes: 3 additions & 2 deletions src/doc/en/a_tour_of_sage/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@
# contains common paths.
html_static_path = [] + html_common_static_path

# Add a small edit button.
# Add small view/edit buttons.
html_theme_options.update({
'source_edit_link': os.path.join(source_repository, f'blob/develop/src/doc/en/a_tour_of_sage', '{filename}'),
'source_view_link': os.path.join(source_repository, f'blob/develop/src/doc/en/a_tour_of_sage', '{filename}'),
'source_edit_link': os.path.join(source_repository, f'edit/develop/src/doc/en/a_tour_of_sage', '{filename}'),
})

# General information about the project.
Expand Down
5 changes: 3 additions & 2 deletions src/doc/en/constructions/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@
# contains common paths.
html_static_path = [] + html_common_static_path

# Add a small edit button.
# Add small view/edit buttons.
html_theme_options.update({
'source_edit_link': os.path.join(source_repository, 'blob/develop/src/doc/en/constructions', '{filename}'),
'source_view_link': os.path.join(source_repository, 'blob/develop/src/doc/en/constructions', '{filename}'),
'source_edit_link': os.path.join(source_repository, 'edit/develop/src/doc/en/constructions', '{filename}'),
})

# General information about the project.
Expand Down
5 changes: 3 additions & 2 deletions src/doc/en/developer/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@
# contains common paths.
html_static_path = [] + html_common_static_path

# Add a small edit button.
# Add small view/edit buttons.
html_theme_options.update({
'source_edit_link': os.path.join(source_repository, 'blob/develop/src/doc/en/developer', '{filename}'),
'source_view_link': os.path.join(source_repository, 'blob/develop/src/doc/en/developer', '{filename}'),
'source_edit_link': os.path.join(source_repository, 'edit/develop/src/doc/en/developer', '{filename}'),
})

# General information about the project.
Expand Down
5 changes: 3 additions & 2 deletions src/doc/en/faq/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@
# contains common paths.
html_static_path = [] + html_common_static_path

# Add a small edit button.
# Add small view/edit buttons.
html_theme_options.update({
'source_edit_link': os.path.join(source_repository, 'blob/develop/src/doc/en/faq', '{filename}'),
'source_view_link': os.path.join(source_repository, 'blob/develop/src/doc/en/faq', '{filename}'),
'source_edit_link': os.path.join(source_repository, 'edit/develop/src/doc/en/faq', '{filename}'),
})

# General information about the project.
Expand Down
5 changes: 3 additions & 2 deletions src/doc/en/installation/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@
# contains common paths.
html_static_path = [] + html_common_static_path

# Add a small edit button.
# Add small view/edit buttons.
html_theme_options.update({
'source_edit_link': os.path.join(source_repository, 'blob/develop/src/doc/en/installation', '{filename}'),
'source_view_link': os.path.join(source_repository, 'blob/develop/src/doc/en/installation', '{filename}'),
'source_edit_link': os.path.join(source_repository, 'edit/develop/src/doc/en/installation', '{filename}'),
})

# General information about the project.
Expand Down
5 changes: 3 additions & 2 deletions src/doc/en/prep/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@
# contains common paths.
html_static_path = [] + html_common_static_path

# Add a small edit button.
# Add small view/edit buttons.
html_theme_options.update({
'source_edit_link': os.path.join(source_repository, 'blob/develop/src/doc/en/prep', '{filename}'),
'source_view_link': os.path.join(source_repository, 'blob/develop/src/doc/en/prep', '{filename}'),
'source_edit_link': os.path.join(source_repository, 'edit/develop/src/doc/en/prep', '{filename}'),
})

# General information about the project.
Expand Down
5 changes: 3 additions & 2 deletions src/doc/en/reference/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@
ref_src = os.path.join(SAGE_DOC_SRC, 'en', 'reference')
ref_out = os.path.join(SAGE_DOC, 'html', 'en', 'reference')

# Add a small edit button.
# Add small view/edit buttons.
html_theme_options.update({
'source_edit_link': os.path.join(source_repository, 'blob/develop/src/doc/en/reference/index.rst'),
'source_view_link': os.path.join(source_repository, 'blob/develop/src/doc/en/reference/index.rst'),
'source_edit_link': os.path.join(source_repository, 'edit/develop/src/doc/en/reference/index.rst'),
})

# General information about the project.
Expand Down
5 changes: 3 additions & 2 deletions src/doc/en/reference/conf_sub.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,10 @@
title = name.capitalize()
title = title.replace('`', '$')

# We use the directory's name to add a small edit button.
# We use the directory's name to add small view/edit buttons.
html_theme_options.update({
'source_edit_link': os.path.join(source_repository, f'blob/develop/src/doc/en/reference/{name}', '{filename}'),
'source_view_link': os.path.join(source_repository, f'blob/develop/src/doc/en/reference/{name}', '{filename}'),
'source_edit_link': os.path.join(source_repository, f'edit/develop/src/doc/en/reference/{name}', '{filename}'),
})

# General information about the project.
Expand Down
5 changes: 3 additions & 2 deletions src/doc/en/thematic_tutorials/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@
# contains common paths.
html_static_path = [] + html_common_static_path

# Add a small edit button.
# Add small view/edit buttons.
html_theme_options.update({
'source_edit_link': os.path.join(source_repository, 'blob/develop/src/doc/en/thematic_tutorials', '{filename}'),
'source_view_link': os.path.join(source_repository, 'blob/develop/src/doc/en/thematic_tutorials', '{filename}'),
'source_edit_link': os.path.join(source_repository, 'edit/develop/src/doc/en/thematic_tutorials', '{filename}'),
})

# General information about the project.
Expand Down
5 changes: 3 additions & 2 deletions src/doc/en/tutorial/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@
# contains common paths.
html_static_path = [] + html_common_static_path

# Add a small edit button.
# Add small view/edit buttons.
html_theme_options.update({
'source_edit_link': os.path.join(source_repository, 'blob/develop/src/doc/en/tutorial', '{filename}'),
'source_view_link': os.path.join(source_repository, 'blob/develop/src/doc/en/tutorial', '{filename}'),
'source_edit_link': os.path.join(source_repository, 'edit/develop/src/doc/en/tutorial', '{filename}'),
})

# General information about the project.
Expand Down
5 changes: 3 additions & 2 deletions src/doc/es/a_tour_of_sage/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@
# contains common paths.
html_static_path = [] + html_common_static_path

# Add a small edit button.
# Add small view/edit buttons.
html_theme_options.update({
'source_edit_link': os.path.join(source_repository, 'blob/develop/src/doc/es/a_tour_of_sage', '{filename}'),
'source_view_link': os.path.join(source_repository, 'blob/develop/src/doc/es/a_tour_of_sage', '{filename}'),
'source_edit_link': os.path.join(source_repository, 'edit/develop/src/doc/es/a_tour_of_sage', '{filename}'),
})

# General information about the project.
Expand Down
5 changes: 3 additions & 2 deletions src/doc/es/tutorial/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@
# contains common paths.
html_static_path = [] + html_common_static_path

# Add a small edit button.
# Add small view/edit buttons.
html_theme_options.update({
'source_edit_link': os.path.join(source_repository, 'blob/develop/src/doc/es/tutorial', '{filename}'),
'source_view_link': os.path.join(source_repository, 'blob/develop/src/doc/es/tutorial', '{filename}'),
'source_edit_link': os.path.join(source_repository, 'edit/develop/src/doc/es/tutorial', '{filename}'),
})

# General information about the project.
Expand Down
5 changes: 3 additions & 2 deletions src/doc/fr/a_tour_of_sage/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@
# contains common paths.
html_static_path = [] + html_common_static_path

# Add a small edit button.
# Add small view/edit buttons.
html_theme_options.update({
'source_edit_link': os.path.join(source_repository, 'blob/develop/src/doc/fr/a_tour_of_sage', '{filename}'),
'source_view_link': os.path.join(source_repository, 'blob/develop/src/doc/fr/a_tour_of_sage', '{filename}'),
'source_edit_link': os.path.join(source_repository, 'edit/develop/src/doc/fr/a_tour_of_sage', '{filename}'),
})

# General information about the project.
Expand Down
5 changes: 3 additions & 2 deletions src/doc/fr/tutorial/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@
# contains common paths.
html_static_path = [] + html_common_static_path

# Add a small edit button.
# Add small view/edit buttons.
html_theme_options.update({
'source_edit_link': os.path.join(source_repository, 'blob/develop/src/doc/fr/tutorial', '{filename}'),
'source_view_link': os.path.join(source_repository, 'blob/develop/src/doc/fr/tutorial', '{filename}'),
'source_edit_link': os.path.join(source_repository, 'edit/develop/src/doc/fr/tutorial', '{filename}'),
})

# General information about the project.
Expand Down
5 changes: 3 additions & 2 deletions src/doc/hu/a_tour_of_sage/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@
# contains common paths.
html_static_path = [] + html_common_static_path

# Add a small edit button.
# Add small view/edit buttons.
html_theme_options.update({
'source_edit_link': os.path.join(source_repository, 'blob/develop/src/doc/hu/a_tour_of_sage', '{filename}'),
'source_view_link': os.path.join(source_repository, 'blob/develop/src/doc/hu/a_tour_of_sage', '{filename}'),
'source_edit_link': os.path.join(source_repository, 'edit/develop/src/doc/hu/a_tour_of_sage', '{filename}'),
})

# General information about the project.
Expand Down
5 changes: 3 additions & 2 deletions src/doc/it/a_tour_of_sage/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@
# contains common paths.
html_static_path = [] + html_common_static_path

# Add a small edit button.
# Add small view/edit buttons.
html_theme_options.update({
'source_edit_link': os.path.join(source_repository, 'blob/develop/src/doc/it/a_tour_of_sage', '{filename}'),
'source_view_link': os.path.join(source_repository, 'blob/develop/src/doc/it/a_tour_of_sage', '{filename}'),
'source_edit_link': os.path.join(source_repository, 'edit/develop/src/doc/it/a_tour_of_sage', '{filename}'),
})

# General information about the project.
Expand Down
5 changes: 3 additions & 2 deletions src/doc/it/faq/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@
# contains common paths.
html_static_path = [] + html_common_static_path

# Add a small edit button.
# Add small view/edit buttons.
html_theme_options.update({
'source_edit_link': os.path.join(source_repository, 'blob/develop/src/doc/it/faq', '{filename}'),
'source_view_link': os.path.join(source_repository, 'blob/develop/src/doc/it/faq', '{filename}'),
'source_edit_link': os.path.join(source_repository, 'edit/develop/src/doc/it/faq', '{filename}'),
})

# General information about the project.
Expand Down
5 changes: 3 additions & 2 deletions src/doc/it/tutorial/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@
# contains common paths.
html_static_path = [] + html_common_static_path

# Add a small edit button.
# Add small view/edit buttons.
html_theme_options.update({
'source_edit_link': os.path.join(source_repository, 'blob/develop/src/doc/it/tutorial', '{filename}'),
'source_view_link': os.path.join(source_repository, 'blob/develop/src/doc/it/tutorial', '{filename}'),
'source_edit_link': os.path.join(source_repository, 'edit/develop/src/doc/it/tutorial', '{filename}'),
})

# General information about the project.
Expand Down
5 changes: 3 additions & 2 deletions src/doc/ja/a_tour_of_sage/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@
# contains common paths.
html_static_path = [] + html_common_static_path

# Add a small edit button.
# Add small view/edit buttons.
html_theme_options.update({
'source_edit_link': os.path.join(source_repository, 'blob/develop/src/doc/ja/a_tour_of_sage', '{filename}'),
'source_view_link': os.path.join(source_repository, 'blob/develop/src/doc/ja/a_tour_of_sage', '{filename}'),
'source_edit_link': os.path.join(source_repository, 'edit/develop/src/doc/ja/a_tour_of_sage', '{filename}'),
})

# General information about the project.
Expand Down
5 changes: 3 additions & 2 deletions src/doc/ja/tutorial/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@
# contains common paths.
html_static_path = [] + html_common_static_path

# Add a small edit button.
# Add small view/edit buttons.
html_theme_options.update({
'source_edit_link': os.path.join(source_repository, 'blob/develop/src/doc/ja/tutorial', '{filename}'),
'source_view_link': os.path.join(source_repository, 'blob/develop/src/doc/ja/tutorial', '{filename}'),
'source_edit_link': os.path.join(source_repository, 'edit/develop/src/doc/ja/tutorial', '{filename}'),
})

# General information about the project.
Expand Down
5 changes: 3 additions & 2 deletions src/doc/pt/a_tour_of_sage/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@
# contains common paths.
html_static_path = [] + html_common_static_path

# Add a small edit button.
# Add small view/edit buttons.
html_theme_options.update({
'source_edit_link': os.path.join(source_repository, 'blob/develop/src/doc/pt/a_tour_of_sage', '{filename}'),
'source_view_link': os.path.join(source_repository, 'blob/develop/src/doc/pt/a_tour_of_sage', '{filename}'),
'source_edit_link': os.path.join(source_repository, 'edit/develop/src/doc/pt/a_tour_of_sage', '{filename}'),
})

# General information about the project.
Expand Down
5 changes: 3 additions & 2 deletions src/doc/pt/tutorial/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@
# contains common paths.
html_static_path = [] + html_common_static_path

# Add a small edit button.
# Add small view/edit buttons.
html_theme_options.update({
'source_edit_link': os.path.join(source_repository, 'blob/develop/src/doc/pt/tutorial', '{filename}'),
'source_view_link': os.path.join(source_repository, 'blob/develop/src/doc/pt/tutorial', '{filename}'),
'source_edit_link': os.path.join(source_repository, 'edit/develop/src/doc/pt/tutorial', '{filename}'),
})

# General information about the project.
Expand Down
5 changes: 3 additions & 2 deletions src/doc/ru/tutorial/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@
# contains common paths.
html_static_path = [] + html_common_static_path

# Add a small edit button.
# Add small view/edit buttons.
html_theme_options.update({
'source_edit_link': os.path.join(source_repository, 'blob/develop/src/doc/ru/tutorial', '{filename}'),
'source_view_link': os.path.join(source_repository, 'blob/develop/src/doc/ru/tutorial', '{filename}'),
'source_edit_link': os.path.join(source_repository, 'edit/develop/src/doc/ru/tutorial', '{filename}'),
})

# General information about the project.
Expand Down
5 changes: 3 additions & 2 deletions src/doc/tr/a_tour_of_sage/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@
# contains common paths.
html_static_path = [] + html_common_static_path

# Add a small edit button.
# Add small view/edit buttons.
html_theme_options.update({
'source_edit_link': os.path.join(source_repository, f'blob/develop/src/doc/tr/a_tour_of_sage', '{filename}'),
'source_view_link': os.path.join(source_repository, f'blob/develop/src/doc/tr/a_tour_of_sage', '{filename}'),
'source_edit_link': os.path.join(source_repository, f'edit/develop/src/doc/tr/a_tour_of_sage', '{filename}'),
})

# General information about the project.
Expand Down
7 changes: 4 additions & 3 deletions src/sage_docbuild/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -694,16 +694,17 @@ def add_page_context(app, pagename, templatename, context, doctree):
context['reference_root'] = os.path.join(relpath, 'index.html')
context['refsub'] = True
if pagename.startswith('sage/'):
# This is for adding small edit button using Furo's feature:
# https://pradyunsg.me/furo/customisation/edit-button/#adding-an-edit-button
# This is for adding small view/edit buttons using Furo's feature:
# https://pradyunsg.me/furo/customisation/top-of-page-buttons/
# This works well if the source file is '.rst' file. But the '.rst'
# files in the directory 'sage/' are generated by the Sphinx
# autodoc from the Python or Cython source files. Hence we tweak
# here template context variables so that links to the correct
# source files are generated.
suffix = '.py' if importlib.import_module(pagename.replace('/','.')).__file__.endswith('.py') else '.pyx'
context['page_source_suffix'] = suffix
context['theme_source_edit_link'] = os.path.join(source_repository, f'blob/develop/src', '{filename}')
context['theme_source_view_link'] = os.path.join(source_repository, f'blob/develop/src', '{filename}')
context['theme_source_edit_link'] = os.path.join(source_repository, f'edit/develop/src', '{filename}')


dangling_debug = False
Expand Down

0 comments on commit f7b64b2

Please sign in to comment.