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
1 change: 1 addition & 0 deletions yardang/sphinx/llms.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ def get_target_uri(self, docname: str, typ: str | None = None) -> str:
return _target_uri(docname)

def finish(self) -> None:
super().finish()
docnames = list(self.env.collect_relations())
_write_sitemap(self.app, docnames)
_write_full_document(self.app, docnames)
Expand Down
16 changes: 16 additions & 0 deletions yardang/tests/test_llms.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
from pathlib import Path
from subprocess import Popen

from sphinx.cmd.build import build_main

from yardang.build import generate_docs_configuration
from yardang.cli import build

Expand Down Expand Up @@ -101,6 +103,20 @@ def test_full_build_can_be_disabled(tmp_path, monkeypatch):
assert "llms-full.txt" not in (output / "llms.txt").read_text()


def test_explicit_builder_copies_downloads(tmp_path, monkeypatch):
_write_project(tmp_path)
monkeypatch.chdir(tmp_path)
output = tmp_path / "llms"

with generate_docs_configuration() as conf_dir:
result = build_main(["-q", "-b", "yardang-llms", "-c", str(conf_dir), ".", str(output)])

assert result == 0
download = re.search(r"\]\(([^)]*_downloads/[^)]+)\)", (output / "index.html.md").read_text())
assert download is not None
assert (output / download.group(1)).is_file()


def test_llms_generation_is_disabled_by_default(tmp_path, monkeypatch):
(tmp_path / "pyproject.toml").write_text('[project]\nname = "test-project"\nversion = "1.0.0"\n\n[tool.yardang]\nuse-autoapi = false\n')
(tmp_path / "README.md").write_text("# Test Project\n")
Expand Down