Skip to content

Commit 6f23e38

Browse files
authored
Revert PRs 5 and 6 (omec-project#87)
Signed-off-by: Arrobo, Gabriel <gabriel.arrobo@intel.com>
1 parent d4c69dc commit 6f23e38

File tree

8 files changed

+95
-379
lines changed

8 files changed

+95
-379
lines changed

Makefile

Lines changed: 5 additions & 113 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# SPDX-FileCopyrightText: 2026 Intel Corporation
21
# SPDX-FileCopyrightText: 2021 Open Networking Foundation <info@opennetworking.org>
32
# SPDX-License-Identifier: Apache-2.0
43

@@ -16,19 +15,7 @@ BUILDDIR ?= _build
1615
# name of python virtualenv that is used to run commands
1716
VENV_NAME := venv-docs
1817

19-
# Git repository information for versioning
20-
GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD 2>/dev/null || echo "unknown")
21-
GIT_TAG := $(shell git describe --tags --exact-match 2>/dev/null || echo "")
22-
VERSION_TAGS := $(shell git tag --sort=-version:refname | head -3)
23-
24-
# Temporary directory for git worktrees
25-
WORKTREE_DIR := $(BUILDDIR)/worktrees
26-
27-
# Use variable for file location
28-
VERSION_INDEX_TEMPLATE = _templates/version_index.html
29-
30-
.PHONY: help Makefile test doc8 dict-check sort-dict license clean clean-all \
31-
multiversion add-nojekyll create-version-index version-info clean-worktrees
18+
.PHONY: help Makefile test doc8 dict-check sort-dict license clean clean-all
3219

3320
# Put it first so that "make" without argument is like "make help".
3421
help: $(VENV_NAME)
@@ -71,106 +58,11 @@ clean:
7158
clean-all: clean
7259
rm -rf $(VENV_NAME)
7360

74-
# Clean up git worktrees
75-
clean-worktrees:
76-
@echo "Cleaning up git worktrees..."
77-
@if [ -d "$(WORKTREE_DIR)" ]; then \
78-
for worktree in $(WORKTREE_DIR)/*; do \
79-
if [ -d "$$worktree" ]; then \
80-
echo "Removing worktree: $$worktree" ;\
81-
git worktree remove "$$worktree" 2>/dev/null || rm -rf "$$worktree" ;\
82-
fi ;\
83-
done ;\
84-
rmdir "$(WORKTREE_DIR)" 2>/dev/null || true ;\
85-
fi
86-
87-
# Ensure .nojekyll file exists for GitHub Pages
88-
add-nojekyll:
89-
@echo "Adding .nojekyll file for GitHub Pages..."
90-
@if [ -d "$(BUILDDIR)/html" ]; then \
91-
touch "$(BUILDDIR)/html/.nojekyll"; \
92-
echo "Created .nojekyll in $(BUILDDIR)/html/"; \
93-
fi
94-
@if [ -d "$(BUILDDIR)/multiversion" ]; then \
95-
touch "$(BUILDDIR)/multiversion/.nojekyll"; \
96-
echo "Created .nojekyll in $(BUILDDIR)/multiversion/"; \
97-
fi
98-
99-
# Build single version (current branch/tag)
100-
build: $(VENV_NAME) Makefile
101-
source $</bin/activate ; set -u ;\
102-
$(SPHINXBUILD) -b html "$(SOURCEDIR)" "$(BUILDDIR)/html" $(SPHINXOPTS)
103-
$(MAKE) add-nojekyll
104-
@echo "Documentation built successfully!"
105-
@echo "Open $(BUILDDIR)/html/index.html in your browser"
106-
107-
# Build multiple versions
108-
multiversion: $(VENV_NAME) Makefile clean-worktrees
109-
@echo "Building multi-version documentation..."
110-
@echo "Current branch: $(GIT_BRANCH)"
111-
@echo "Available tags: $(VERSION_TAGS)"
112-
rm -rf "$(BUILDDIR)/multiversion"
113-
mkdir -p "$(BUILDDIR)/multiversion"
114-
mkdir -p "$(WORKTREE_DIR)"
115-
@echo "Building latest version from current working directory..."
61+
# build multiple versions
62+
multiversion: $(VENV_NAME) Makefile
11663
source $</bin/activate ; set -u ;\
117-
$(SPHINXBUILD) -b html "$(SOURCEDIR)" "$(BUILDDIR)/multiversion/latest" $(SPHINXOPTS)
118-
@if [ -n "$(VERSION_TAGS)" ]; then \
119-
for tag in $(VERSION_TAGS); do \
120-
echo "Building documentation for tag: $$tag using git worktree..." ;\
121-
worktree_path="$(WORKTREE_DIR)/$$tag" ;\
122-
if git worktree add "$$worktree_path" "$$tag" 2>/dev/null; then \
123-
echo "Created worktree for $$tag at $$worktree_path" ;\
124-
source $</bin/activate ; set -u ;\
125-
$(SPHINXBUILD) -b html "$$worktree_path" "$(BUILDDIR)/multiversion/$$tag" $(SPHINXOPTS) || echo "Warning: Failed to build $$tag" ;\
126-
git worktree remove "$$worktree_path" 2>/dev/null || echo "Warning: Failed to remove worktree $$worktree_path" ;\
127-
else \
128-
echo "Warning: Could not create worktree for tag $$tag" ;\
129-
fi ;\
130-
done ;\
131-
else \
132-
echo "No version tags found, building only latest version" ;\
133-
fi
134-
$(MAKE) create-version-index
135-
$(MAKE) add-nojekyll
136-
$(MAKE) clean-worktrees
137-
@echo "Multi-version documentation built successfully!"
138-
@echo "Open $(BUILDDIR)/multiversion/index.html in your browser"
139-
140-
# Create version selection index page
141-
create-version-index:
142-
@echo "Creating version index page..."
143-
@mkdir -p "$(BUILDDIR)/multiversion"
144-
@if [ ! -f "$(VERSION_INDEX_TEMPLATE)" ]; then \
145-
echo "Error: Template file $(VERSION_INDEX_TEMPLATE) not found"; \
146-
exit 1; \
147-
fi
148-
@cp "$(VERSION_INDEX_TEMPLATE)" "$(BUILDDIR)/multiversion/index.html"
149-
@if [ -n "$(VERSION_TAGS)" ]; then \
150-
version_cards="" ;\
151-
for tag in $(VERSION_TAGS); do \
152-
version_cards="$$version_cards <a href=\"$$tag/\" class=\"version-card\">"$$'\n' ;\
153-
version_cards="$$version_cards <div class=\"version-title\">$$tag</div>"$$'\n' ;\
154-
version_cards="$$version_cards <div class=\"version-desc\">Release $$tag documentation</div>"$$'\n' ;\
155-
version_cards="$$version_cards </a>"$$'\n' ;\
156-
done ;\
157-
sed -i.bak "s|{{VERSION_CARDS}}|$$version_cards|g" "$(BUILDDIR)/multiversion/index.html" ;\
158-
rm -f "$(BUILDDIR)/multiversion/index.html.bak" ;\
159-
else \
160-
sed -i.bak "s|{{VERSION_CARDS}}||g" "$(BUILDDIR)/multiversion/index.html" ;\
161-
rm -f "$(BUILDDIR)/multiversion/index.html.bak" ;\
162-
fi
163-
164-
# Show current version information
165-
version-info:
166-
@echo "=== Version Information ==="
167-
@echo "Git Branch: $(GIT_BRANCH)"
168-
@echo "Git Tag: $(GIT_TAG)"
169-
@echo "Recent Tags: $(VERSION_TAGS)"
170-
@if [ -f "VERSION" ]; then echo "Version File: $$(cat VERSION)"; fi
171-
@echo "Build Directory: $(BUILDDIR)"
172-
@echo "Worktree Directory: $(WORKTREE_DIR)"
173-
@echo "=========================="
64+
sphinx-multiversion "$(SOURCEDIR)" "$(BUILDDIR)/multiversion" $(SPHINXOPTS)
65+
cp "$(SOURCEDIR)/_templates/meta_refresh.html" "$(BUILDDIR)/multiversion/index.html"
17466

17567
# Catch-all target: route all unknown targets to Sphinx using the new
17668
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).

_static/css/furo_custom.css

Lines changed: 0 additions & 62 deletions
This file was deleted.

_static/css/rtd_theme_mods.css

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/*
2+
* SPDX-FileCopyrightText: 2021 Open Networking Foundation <info@opennetworking.org>
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
/* Don't restrict content width on the RTD theme
7+
* from: https://stackoverflow.com/a/32898444 */
8+
9+
.wy-nav-content {
10+
max-width: none;
11+
}
12+
13+
.wy-table-responsive table td, .wy-table-responsive table th {
14+
white-space: normal;
15+
}
16+
17+
.wy-side-nav-search {
18+
background-color: #d9d9d9;
19+
}
20+
21+
.wy-side-nav-search>div.version {
22+
color: #404040;
23+
}

_templates/meta_refresh.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<!--
22
SPDX-FileCopyrightText: © 2020 Open Networking Foundation <support@opennetworking.org>
33
SPDX-License-Identifier: Apache-2.0
4-
-->
4+
--!>
55
<html><head>
66
<meta charset="UTF-8">
77
<meta http-equiv="refresh" content="0;url=main/index.html" />

_templates/version_index.html

Lines changed: 0 additions & 115 deletions
This file was deleted.

_templates/versions.html

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<!--
2+
SPDX-FileCopyrightText: © 2020 Open Networking Foundation <support@opennetworking.org>
3+
SPDX-License-Identifier: Apache-2.0
4+
--!>
5+
{%- if current_version %}
6+
<div class="rst-versions" data-toggle="rst-versions" role="note" aria-label="versions">
7+
<span class="rst-current-version" data-toggle="rst-current-version">
8+
<span class="fa fa-book"> Other Versions</span>
9+
v: {{ current_version.name }}
10+
<span class="fa fa-caret-down"></span>
11+
</span>
12+
<div class="rst-other-versions">
13+
{%- if versions.tags %}
14+
<dl>
15+
<dt>Tags</dt>
16+
{%- for item in versions.tags %}
17+
<dd><a href="{{ item.url }}">{{ item.name }}</a></dd>
18+
{%- endfor %}
19+
</dl>
20+
{%- endif %}
21+
{%- if versions.branches %}
22+
<dl>
23+
<dt>Branches</dt>
24+
{%- for item in versions.branches %}
25+
<dd><a href="{{ item.url }}">{{ item.name }}</a></dd>
26+
{%- endfor %}
27+
</dl>
28+
{%- endif %}
29+
</div>
30+
</div>
31+
{%- endif %}

0 commit comments

Comments
 (0)