Skip to content

fix: preserve literal < and > in playlist script output - #1343

Open
mvanhorn wants to merge 1 commit into
fooyin:masterfrom
mvanhorn:fix/1224-literal-angle-brackets
Open

fix: preserve literal < and > in playlist script output#1343
mvanhorn wants to merge 1 commit into
fooyin:masterfrom
mvanhorn:fix/1224-literal-angle-brackets

Conversation

@mvanhorn

Copy link
Copy Markdown
Contributor

Summary

Literal < and > characters now display in the playlist instead of being silently dropped. A title like <3 or a > b renders as written, with no need for the \< escape workaround.

Why this matters

The playlist runs script output through a second formatting pass, and ScriptFormatter treated every <...> sequence as a formatting tag (issue #1224). Unrecognised angle-bracket content was consumed and discarded. In src/gui/scripting/scriptformatter.cpp, formatBlock() now only enters tag processing when the text after < is a recognised formatter (via ScriptFormatterRegistry::isKnown) that closes with >; otherwise it emits the original <...> text verbatim. readTagContent() stops at a nested < so a literal < cannot swallow a following real tag, and angle detection checks the token value so the scanner keywords LESS/GREATER are not mistaken for bracket characters. Known tags with bad options still fall through to processFormat() and render their inner text.

Testing

Added cases to tests/gui/scriptformattertest.cpp covering literal brackets with spaces (a < b > c), I <3 this, an unknown tag kept literal (<notatag>rest), literal text mixed with real formatting (I <3 <b>this</b> and <b>I <3 this</b>), and the keyword words (<LESS>, 5 LESS than 6). Existing bold/italic/colour/link tests continue to assert no regression. The Qt6 toolchain is not installed in this environment, so the suite was not run here; clang-format passes on both files.

Fixes #1224

The rich-text formatting pass treated any <...> sequence as a format tag,
so unrecognised angle-bracket content (e.g. a title like <3 or a > b) was
consumed and dropped instead of rendered. formatBlock() now only enters
tag-processing for a recognised formatter whose name directly follows '<'
and which closes with '>'; otherwise it emits the original <...> text
verbatim.

Fixes fooyin#1224
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

some special characters can't be displayed

1 participant