Fix title fallback when the CLI passes title=None - #64
Open
jiacheng-fu wants to merge 1 commit into
Open
Conversation
The peakrdl html CLI defines --title with a default of None and always forwards it to HTMLExporter.export(), so the exporter's kwargs.pop fallback never fired and generated pages rendered a literal "None" as the page and sidebar title. Treat an explicit title=None the same as an omitted title: fall back to "<top node name> Reference". An explicit --title still overrides. Fixes SystemRDL#63
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #63
Problem
The
peakrdl htmlCLI defines--titlewithdefault=Noneand always forwardstitle=options.titleintoHTMLExporter.export(). The exporter's fallback useskwargs.pop("title", <default>), which only fires when the kwarg is absent — so the explicitNonewins and generated pages render a literalNone:Fix
Treat an explicit
title=Nonethe same as an omittedtitleand fall back to"<top node name> Reference". Fixing it in the exporter rather than the CLI plugin covers every API caller that passesNone, and matches the docstring, which describestitleas an optional override. An explicit--title/title=still wins, and an empty string is still respected as-is.The docstring now states the fallback value.
Verification
On
example/turboencabulator.rdl:peakrdl html turboencabulator.rdl -o out<title>None</title><title>Turbo-Encabulator Reference</title>peakrdl html turboencabulator.rdl -o out --title Custom<title>Custom</title><title>Custom</title>pylint --rcfile test/pylint.rcis clean andmypyreports no new issues relative tomain.Note:
footeron the line above has the same latent pattern (kwargs.popwith a computed default), though the CLI never forwards it, so it isn't user-visible today. Happy to apply the same treatment in this PR if you'd like.