diff --git a/README.md b/README.md index d46a69b..dcccab2 100644 --- a/README.md +++ b/README.md @@ -317,7 +317,6 @@ available: | `template` | `str \| none` = `none` | Template to use for this page. Relative to `templates/`, `.html` extension optional. | | `post` | `bool \| none` = `none` | Whether this page is a **post**. `true`/`false` is _absolute_. Leave it unset for automatic detection. | | `draft` | `bool` = `false` | Whether this page is a draft. See [drafts](#drafts) for more. | -| `ignore` | `bool` = `false` | Whether this page should be ignored in _both_ `final` and `draft` contexts. | | `math` | `bool` = `true` | Whether the LaTeX extension should be enabled for this page. | **Note**: you can specify the date in any format that can be parsed by diff --git a/pyproject.toml b/pyproject.toml index 2a2e6b4..caf20fb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -62,7 +62,7 @@ allowedUntypedLibraries = ["frontmatter", "pygments", "pymdownx", "l2m4m"] [tool.ruff] line-length = 70 indent-width = 4 -target-version = "py312" +target-version = "py311" [tool.ruff.lint] fixable = ["ALL"] diff --git a/src/zona/builder.py b/src/zona/builder.py index 446f07d..12b5458 100644 --- a/src/zona/builder.py +++ b/src/zona/builder.py @@ -53,7 +53,7 @@ class ZonaBuilder: ): logger.debug(f"Parsing {path.name}.") item.metadata, item.content = parse_metadata(path) - if item.metadata.ignore or ( + if ( item.metadata.draft and not self.config.build.include_drafts ): diff --git a/src/zona/cli.py b/src/zona/cli.py index 4b48d3a..a7e2dd5 100644 --- a/src/zona/cli.py +++ b/src/zona/cli.py @@ -59,9 +59,7 @@ def build( """ if draft: print("Option override: including drafts.") - builder = ZonaBuilder( - cli_root=root, cli_output=output, draft=draft - ) + builder = ZonaBuilder(cli_root=root, cli_output=output, draft=draft) builder.build() @@ -75,9 +73,7 @@ def serve( ] = None, host: Annotated[ str, - typer.Option( - "--host", help="Hostname for live preview server." - ), + typer.Option("--host", help="Hostname for live preview server."), ] = "localhost", port: Annotated[ int, diff --git a/src/zona/config.py b/src/zona/config.py index 2a50fd4..cc56ec2 100644 --- a/src/zona/config.py +++ b/src/zona/config.py @@ -76,9 +76,7 @@ IGNORELIST = [".marksman.toml"] class ZonaConfig: base_url: str = "/" # dictionary where key is name, value is url - sitemap: SitemapConfig = field( - default_factory=lambda: {"Home": "/"} - ) + sitemap: SitemapConfig = field(default_factory=lambda: {"Home": "/"}) # list of globs relative to content that should be ignored ignore: list[str] = field(default_factory=lambda: IGNORELIST) markdown: MarkdownConfig = field(default_factory=MarkdownConfig) diff --git a/src/zona/metadata.py b/src/zona/metadata.py index 0cd6a8c..b079266 100644 --- a/src/zona/metadata.py +++ b/src/zona/metadata.py @@ -24,7 +24,6 @@ class Metadata: template: str | None = None post: bool | None = None draft: bool = False - ignore: bool = False math: bool = True diff --git a/src/zona/server.py b/src/zona/server.py index 82e6381..23c4c0b 100644 --- a/src/zona/server.py +++ b/src/zona/server.py @@ -238,9 +238,7 @@ def serve( event_handler, path=str(root / "content"), recursive=True ) observer.schedule( - event_handler, - path=str(root / "templates"), - recursive=True, + event_handler, path=str(root / "templates"), recursive=True ) observer.start() diff --git a/src/zona/util.py b/src/zona/util.py index 9ccc2c6..2d5c514 100644 --- a/src/zona/util.py +++ b/src/zona/util.py @@ -19,9 +19,7 @@ def get_resource(path: str) -> ZonaResource: if file.is_file(): return ZonaResource(name=path, contents=file.read_text()) else: - raise FileNotFoundError( - f"{path} is not a valid Zona resource!" - ) + raise FileNotFoundError(f"{path} is not a valid Zona resource!") def get_resources(subdir: str) -> list[ZonaResource]: @@ -77,13 +75,10 @@ def normalize_url(url: str) -> str: return url -def should_ignore( - path: Path, patterns: list[str], base: Path -) -> bool: +def should_ignore(path: Path, patterns: list[str], base: Path) -> bool: rel_path = path.relative_to(base) return any( - fnmatch.fnmatch(str(rel_path), pattern) - for pattern in patterns + fnmatch.fnmatch(str(rel_path), pattern) for pattern in patterns )