Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
31349e1fa7 | ||
|
|
12d2008a1e |
No files matched your search
@@ -0,0 +1,20 @@
|
||||
version: 2
|
||||
build:
|
||||
os: ubuntu-24.04
|
||||
tools:
|
||||
python: "3.13"
|
||||
jobs:
|
||||
build:
|
||||
html:
|
||||
- uv run --no-project --with-requirements .github/docs/requirements.txt sphinx-build -W --keep-going -b html -c .github/docs . "$READTHEDOCS_OUTPUT/html"
|
||||
submodules:
|
||||
include:
|
||||
- docs
|
||||
python:
|
||||
install:
|
||||
- method: uv
|
||||
command: pip
|
||||
requirements: .github/docs/requirements.txt
|
||||
sphinx:
|
||||
configuration: .github/docs/conf.py
|
||||
fail_on_warning: true
|
||||
@@ -0,0 +1,26 @@
|
||||
# Historical 0.2.4 documentation
|
||||
|
||||
This documentation-only branch starts at the immutable `v0.2.4` tag.
|
||||
The original README, application files, and pinned wiki (when present) remain unchanged.
|
||||
Sphinx reads them without installing or importing the historical application.
|
||||
The render-time adapter fixes historical link and heading syntax only; the visible warning
|
||||
explains that these old installation commands and external services may no longer work.
|
||||
|
||||
Prerequisites: [uv](https://docs.astral.sh/uv/getting-started/installation/) 0.11.3 and Python 3.13, matching CI and Read the Docs. `uv` can install Python when needed.
|
||||
|
||||
```sh
|
||||
git submodule update --init docs
|
||||
READTHEDOCS=True uv run --no-project --python 3.13 --with-requirements .github/docs/requirements.txt \
|
||||
sphinx-build -E -a -W --keep-going -b html -c .github/docs . /tmp/archivebox-historical-docs
|
||||
```
|
||||
|
||||
Read the Docs must use `.github/.readthedocs.yaml`. The pinned theme supplies
|
||||
its version selector and listens for Read the Docs addon version data.
|
||||
|
||||
`requirements.txt` pins the complete documentation dependency set. To update it,
|
||||
edit `requirements.in` and run:
|
||||
|
||||
```sh
|
||||
uv pip compile --universal --python-version 3.13 .github/docs/requirements.in \
|
||||
--output-file .github/docs/requirements.txt
|
||||
```
|
||||
@@ -0,0 +1,139 @@
|
||||
"""Render this release's historical documentation without importing the application."""
|
||||
|
||||
import os
|
||||
import re
|
||||
from pathlib import Path
|
||||
from urllib.parse import urlsplit
|
||||
|
||||
from markdown_it import MarkdownIt
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[2]
|
||||
release = "0.2.4"
|
||||
version = release
|
||||
project = "ArchiveBox"
|
||||
author = "ArchiveBox contributors"
|
||||
copyright = "ArchiveBox contributors"
|
||||
extensions = ["myst_parser", "sphinx_rtd_theme"]
|
||||
source_suffix = {".md": "markdown"}
|
||||
root_doc = "index"
|
||||
exclude_patterns = [
|
||||
p.name for p in ROOT.iterdir() if p.name not in {"index.md", "docs"}
|
||||
]
|
||||
exclude_patterns += ["docs/_Sidebar.md", "docs/_Footer.md", "docs/.git"]
|
||||
html_theme = "sphinx_rtd_theme"
|
||||
html_theme_options = {
|
||||
"navigation_depth": 3,
|
||||
"collapse_navigation": False,
|
||||
"version_selector": True,
|
||||
"language_selector": False,
|
||||
}
|
||||
html_context = {"current_version": os.environ.get("READTHEDOCS_VERSION", release)}
|
||||
html_title = f"ArchiveBox {release} historical documentation"
|
||||
html_show_sphinx = False
|
||||
myst_heading_anchors = 6
|
||||
|
||||
|
||||
def rewrite_prose(text, transform):
|
||||
"""Rewrite navigation outside fenced and indented code blocks."""
|
||||
lines = text.splitlines(keepends=True)
|
||||
output = []
|
||||
start = 0
|
||||
for token in MarkdownIt().parse(text):
|
||||
if token.type not in {"fence", "code_block"}:
|
||||
continue
|
||||
first, last = token.map
|
||||
output.append(transform("".join(lines[start:first])))
|
||||
output.append("".join(lines[first:last]))
|
||||
start = last
|
||||
output.append(transform("".join(lines[start:])))
|
||||
return "".join(output)
|
||||
|
||||
|
||||
def prepare_source(app, docname, source):
|
||||
text = (ROOT / "README.md").read_text() if docname == "index" else source[0]
|
||||
|
||||
def repair_prose(prose):
|
||||
prose = prose.replace("---\n---", "---")
|
||||
prose = prose.replace("#coookies_file", "#cookies_file")
|
||||
if docname == "docs/Home":
|
||||
prose = prose.replace("](#configuration)", "](Configuration.md)")
|
||||
if docname == "docs/Troubleshooting":
|
||||
prose = (
|
||||
prose.replace("#Dependencies", "#installing")
|
||||
.replace("#Archiving", "#archiving")
|
||||
.replace("#Hosting-the-Archive", "#hosting-the-archive")
|
||||
)
|
||||
return prose
|
||||
|
||||
text = rewrite_prose(text, repair_prose)
|
||||
directory = ROOT if docname == "index" else ROOT / "docs"
|
||||
|
||||
def wiki(match):
|
||||
parts = match.group(1).split("|", 1)
|
||||
return f"[{parts[0]}]({parts[-1].replace(' ', '-')}.md)"
|
||||
|
||||
text = rewrite_prose(text, lambda prose: re.sub(r"\[\[([^\]\n]+)\]\]", wiki, prose))
|
||||
|
||||
def resource(target):
|
||||
if urlsplit(target).scheme or target.startswith(("#", "//")):
|
||||
return target
|
||||
page, sep, anchor = target.partition("#")
|
||||
path = directory / page
|
||||
if path.suffix == ".md" and path.parent == ROOT / "docs":
|
||||
return target
|
||||
if path.is_file():
|
||||
return (
|
||||
f"https://raw.githubusercontent.com/ArchiveBox/ArchiveBox/v{release}/{path.relative_to(ROOT)}"
|
||||
+ ("#" + anchor if sep else "")
|
||||
)
|
||||
return target
|
||||
|
||||
def rewrite_links(prose):
|
||||
prose = re.sub(
|
||||
r'((?:src|href)=["\'])([^"\']+)', lambda m: m[1] + resource(m[2]), prose
|
||||
)
|
||||
prose = re.sub(r"\]\(([^)\s]+)\)", lambda m: "](" + resource(m[1]) + ")", prose)
|
||||
return prose
|
||||
|
||||
text = rewrite_prose(text, rewrite_links)
|
||||
text = (
|
||||
f"# ArchiveBox {release}"
|
||||
+ (
|
||||
" historical guide"
|
||||
if docname == "index"
|
||||
else " — " + Path(docname).name.replace("-", " ")
|
||||
)
|
||||
+ "\n\n"
|
||||
+ text
|
||||
)
|
||||
lines = text.splitlines()
|
||||
stack = []
|
||||
for token in MarkdownIt().parse(text):
|
||||
if token.type != "heading_open":
|
||||
continue
|
||||
original = int(token.tag[1])
|
||||
while stack and stack[-1] >= original:
|
||||
stack.pop()
|
||||
stack.append(original)
|
||||
lines[token.map[0]] = re.sub(
|
||||
r"^#{1,6}(?=\s)", "#" * len(stack), lines[token.map[0]]
|
||||
)
|
||||
text = "\n".join(lines) + "\n"
|
||||
if docname == "index":
|
||||
notice = f"\n```{{warning}}\nThis is the original guide shipped with ArchiveBox {release}, preserved for historical reference. Commands, dependencies, and external services describe that old release and may no longer work. Use the version selector for current documentation.\n```\n"
|
||||
first, rest = text.split("\n", 1)
|
||||
text = first + "\n" + notice + rest
|
||||
pages = sorted(
|
||||
p.stem for p in (ROOT / "docs").glob("*.md") if not p.name.startswith("_")
|
||||
)
|
||||
if pages:
|
||||
text += (
|
||||
"\n```{toctree}\n:maxdepth: 2\n\n"
|
||||
+ "\n".join("docs/" + p for p in pages)
|
||||
+ "\n```\n"
|
||||
)
|
||||
source[0] = text
|
||||
|
||||
|
||||
def setup(app):
|
||||
app.connect("source-read", prepare_source)
|
||||
@@ -0,0 +1,3 @@
|
||||
Sphinx==8.2.3
|
||||
myst-parser==4.0.1
|
||||
sphinx-rtd-theme==3.1.0
|
||||
@@ -0,0 +1,75 @@
|
||||
# This file was autogenerated by uv via the following command:
|
||||
# uv pip compile --universal --python-version 3.13 .github/docs/requirements.in --output-file .github/docs/requirements.txt
|
||||
alabaster==1.0.0
|
||||
# via sphinx
|
||||
babel==2.18.0
|
||||
# via sphinx
|
||||
certifi==2026.7.22
|
||||
# via requests
|
||||
charset-normalizer==3.5.1
|
||||
# via requests
|
||||
colorama==0.4.6 ; sys_platform == 'win32'
|
||||
# via sphinx
|
||||
docutils==0.21.2
|
||||
# via
|
||||
# myst-parser
|
||||
# sphinx
|
||||
# sphinx-rtd-theme
|
||||
idna==3.20
|
||||
# via requests
|
||||
imagesize==2.0.1
|
||||
# via sphinx
|
||||
jinja2==3.1.6
|
||||
# via
|
||||
# myst-parser
|
||||
# sphinx
|
||||
markdown-it-py==3.0.0
|
||||
# via
|
||||
# mdit-py-plugins
|
||||
# myst-parser
|
||||
markupsafe==3.0.3
|
||||
# via jinja2
|
||||
mdit-py-plugins==0.6.1
|
||||
# via myst-parser
|
||||
mdurl==0.1.2
|
||||
# via markdown-it-py
|
||||
myst-parser==4.0.1
|
||||
# via -r .github/docs/requirements.in
|
||||
packaging==26.3
|
||||
# via sphinx
|
||||
pygments==2.21.0
|
||||
# via sphinx
|
||||
pyyaml==6.0.3
|
||||
# via myst-parser
|
||||
requests==2.34.2
|
||||
# via sphinx
|
||||
roman-numerals==4.1.0
|
||||
# via roman-numerals-py
|
||||
roman-numerals-py==4.1.0
|
||||
# via sphinx
|
||||
snowballstemmer==3.1.1
|
||||
# via sphinx
|
||||
sphinx==8.2.3
|
||||
# via
|
||||
# -r .github/docs/requirements.in
|
||||
# myst-parser
|
||||
# sphinx-rtd-theme
|
||||
# sphinxcontrib-jquery
|
||||
sphinx-rtd-theme==3.1.0
|
||||
# via -r .github/docs/requirements.in
|
||||
sphinxcontrib-applehelp==2.0.0
|
||||
# via sphinx
|
||||
sphinxcontrib-devhelp==2.0.0
|
||||
# via sphinx
|
||||
sphinxcontrib-htmlhelp==2.1.0
|
||||
# via sphinx
|
||||
sphinxcontrib-jquery==4.1
|
||||
# via sphinx-rtd-theme
|
||||
sphinxcontrib-jsmath==1.0.1
|
||||
# via sphinx
|
||||
sphinxcontrib-qthelp==2.0.0
|
||||
# via sphinx
|
||||
sphinxcontrib-serializinghtml==2.0.0
|
||||
# via sphinx
|
||||
urllib3==2.8.0
|
||||
# via requests
|
||||
Reference in new issue
Block a user