Skip to content

Commit

Permalink
Aggregate cli command (0.3.3)
Browse files Browse the repository at this point in the history
Allows to generate an aggregated version of the documentation with the
documentation of all repositories, either symbolic or monolithic.

Signed-off-by: Jorge Marques <jorge.marques@analog.com>
  • Loading branch information
gastmaier committed Feb 9, 2024
1 parent 62fc828 commit 858b1b9
Show file tree
Hide file tree
Showing 10 changed files with 476 additions and 23 deletions.
3 changes: 3 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
include adi_doctools/miscellaneous/*.js
include adi_doctools/miscellaneous/*.svg
include adi_doctools/miscellaneous/*.css
include adi_doctools/miscellaneous/sphinx-template/conf.py
include adi_doctools/miscellaneous/sphinx-template/Makefile
include adi_doctools/miscellaneous/sphinx-template/index.rst
include adi_doctools/theme/cosmic/static/*.umd.js
include adi_doctools/theme/cosmic/static/*.js.map
include adi_doctools/theme/cosmic/static/*.min.css
Expand Down
22 changes: 15 additions & 7 deletions adi_doctools/__init__.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
import os

from .theme import navigation_tree, get_pygments_theme, write_pygments_css, wrap_elements
from .theme import (navigation_tree, get_pygments_theme,
write_pygments_css, wrap_elements)
from .theme import setup as theme_setup, names as theme_names
from .directive import setup as directive_setup
from .role import setup as role_setup

__version__ = "0.3.2"
__version__ = "0.3.3"

dft_is_system_top = False


def get_navigation_tree(context, repo):
# The navigation tree, generated from the sphinx-provided ToC tree.
if "toctree" in context:
Expand All @@ -24,8 +26,11 @@ def get_navigation_tree(context, repo):

return navigation_tree(toctree_html, context['content_root'], repo)


def html_page_context(app, pagename, templatename, context, doctree):
context["sidebar_tree"], context["subdomain_tree"] = get_navigation_tree(context, app.env.config.repository);
ret = get_navigation_tree(context, app.env.config.repository)
context["sidebar_tree"], context["subdomain_tree"] = ret


def builder_inited(app):
if app.builder.format == 'html':
Expand All @@ -35,16 +40,17 @@ def builder_inited(app):
# Add bundled JavaScript if current theme is from this extension.
if app.env.config.html_theme in theme_names:
app.add_js_file("app.umd.js", priority=500, defer="")
app.config.values["html_permalinks_icon"] = ("#", *app.config.values["html_permalinks_icon"][1:])
builder = app.builder
conf_ = ("#", *app.config.values["html_permalinks_icon"][1:])
app.config.values["html_permalinks_icon"] = conf_
get_pygments_theme(app)
else:
app.add_css_file("third-party.css", priority=500, defer="")


def build_finished(app, exc):
"""
Injects assets.
It's a last resort solution, prefer adding the files to the theme static folder,
It's the last resort, prefer adding the files to the theme static folder,
since they are auto copied to _assets by sphinx.
It is used for:
* Add the Author Mode's pooling mode's JavaScript.
Expand All @@ -54,7 +60,8 @@ def build_finished(app, exc):
def copy_asset(app, uri):
from sphinx.util.fileutil import copy_asset_file

src_uri = os.path.join(os.path.dirname(__file__), f"miscellaneous/{uri}")
src_uri = os.path.join(os.path.dirname(__file__),
f"miscellaneous/{uri}")
build_uri = os.path.join(app.builder.outdir, '_static', uri)
copy_asset_file(src_uri, build_uri)

Expand All @@ -69,6 +76,7 @@ def copy_asset(app, uri):

copy_asset(app, "esd-warning.svg")


def setup(app):
for setup in theme_setup:
setup(app)
Expand Down
4 changes: 3 additions & 1 deletion adi_doctools/cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from .author_mode import author_mode
from .hdl_render import hdl_render
from .aggregate import aggregate

@click.group()
def entry_point():
Expand All @@ -12,7 +13,8 @@ def entry_point():

commands = [
author_mode,
hdl_render
hdl_render,
aggregate
]

for cmd in commands:
Expand Down
Loading

0 comments on commit 858b1b9

Please sign in to comment.