doc: use substitutions to replace all current harcoded SDK versions
This creates a set of substitution rules to replace all current usages of SDK versions in the documentation, apart from a few that were not meant to be copy-pastable anyway and the version has just been swapped with a <version> placeholder. Since code-block does not parse the content, these have all been replaced with parsed-literal. That one though parses URLs, which cannot be broken, so a series of URL substitutions are provided too. Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
This commit is contained in:
parent
53f01807f6
commit
24cf2f6548
3 changed files with 67 additions and 54 deletions
20
doc/conf.py
20
doc/conf.py
|
@ -66,6 +66,10 @@ with open(ZEPHYR_BASE / "VERSION") as f:
|
|||
|
||||
release = version
|
||||
|
||||
# parse SDK version from 'SDK_VERSION' file
|
||||
with open(ZEPHYR_BASE / "SDK_VERSION") as f:
|
||||
sdk_version = f.read().strip()
|
||||
|
||||
# -- General configuration ------------------------------------------------
|
||||
|
||||
extensions = [
|
||||
|
@ -131,8 +135,22 @@ nitpick_ignore = [
|
|||
("c:identifier", "va_list"),
|
||||
]
|
||||
|
||||
rst_epilog = """
|
||||
SDK_URL_BASE="https://github.com/zephyrproject-rtos/sdk-ng/releases/download"
|
||||
|
||||
rst_epilog = f"""
|
||||
.. include:: /substitutions.txt
|
||||
|
||||
.. |sdk-version-literal| replace:: ``{sdk_version}``
|
||||
.. |sdk-version-trim| unicode:: {sdk_version}
|
||||
:trim:
|
||||
.. |sdk-version-ltrim| unicode:: {sdk_version}
|
||||
:ltrim:
|
||||
.. _Zephyr SDK bundle: https://github.com/zephyrproject-rtos/sdk-ng/releases/tag/v{sdk_version}
|
||||
.. |sdk-url-linux| replace:: `{SDK_URL_BASE}/v{sdk_version}/zephyr-sdk-{sdk_version}_linux-x86_64.tar.xz`
|
||||
.. |sdk-url-linux-sha| replace:: `{SDK_URL_BASE}/v{sdk_version}/sha256.sum`
|
||||
.. |sdk-url-macos| replace:: `{SDK_URL_BASE}/v{sdk_version}/zephyr-sdk-{sdk_version}_macos-x86_64.tar.xz`
|
||||
.. |sdk-url-macos-sha| replace:: `{SDK_URL_BASE}/v{sdk_version}/sha256.sum`
|
||||
.. |sdk-url-windows| replace:: `{SDK_URL_BASE}/v{sdk_version}/zephyr-sdk-{sdk_version}_windows-x86_64.7z`
|
||||
"""
|
||||
|
||||
# -- Options for HTML output ----------------------------------------------
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue