Skip to content

Commit

Permalink
added comment to imports
Browse files Browse the repository at this point in the history
  • Loading branch information
epinzur committed Oct 10, 2023
1 parent c2e8315 commit 51dc489
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions python/docs/_scripts/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down Expand Up @@ -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()}")
Expand All @@ -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
Expand Down Expand Up @@ -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()},
Expand Down

0 comments on commit 51dc489

Please sign in to comment.