Info Site Publishing

Module: thornforge.buildsite.info_site

Overview

The info-site helpers publish an optional info/ subtree as the root portion of the generated static site. Text-like files are rendered into wrapped HTML, HTML files are wrapped with shared navigation, and assets are copied through.

Autodoc

thornforge.buildsite.info_site.copy_info_site(repo_root: Path, output_dir: Path) bool

Publish the optional info/ subtree into the final site.

Parameters:
  • repo_root – Repository root that may contain an info/ directory.

  • output_dir – Site root where rendered and copied info files should be written.

Returns:

True when info/ existed and was processed, otherwise False.

Raises:
  • NotADirectoryError – If repo_root / "info" exists but is not a directory.

  • ValueError – If two input files map to the same output path or if an input file conflicts with reserved site paths such as docs/.

thornforge.buildsite.info_site.info_output_relative_path(info_dir: Path, source_path: Path) Path

Translate one info/ source file into its published relative path.

Parameters:
  • info_dir – Root info/ directory.

  • source_path – File path beneath info_dir.

Returns:

Relative output path under the final site. Text-like sources gain an .html suffix because they are rendered into HTML pages.

thornforge.buildsite.info_site.inject_nav_into_html(source_path: Path, destination: Path, root_prefix: str, current_path: str) None

Wrap an existing HTML document with ThornForge’s shared layout shell.

Parameters:
  • source_path – Input HTML file whose content should be wrapped.

  • destination – Output HTML path to write.

  • root_prefix – Relative prefix from the destination page back to the site root.

  • current_path – Site-relative output path used by the shared navigation.

Returns:

None. The wrapped document is written to destination.

thornforge.buildsite.info_site.iter_info_files(info_dir: Path) Iterable[Path]

Yield files from info/ in deterministic order.

Parameters:

info_dir – Root info/ directory to scan recursively.

Yields:

File paths under info_dir sorted lexicographically.

thornforge.buildsite.info_site.render_plain_text_info_page(source_path: Path, destination: Path, root_prefix: str, current_path: str) None

Render a plain-text info/ file into a wrapped HTML page.

Parameters:
  • source_path – Input text file to display.

  • destination – Output HTML path to write.

  • root_prefix – Relative prefix from the destination page back to the site root.

  • current_path – Site-relative output path used by the shared navigation.

Returns:

None. The wrapped HTML page is written to destination.

thornforge.buildsite.info_site.render_rst_info_page(source_path: Path, destination: Path, root_prefix: str, current_path: str) None

Render one reStructuredText info/ file into wrapped HTML.

Parameters:
  • source_path – Input .rst file to render.

  • destination – Output HTML path to write.

  • root_prefix – Relative prefix from the destination page back to the site root, used for shared asset links.

  • current_path – Site-relative path for the destination page, used by the navigation placeholder.

Side Effects:

Writes the rendered and wrapped HTML page to destination.

Returns:

None.

thornforge.buildsite.info_site.root_prefix_for_output(output_relative_path: Path) str

Return the relative prefix needed to address site-root assets.

Parameters:

output_relative_path – Page path relative to the site root.

Returns:

Empty string for root pages or a repeated ../ prefix that navigates from the page’s parent directory back to the site root.