Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
alexxu-amd committed Nov 22, 2024
2 parents 28ca39c + db84f2c commit d17296a
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/rocm_docs/data/projects.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ projects:
rocgdb:
target: https://rocm.docs.amd.com/projects/ROCgdb/en/${version}
development_branch: amd-staging
rocjpeg: https://rocm.docs.amd.com/projects/rocJPEG/en/${version}
rocm: https://rocm.docs.amd.com/en/${version}
rocm-docs-core: https://rocm.docs.amd.com/projects/rocm-docs-core/en/${version}
rocm-install-on-linux:
Expand All @@ -88,9 +89,15 @@ projects:
rocprofiler:
target: https://rocm.docs.amd.com/projects/rocprofiler/en/${version}
development_branch: amd-master
rocprofiler-compute:
target: https://rocm.docs.amd.com/projects/rocprofiler-compute/en/${version}
development_branch: amd-staging
rocprofiler-sdk:
target: https://rocm.docs.amd.com/projects/rocprofiler-sdk/en/${version}
development_branch: amd-mainline
rocprofiler-systems:
target: https://rocm.docs.amd.com/projects/rocprofiler-systems/en/${version}
development_branch: amd-staging
rocpydecode: https://rocm.docs.amd.com/projects/rocPyDecode/en/${version}
rocrand: https://rocm.docs.amd.com/projects/rocRAND/en/${version}
rocr-runtime:
Expand Down
5 changes: 5 additions & 0 deletions src/rocm_docs/rocm_docs_theme/flavors/generic/footer.jinja
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{% macro license_link() -%}
{% if theme_license_link %}
<li><a href="{{ theme_license_link }}">{{ theme_license_text if theme_license_text else "" }}</a></li>
{% endif %}
{%- endmacro -%}
28 changes: 28 additions & 0 deletions src/rocm_docs/rocm_docs_theme/flavors/generic/header.jinja
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{% macro top_level_header(branch, latest_version, release_candidate_version) -%}
{% if theme_header_title %}
{% set header_title = theme_header_title %}
{% else %}
{% set header_title = project ~ " " ~ version %}
{% endif %}

{% if theme_header_link %}
{% set header_link = theme_header_link %}
{% else %}
{% set header_link = "#" %}
{% endif %}

<a class="klavika-font hover-opacity" href="{{ header_link }}">{{ header_title }}</a>
{%- endmacro -%}

{% macro version_list() -%}
{% if theme_version_list_link %}
<a class="header-all-versions" href="{{ theme_version_list_link }}">Version List</a>
{% endif %}
{%- endmacro -%}

{%
set nav_secondary_items = theme_nav_secondary_items if theme_nav_secondary_items else {
"GitHub": theme_repository_url if theme_repository_url else "#",
"Support": (theme_repository_url + "/issues/new/choose") if theme_repository_url else "#"
}
%}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{%
set main_doc_link = theme_main_doc_link if theme_main_doc_link else (project, "#")
%}
8 changes: 8 additions & 0 deletions src/rocm_docs/rocm_docs_theme/theme.conf
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,11 @@ show_toc_level = 1
flavor = rocm

link_main_doc = True

# Generic theme options
header_title =
header_link =
version_list_link =
nav_secondary_items =
license_link =
license_text =
17 changes: 17 additions & 0 deletions src/rocm_docs/theme.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,15 @@ def _update_theme_options(app: Sphinx) -> None:
flavor = supported_flavors[0]
theme_opts["flavor"] = flavor

# Set default generic theme options
if flavor == "generic":
theme_opts.setdefault("header_title", "")
theme_opts.setdefault("header_link", "#")
theme_opts.setdefault("version_list_link", None)
theme_opts.setdefault("nav_secondary_items", {})
theme_opts.setdefault("license_link", None)
theme_opts.setdefault("license_text", "")

theme_opts.setdefault(
"article_header_start",
["components/toggle-primary-sidebar.html", "breadcrumbs.html"],
Expand Down Expand Up @@ -186,6 +195,14 @@ def setup(app: Sphinx) -> dict[str, Any]:
app.connect("html-page-context", _add_custom_context)
app.connect("builder-inited", _update_theme_options)

# Add theme option declarations
app.add_config_value("header_title", "", "html")
app.add_config_value("header_link", "#", "html")
app.add_config_value("version_list_link", None, "html")
app.add_config_value("nav_secondary_items", {}, "html", [dict])
app.add_config_value("license_link", None, "html")
app.add_config_value("license_text", "", "html")

return {
"parallel_read_safe": True,
"parallel_write_safe": True,
Expand Down

0 comments on commit d17296a

Please sign in to comment.