diff --git a/python/docs/_scripts/builder.py b/python/docs/_scripts/builder.py index fe90a5855..57e03b08b 100644 --- a/python/docs/_scripts/builder.py +++ b/python/docs/_scripts/builder.py @@ -6,12 +6,17 @@ from typing import Any, Union from pydantic import ValidationError -from quartodoc import blueprint, collect, layout # , preview +from quartodoc import blueprint, collect, layout from quartodoc.inventory import convert_inventory, create_inventory from quartodoc.validation import fmt from renderer import Renderer from summarizer import Summarizer +# `preview()` can be used to help debug doc generation. +# use it on a `section` or `page` element to see a visual +# representation of the element contents. Use the `max_depth` +# named param to limit how much is returned to stdout. +# from quartodoc import preview _log = logging.getLogger("quartodoc") @@ -176,14 +181,16 @@ def write_pages(self): _log.info(f"Rendering {page.path}") # preview(page, max_depth=4) page_text = self.renderer.render(page) - page_path = location / (page.path + self.out_page_suffix) + page_path = location / \ + (page.path + self.out_page_suffix) self.write_page_if_not_exists(page_path, page_text) if page.path in self.page_map: del self.page_map[page.path] self.update_page_items(page, location, is_flat) else: - raise NotImplementedError(f"Unsupported section item: {type(page)}") + raise NotImplementedError( + f"Unsupported section item: {type(page)}") if len(self.page_map.keys()) > 0: _log.warning(f"Extra pages: {self.page_map.keys()}") @@ -207,7 +214,8 @@ def update_page_items(self, page: layout.Page, location: Path, is_flat: bool): ) self.update_items(doc, page_path) else: - raise NotImplementedError(f"Unsupported page item: {type(doc)}") + raise NotImplementedError( + f"Unsupported page item: {type(doc)}") def update_items(self, doc: layout.Doc, page_path: str): name = doc.obj.path @@ -285,7 +293,8 @@ def from_quarto_config(cls, quarto_cfg: "str | dict"): cfg = quarto_cfg.get("quartodoc") if cfg is None: - raise KeyError("No `quartodoc:` section found in your _quarto.yml.") + raise KeyError( + "No `quartodoc:` section found in your _quarto.yml.") return Builder( **{k: v for k, v in cfg.items()},