Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ build/
# vale configs and intermediary data
.github/styles/*
!.github/styles/config
/.venv
.DS_Store
50 changes: 30 additions & 20 deletions _templates/layout.html
Original file line number Diff line number Diff line change
@@ -1,24 +1,34 @@
{% extends "!layout.html" %}
{%- block extrahead %}
<script src="https://www.ti.com/assets/js/headerfooter/analytics.js" type="text/javascript" charset="utf-8"></script>
{{ super() }}
{%- block extrahead %}
<script src="https://www.ti.com/assets/js/headerfooter/analytics.js" type="text/javascript" charset="utf-8"></script>
{{ super() }}
{% endblock %}
{%- block sidebartitle %}
{# the logo helper function was removed in Sphinx 6 and deprecated since Sphinx 4 #}
{# the master_doc variable was renamed to root_doc in Sphinx 4 (master_doc still exists in later Sphinx versions) #}
{%- set _logo_url = logo_url|default(pathto('_static/' + (logo or ""), 1)) %}
{%- set _root_doc = root_doc|default(master_doc) %}
<a href="{{ pathto(_root_doc) }}"{% if not theme_logo_only %} class="icon icon-home"{% endif %}>
{% if not theme_logo_only %}{{ project }}{% endif %}
{%- if logo or logo_url %}
<img src="{{ _logo_url }}" class="logo" alt="{{ _('Logo') }}"/>
{%- endif %}
</a>
{%- set nav_version = version %}
{%- if nav_version %}
<div class="version">
{{ nav_version }}
</div>
{# the logo helper function was removed in Sphinx 6 and deprecated since Sphinx 4 #}
{# the master_doc variable was renamed to root_doc in Sphinx 4 (master_doc still exists in later Sphinx versions) #}
{%- set _logo_url = logo_url|default(pathto('_static/' + (logo or ""), 1)) %}
{%- set _root_doc = root_doc|default(master_doc) %}
<a href="{{ pathto(_root_doc) }}" {% if not theme_logo_only %} class="icon icon-home" {% endif %}>
{% if not theme_logo_only %}{{ project }}{% endif %}
{%- if logo or logo_url %}
<img src="{{ _logo_url }}" class="logo" alt="{{ _('Logo') }}" />
{%- endif %}
{%- include "searchbox.html" %}
{% endblock %}
</a>
{%- set nav_version = version %}
{%- if nav_version and versions %}
<div class="version">
<select id="version-selector"
onchange="location.href = location.href.replace(/\/docs\/[^\/]+\//, '/docs/' + this.value + '/');"
style="background-color: white; color: black; border: 1px solid #d9d9d9; padding: 5px; border-radius: 3px;">
{% for v in versions %}
<option value="{{ v }}" {% if v==nav_version %}selected{% endif %}>{{ v }}</option>
{% endfor %}
</select>
</div>
{%- elif nav_version %}
<div class="version">
{{ nav_version }}
</div>
{%- endif %}
{%- include "searchbox.html" %}
{% endblock %}
27 changes: 27 additions & 0 deletions conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import sys
import os
import importlib
import subprocess
from datetime import datetime

# If extensions (or modules to document with autodoc) are in another directory,
Expand Down Expand Up @@ -204,8 +205,34 @@
"github_repo": "processor-sdk-doc",
"github_version": "master",
"conf_py_path": "/source/",
"versions": [],
}

def get_versions():
versions = ["master"]
try:
cmd = ["git", "ls-remote", "--tags", "--heads", "https://github.com/TexasInstruments/processor-sdk-doc"]
output = subprocess.check_output(cmd).decode('utf-8').splitlines()
tags = []
for line in output:
parts = line.split()
if len(parts) == 2:
ref = parts[1]
if ref.startswith("refs/tags/"):
tag = ref.replace("refs/tags/", "")
tags.append(tag)

# Sort tags descending
tags.sort(reverse=True)
versions.extend(tags)
except Exception as e:
print(f"Error fetching versions: {e}")
# Fallback
versions = ["master"]
return versions

html_context["versions"] = get_versions()

# -- Options for LaTeX output ---------------------------------------------

latex_elements = {
Expand Down
Loading