From 50951dc9c109eac53ca5f90ed2880558512c3fe5 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Sun, 7 Jul 2024 23:03:02 +0800 Subject: [PATCH] doc: Add menu links to the sidebar --- README.rst | 5 +++-- docs/_templates/layout.html | 17 +++++++++++++++++ docs/conf.py | 25 ++++++++++++++++++++++++- 3 files changed, 44 insertions(+), 3 deletions(-) create mode 100644 docs/_templates/layout.html diff --git a/README.rst b/README.rst index b564f4e9..5cd9ca78 100644 --- a/README.rst +++ b/README.rst @@ -15,7 +15,6 @@ .. image:: https://zenodo.org/badge/23509035.svg :target: https://zenodo.org/badge/latestdoi/23509035 -.. placeholder-for-doc-index `NIED Hi-net `__ | `Source Code `__ | @@ -24,6 +23,8 @@ ---- +.. placeholder-for-doc-index + `HinetPy `_ is a Python package for accessing and processing seismic data from `NIED Hi-net `__. @@ -91,7 +92,7 @@ following ways: A formal paper is published on `The Journal of Open Source Software `__ since HinetPy v0.9.0. This is the **preferred** way for citation. - Tian, D. (2024). HinetPy: A Python package for accessing and processing NIED Hi-net seismic data. + Tian, D. (2024). HinetPy: A Python package for accessing and processing NIED Hi-net seismic data. Journal of Open Source Software, 9(98), 6840. https://doi.org/10.21105/joss.06840 **Cite a specific HinetPy version** diff --git a/docs/_templates/layout.html b/docs/_templates/layout.html new file mode 100644 index 00000000..a81ce7d9 --- /dev/null +++ b/docs/_templates/layout.html @@ -0,0 +1,17 @@ +{# Import the theme's layout. #} +{% extends "!layout.html" %} + +{% block menu %} + {{ super() }} + + {% if menu_links %} +

+ Links +

+
    + {% for text, link in menu_links %} +
  • {{ text }}
  • + {% endfor %} +
+ {% endif %} +{% endblock %} diff --git a/docs/conf.py b/docs/conf.py index 9b4236d5..15dfb909 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -63,6 +63,27 @@ # so a file named "default.css" will overwrite the builtin "default.css". # html_static_path = ['_static'] +html_context = { + "menu_links": [ + ( + ' Source Code', + "https://github.com/seisman/HinetPy", + ), + ( + ' NIED Hi-net', + "https://www.hinet.bosai.go.jp/", + ), + ( + ' Documentation', + "https://seisman.github.io/HinetPy/", + ), + ( + ' 中文文档', + "https://seisman.github.io/HinetPy/zh_CN/", + ) + ] +} + # autodoc options autodoc_member_order = "bysource" autoclass_content = "both" @@ -72,7 +93,9 @@ napoleon_use_admonition_for_references = True # intersphinx configurations -intersphinx_mapping = {"https://docs.python.org/3/": None} +intersphinx_mapping = { + "python": ("https://docs.python.org/3/", None) +} # Chinese translation locale_dirs = ["locale/"] # path is example but recommended.