diff --git a/CHANGELOG.md b/CHANGELOG.md index 750c92ee..700c9fdf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,35 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and [Pydantic's HISTORY.md](https://github.com/pydantic/pydantic/blob/main/HISTORY.md), and this project *mostly* adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## `1!0.1.0a20` + +### Added + +* New Jinja template filter: `hexdoc_smart_var` + * Can be used to allow runtime variable lookups based on values in `props.template.args`. This is currently used by the [custom navbar links](https://hexdoc.hexxy.media/docs/guides/template/#navbar) feature. + +### Changed + +* A GitHub link is now added to the navbar by default (fixes [#26](https://github.com/hexdoc-dev/hexdoc/issues/26)). See the [docs](https://hexdoc.hexxy.media/docs/guides/template/#navbar) for more info. + +### Fixed + +* Fix the root-level redirect not being generated in cases where there are no versioned books and no book exists for the default branch. +* Fix crash on startup by adding a dependency exclusion for Pydantic v2.9.0 (see [pydantic/pydantic#10345](https://github.com/pydantic/pydantic/issues/10345)). + +## `1!0.1.0a19` + +### Added + +* Allow adding custom links to the web book navbar ([docs](https://hexdoc.hexxy.media/docs/guides/template)). + +## `1!0.1.0a18` + +### Fixed + +* Add missing handler for nested list styles (`$(li2)`, `$(li3)`, etc). +* Fix book links to other extension books on 1.19 and below (also fixes [#75](https://github.com/hexdoc-dev/hexdoc/issues/75)) + ## `1!0.1.0a17` ### Fixed diff --git a/noxfile.py b/noxfile.py index 86b73cb1..24df2c1b 100644 --- a/noxfile.py +++ b/noxfile.py @@ -282,7 +282,7 @@ def dummy_setup(session: nox.Session): "categories/foo.json": { "name": "Dummy Category", "icon": "minecraft:amethyst_shard", - "description": "Foo bar baz qux quux corge grault garply waldo fred plugh xyzzy thud", + "description": "Foo bar baz qux$(br)$(li)quux$(br)$(li2)corge$(br)$(li3)grault$(br)$(li4)garply$(li)waldo$(br)fred plugh xyzzy thud", "sortnum": 0, }, "entries/bar.json": { @@ -510,6 +510,19 @@ def dummy_setup(session: nox.Session): mod_name = "Dummy" author = "author" show_landing_text = true + + [template.args.navbar] + left = [ + { text="Left", href="https://google.ca" }, + ] + center = [ + { text="Center 1", href="https://google.ca", external=false }, + { text="Center 2", href="https://google.ca", external=false, icon="box-arrow-down-right" }, + ] + right = [ + { text="Right", href="https://google.ca", icon="box-arrow-up-left" }, + { text="GitHub", href.variable="source_url" }, + ] """ ), "nodemon.json": { diff --git a/pyproject.toml b/pyproject.toml index 36910ce9..ddc6102c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -49,7 +49,7 @@ dependencies = [ "packaging~=23.2", "pluggy~=1.3", "pydantic_settings~=2.0", - "pydantic>=2.7.1,<3", + "pydantic>=2.7.1,<3,!=2.9.0", "pygithub~=2.1", "pyjson5~=1.6", "requests~=2.31", @@ -75,6 +75,7 @@ test = [ "pyright==1.1.361", "pytest~=7.4", "pytest-dependency~=0.5", + "pytest-describe~=2.2", "syrupy~=4.6", "copier_template_tester", "pyyaml-include<2", # https://github.com/copier-org/copier/issues/1568 diff --git a/src/hexdoc/_hooks.py b/src/hexdoc/_hooks.py index a43ff5ab..5ba32816 100644 --- a/src/hexdoc/_hooks.py +++ b/src/hexdoc/_hooks.py @@ -97,7 +97,7 @@ def default_rendered_templates_v2( templates: DefaultRenderedTemplates = {} for category in book.categories.values(): - templates[redirect_path(category.raw_link)] = ( + templates[redirect_path(category.redirect_path)] = ( "redirects/category.html.jinja", { "category": category, @@ -106,7 +106,7 @@ def default_rendered_templates_v2( ) for entry in category.entries.values(): - templates[redirect_path(entry.raw_link)] = ( + templates[redirect_path(entry.redirect_path)] = ( "redirects/entry.html.jinja", { "category": category, @@ -116,7 +116,7 @@ def default_rendered_templates_v2( ) for page in entry.pages: - page_path = page.raw_link_path(entry.raw_link) + page_path = page.redirect_path(entry.redirect_path) if page_path is not None: templates[redirect_path(page_path)] = ( "redirects/page.html.jinja", diff --git a/src/hexdoc/_templates/components/navbar.html.jinja b/src/hexdoc/_templates/components/navbar.html.jinja index f29e0e3e..2ff8a91d 100644 --- a/src/hexdoc/_templates/components/navbar.html.jinja +++ b/src/hexdoc/_templates/components/navbar.html.jinja @@ -1,6 +1,7 @@ +{% import "macros/formatting.html.jinja" as fmt with context -%} +