2022-11-15 05:55:22 -06:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
import sys
|
|
|
|
import os
|
|
|
|
|
|
|
|
project = 'YosysHQ Yosys'
|
|
|
|
author = 'YosysHQ GmbH'
|
2024-05-07 08:35:25 -05:00
|
|
|
copyright ='2024 YosysHQ GmbH'
|
2024-10-09 01:08:00 -05:00
|
|
|
yosys_ver = "0.46"
|
2022-11-15 05:55:22 -06:00
|
|
|
|
|
|
|
# select HTML theme
|
2023-08-02 16:20:29 -05:00
|
|
|
html_theme = 'furo'
|
|
|
|
templates_path = ["_templates"]
|
2023-10-09 16:12:50 -05:00
|
|
|
html_logo = '_static/logo.png'
|
|
|
|
html_favicon = '_static/favico.png'
|
2022-11-15 05:55:22 -06:00
|
|
|
html_css_files = ['yosyshq.css', 'custom.css']
|
2023-08-02 16:20:29 -05:00
|
|
|
|
|
|
|
html_theme_options = {
|
|
|
|
"sidebar_hide_name": True,
|
|
|
|
|
|
|
|
"light_css_variables": {
|
|
|
|
"color-brand-primary": "#d6368f",
|
|
|
|
"color-brand-content": "#4b72b8",
|
|
|
|
"color-api-name": "#8857a3",
|
|
|
|
"color-api-pre-name": "#4b72b8",
|
|
|
|
"color-link": "#8857a3",
|
|
|
|
},
|
|
|
|
|
|
|
|
"dark_css_variables": {
|
|
|
|
"color-brand-primary": "#e488bb",
|
|
|
|
"color-brand-content": "#98bdff",
|
|
|
|
"color-api-name": "#8857a3",
|
|
|
|
"color-api-pre-name": "#4b72b8",
|
|
|
|
"color-link": "#be95d5",
|
|
|
|
},
|
|
|
|
}
|
2022-11-15 05:55:22 -06:00
|
|
|
|
|
|
|
# These folders are copied to the documentation's HTML output
|
2023-10-09 16:12:50 -05:00
|
|
|
html_static_path = ['_static', "_images"]
|
2022-11-15 05:55:22 -06:00
|
|
|
|
|
|
|
# code blocks style
|
|
|
|
pygments_style = 'colorful'
|
|
|
|
highlight_language = 'none'
|
|
|
|
|
2024-05-02 19:55:08 -05:00
|
|
|
# default single quotes to attempt auto reference, or fallback to code
|
|
|
|
default_role = 'autoref'
|
|
|
|
|
2024-08-22 17:06:32 -05:00
|
|
|
extensions = ['sphinx.ext.autosectionlabel', 'sphinxcontrib.bibtex']
|
|
|
|
|
|
|
|
if os.getenv("READTHEDOCS"):
|
|
|
|
# Use rtds_action if we are building on read the docs and have a github token env var
|
|
|
|
if os.getenv("GITHUB_TOKEN"):
|
|
|
|
extensions += ['rtds_action']
|
|
|
|
rtds_action_github_repo = "YosysHQ/yosys"
|
|
|
|
rtds_action_path = "."
|
|
|
|
rtds_action_artifact_prefix = "cmd-ref-"
|
|
|
|
rtds_action_github_token = os.environ["GITHUB_TOKEN"]
|
|
|
|
else:
|
|
|
|
# We're on read the docs but have no github token, this is probably a PR preview build
|
|
|
|
html_theme_options["announcement"] = 'Missing content? Check <a class="reference internal" href="https://tyrtd--2.org.readthedocs.build/en/2/appendix/building_docs.html#pr-previews-and-limitations">PR preview limitations</a>.'
|
|
|
|
html_theme_options["light_css_variables"]["color-announcement-background"] = "var(--color-admonition-title-background--caution)"
|
|
|
|
html_theme_options["light_css_variables"]["color-announcement-text"] = "var(--color-content-foreground)"
|
2022-11-15 05:55:22 -06:00
|
|
|
|
|
|
|
# Ensure that autosectionlabel will produce unique names
|
|
|
|
autosectionlabel_prefix_document = True
|
|
|
|
autosectionlabel_maxdepth = 1
|
|
|
|
|
2024-08-28 17:43:01 -05:00
|
|
|
# include todos for previews
|
|
|
|
extensions.append('sphinx.ext.todo')
|
|
|
|
|
2024-05-07 08:35:25 -05:00
|
|
|
# set version
|
2024-08-26 17:21:31 -05:00
|
|
|
if os.getenv("READTHEDOCS"):
|
|
|
|
rtds_version = os.getenv("READTHEDOCS_VERSION")
|
|
|
|
if rtds_version == "latest":
|
|
|
|
release = yosys_ver + "-dev"
|
2024-08-28 17:43:01 -05:00
|
|
|
todo_include_todos = False
|
2024-09-03 05:28:25 -05:00
|
|
|
elif rtds_version.startswith("docs"):
|
2024-08-26 17:21:31 -05:00
|
|
|
release = rtds_version
|
2024-08-28 17:43:01 -05:00
|
|
|
todo_include_todos = True
|
2024-09-03 05:28:25 -05:00
|
|
|
else:
|
|
|
|
release = yosys_ver
|
|
|
|
todo_include_todos = False
|
2024-05-07 08:35:25 -05:00
|
|
|
else:
|
|
|
|
release = yosys_ver
|
2024-08-28 17:43:01 -05:00
|
|
|
todo_include_todos = True
|
2024-05-07 08:35:25 -05:00
|
|
|
|
2022-11-15 05:55:22 -06:00
|
|
|
# assign figure numbers
|
|
|
|
numfig = True
|
|
|
|
|
|
|
|
bibtex_bibfiles = ['literature.bib']
|
|
|
|
latex_elements = {
|
2024-05-07 08:55:52 -05:00
|
|
|
'releasename': 'Version',
|
2022-11-15 05:55:22 -06:00
|
|
|
'preamble': r'''
|
|
|
|
\usepackage{lmodern}
|
|
|
|
\usepackage{comment}
|
|
|
|
|
|
|
|
'''
|
|
|
|
}
|
|
|
|
|
2023-08-07 18:51:57 -05:00
|
|
|
# custom cmd-ref parsing/linking
|
|
|
|
sys.path += [os.path.dirname(__file__) + "/../"]
|
|
|
|
extensions.append('util.cmdref')
|
|
|
|
|
2022-11-15 05:55:22 -06:00
|
|
|
def setup(sphinx):
|
2023-08-07 18:51:57 -05:00
|
|
|
from util.RtlilLexer import RtlilLexer
|
2022-11-15 05:55:22 -06:00
|
|
|
sphinx.add_lexer("RTLIL", RtlilLexer)
|
|
|
|
|
2023-08-07 18:51:57 -05:00
|
|
|
from util.YoscryptLexer import YoscryptLexer
|
2022-11-15 05:55:22 -06:00
|
|
|
sphinx.add_lexer("yoscrypt", YoscryptLexer)
|