Skip to content

Commit

Permalink
docs: split up stuff a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
phil65 committed Sep 15, 2023
1 parent 4f89eab commit 43b5d87
Show file tree
Hide file tree
Showing 6 changed files with 483 additions and 401 deletions.
4 changes: 4 additions & 0 deletions mknodes/manual/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
"""Module containing the documentation."""

from .nodes_section import create_nodes_section
from .navs_section import create_navs_section
from .cli_section import create_cli_section
from .internals_section import create_internals_section
from .dev_section import create_development_section
from .templating_section import create_templating_section
Expand All @@ -11,6 +13,8 @@

__all__ = [
"create_nodes_section",
"create_navs_section",
"create_cli_section",
"create_internals_section",
"create_templating_section",
"create_development_section",
Expand Down
57 changes: 57 additions & 0 deletions mknodes/manual/cli_section.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import mknodes as mk


INTRO_TEXT = """MkNodes offers a CLI interface in order to build projects based on
Callables. The CLI is closely aligned to the MkDocs CLI to simplify the usage.
MkNodes CLI is based on Typer and uses a RichHandler for log output.
There are 3 diffent commands right now:
- `mknodes build`: Closely aligned to `mkdocs build`, but with the option to point
to a (remote) repository as well as a Website template in form of a Python Callable.
- `mknodes serve`: Same as `mknodes build`, but for serving the page.
- `mknodes create-config`: Does a test run with given callable and repository and
creates a Config file based on the metadata and extension requirements provided
by the combination of Callable and repository.
"""

SECTION_CODE = "Code for this section"
PAGE_CODE = "Code for this page"

# this is the nav we will populate via decorators.
nav = mk.MkNav("CLI")


def create_cli_section(root_nav: mk.MkNav):
"""Create the "Development" sub-MkNav and attach it to given MkNav."""
# Now we will create the "Development" section.
# You might notice that this whole section does not contain any specific
# reference to mk. That is because all nodes containing metadata are
# dynamically populated depending on the project the tree is connected to.
# This means that this section could be imported by other packages and be
# used without any further adaptation.
root_nav += nav
page = nav.add_index_page(hide_toc=True, icon="octicons/command-palette-16")
page += mk.MkCode.for_object(create_cli_section, header=SECTION_CODE)
page += INTRO_TEXT


@nav.route.page("build", show_source=True, icon="wrench")
def create_build_page(page: mk.MkPage):
"""Create the "CLI" MkPage and attach it to given MkNav."""
page += mk.MkClickDoc("mknodes.cli:cli", prog_name="build")


@nav.route.page("serve", show_source=True, icon="web")
def create_changelog_page(page: mk.MkPage):
"""Create the "Changelog" MkPage and attach it to given MkNav."""
page += mk.MkClickDoc("mknodes.cli:cli", prog_name="serve")


@nav.route.page("create-config", show_source=True, icon="folder-wrench")
def create_coc_page(page: mk.MkPage):
"""Create the "Code of conduct" MkPage and attach it to given MkNav."""
page += mk.MkClickDoc("mknodes.cli:cli", prog_name="create-config")
Loading

0 comments on commit 43b5d87

Please sign in to comment.