Skip to content
Merged
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
19 changes: 19 additions & 0 deletions doc/.sphinx/_integration/microcloud.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,51 @@
<ul class="p-navigation__links" role="menu">

<li class="active">
{% if pagename == "404" %}
<a class="p-logo" href="{{ nav404_prefix }}" aria-current="page">
{% else %}
<a class="p-logo" href="{{ pathto(root_doc) }}" aria-current="page">
{% endif %}
<img src="{{ pathto(product_tag,1) }}" alt="Logo" class="p-logo-image">
<div class="p-logo-text p-heading--4">{{ project }}
</div>
</a>
</li>

<li>
{% if pagename == "404" %}
<a class="p-logo" href="{{ nav404_prefix }}{{ lxd_path }}/" aria-current="page">
<img src="{{ nav404_prefix }}{{ lxd_tag }}" alt="Logo" class="p-logo-image">
{% else %}
<a class="p-logo" href="{{ pathto(root_doc) if pathto(root_doc) != '#' }}{{ lxd_path }}/" aria-current="page">
<img src="{{ pathto(root_doc) if pathto(root_doc) != '#' }}{{ lxd_tag }}" alt="Logo" class="p-logo-image">
{% endif %}
<div class="p-logo-text p-heading--4">LXD
</div>
</a>
</li>

<li>
{% if pagename == "404" %}
<a class="p-logo" href="{{ nav404_prefix }}{{ microceph_path }}/" aria-current="page">
<img src="{{ nav404_prefix }}{{ microceph_tag }}" alt="Logo" class="p-logo-image">
{% else %}
<a class="p-logo" href="{{ pathto(root_doc) if pathto(root_doc) != '#' }}{{ microceph_path }}/" aria-current="page">
<img src="{{ pathto(root_doc) if pathto(root_doc) != '#' }}{{ microceph_tag }}" alt="Logo" class="p-logo-image">
{% endif %}
<div class="p-logo-text p-heading--4">MicroCeph
</div>
</a>
</li>

<li>
{% if pagename == "404" %}
<a class="p-logo" href="{{ nav404_prefix }}{{ microovn_path }}/" aria-current="page">
<img src="{{ nav404_prefix }}{{ microovn_tag }}" alt="Logo" class="p-logo-image">
{% else %}
<a class="p-logo" href="{{ pathto(root_doc) if pathto(root_doc) != '#' }}{{ microovn_path }}/" aria-current="page">
<img src="{{ pathto(root_doc) if pathto(root_doc) != '#' }}{{ microovn_tag }}" alt="Logo" class="p-logo-image">
{% endif %}
<div class="p-logo-text p-heading--4">MicroOVN
</div>
</a>
Expand Down
22 changes: 22 additions & 0 deletions doc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,13 @@ VALE_DIR ?= $(DOCS_VENVDIR)/lib/python*/site-packages/vale
VALE_CONFIG ?= $(SPHINX_DIR)/vale.ini
PA11Y_CMD ?= $(SPHINX_DIR)/node_modules/pa11y/bin/pa11y.js --config $(SPHINX_DIR)/pa11y.json
CHECK_PATH ?= $(filter-out $(DOCS_VENVDIR),$(wildcard *))

# Integration setup
INTEGRATION_DIR ?= integration
# 404 page customization
LOCAL_404_FILE ?= $(DOCS_BUILDDIR)/404/index.html
RTD_404_FILE ?= $(READTHEDOCS_OUTPUT)/html/404/index.html
NAV_404_HREF ?= /microcloud/docs/$(or $(READTHEDOCS_VERSION),local)/

# Put it first so that "make" without argument is like "make help".
help:
Expand Down Expand Up @@ -135,6 +141,14 @@ html: integrate install
cd integration/microceph/docs/ && $(MAKE) html DOCS_BUILDDIR=$(current_dir)/_build/microceph
cd integration/microovn/docs/ && $(MAKE) html BUILDDIR=$(current_dir)/_build/microovn
. $(DOCS_VENV); $(SPHINX_BUILD) -W --keep-going -b dirhtml "$(DOCS_SOURCEDIR)" "$(current_dir)/_build" -w $(SPHINX_DIR)/warnings.txt $(SPHINX_OPTS)
@echo "Checking 404 page setup ..."
@grep -q '<a href="#"><div class="brand">' "$(LOCAL_404_FILE)" || \
{ echo "ERROR: brand pattern not found in $(LOCAL_404_FILE). Update the 404 page customization."; exit 1; }
@grep -q '<a class="sidebar-brand" href="#">' "$(LOCAL_404_FILE)" || \
{ echo "ERROR: sidebar-brand pattern not found in $(LOCAL_404_FILE). Update the 404 page customization."; exit 1; }
sed -e 's|<a href="#"><div class="brand">|<a href="$(NAV_404_HREF)"><div class="brand">|' \
-e 's|<a class="sidebar-brand" href="#">|<a class="sidebar-brand" href="$(NAV_404_HREF)">|' \
"$(LOCAL_404_FILE)" > "$(LOCAL_404_FILE).tmp" && mv "$(LOCAL_404_FILE).tmp" "$(LOCAL_404_FILE)"

# `html-rtd` builds the integrated docs, with the correct paths for Read the Docs.
# This target is used by the Read the Docs build.
Expand All @@ -143,6 +157,14 @@ html-rtd: install
PATH_PREFIX=$(PATH_PREFIX) $(MAKE) -C integration/microceph/docs/ html DOCS_BUILDDIR=$(READTHEDOCS_OUTPUT)/html/microceph
PATH_PREFIX=$(PATH_PREFIX) $(MAKE) -C integration/microovn/docs/ html BUILDDIR=$(READTHEDOCS_OUTPUT)/html/microovn
. $(DOCS_VENV); PATH_PREFIX=$(PATH_PREFIX) $(SPHINX_BUILD) -W --keep-going -b dirhtml "$(DOCS_SOURCEDIR)" "$(READTHEDOCS_OUTPUT)/html" -w $(SPHINX_DIR)/warnings.txt $(SPHINX_OPTS)
@echo "Checking 404 page setup ..."
@grep -q '<a href="#"><div class="brand">' "$(RTD_404_FILE)" || \
{ echo "ERROR: brand pattern not found in $(RTD_404_FILE). Update the 404 page customization."; exit 1; }
@grep -q '<a class="sidebar-brand" href="#">' "$(RTD_404_FILE)" || \
{ echo "ERROR: sidebar-brand pattern not found in $(RTD_404_FILE). Update the 404 page customization."; exit 1; }
sed -e 's|<a href="#"><div class="brand">|<a href="$(NAV_404_HREF)"><div class="brand">|' \
-e 's|<a class="sidebar-brand" href="#">|<a class="sidebar-brand" href="$(NAV_404_HREF)">|' \
"$(RTD_404_FILE)" > "$(RTD_404_FILE).tmp" && mv "$(RTD_404_FILE).tmp" "$(RTD_404_FILE)"

epub: install
. $(DOCS_VENV); $(SPHINX_BUILD) -b epub "$(DOCS_SOURCEDIR)" "$(DOCS_BUILDDIR)" -w $(SPHINX_DIR)/warnings.txt $(SPHINX_OPTS)
Expand Down
4 changes: 4 additions & 0 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import sys
from git import Repo
import re
from urllib.parse import urlparse

sys.path.append('./')
sys.path.append('.sphinx/')
Expand Down Expand Up @@ -72,6 +73,9 @@
'display_contributors': False,

'sequential_nav': 'both',

# Prefix for top navigation menu URLs on 404 pages
'nav404_prefix': urlparse(html_baseurl).path,
}

html_extra_path = ['_extra']
Expand Down
Loading