Skip to content

Commit

Permalink
chore: logging
Browse files Browse the repository at this point in the history
  • Loading branch information
phil65 committed Sep 17, 2023
1 parent 743b534 commit acb3d3b
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions mknodes/plugin/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ def on_config(self, config: MkDocsConfig):
build_kwargs=self.config.kwargs,
clone_depth=self.config.clone_depth,
)
logger.info("Generating pages...")
self.build_info = self.project.build()

def on_files(self, files: Files, config: MkDocsConfig) -> Files:
Expand All @@ -80,24 +81,23 @@ def on_files(self, files: Files, config: MkDocsConfig) -> Files:
"""
if not self.config.build_fn:
return files
# First we gather all required information
logger.info("Generating pages...")
logger.info("Fetching requirements from tree...")

# now we add our stuff to the MkDocs build environment
logger.info("Setting up build backends...")
cfg = mkdocsconfig.Config(config)
mkdocs_backend = mkdocsbackend.MkDocsBackend(
files=files,
config=cfg,
directory=self.build_folder,
)

logger.info("Writing Markdown and assets to MkDocs environment...")
markdown_backend = markdownbackend.MarkdownBackend(
directory=cfg.site_dir / "src",
extension=".original",
)
self.backends = [mkdocs_backend, markdown_backend]

logger.info("Writing Markdown and assets to MkDocs environment...")
node_files: dict[str, str | bytes] = {}
extra_files: dict[str, str | bytes] = {}
iterator = self.project.theme.iter_nodes()
Expand All @@ -111,12 +111,14 @@ def on_files(self, files: Files, config: MkDocsConfig) -> Files:
path, md = node.resolved_file_path, node.to_markdown()
node_files[path] = md
case mknav.MkNav():
logger.info("Processing section %r...", node.section)
path, md = node.resolved_file_path, node.to_markdown()
node_files[path] = md
if node.metadata:
extra_files[node.metadata_file] = str(node.metadata)

build_files = node_files | extra_files
logger.info("Fetching requirements from tree...")
requirements = self.project.get_requirements()
for backend in self.backends:
backend.on_collect(build_files, requirements)
Expand Down

0 comments on commit acb3d3b

Please sign in to comment.