Fix/issue 83 localization parsing - #84
Merged
Merged
Conversation
…on bundle calls docs(helpers): document parse_swgoh_string and its extended tag grammar chore: add commitlint config and ignore .pythonrc.py fix(helpers): extend parse_swgoh_string to cover full NGUI tag set (#83)
Adds a TestParseSwgohStringIssue83Coverage class that exercises every tag and every color literal length called out in the issue across the output formats where they are renderable but were previously untested: - [t]/[/t] sprite, [y=X]/[/y] scale, [sub], [sub=X], [sup], [sup=X] in terminal/discord (must strip cleanly, no markup leakage) - 4-digit [RGBA] in bare and terminal (RGB channel emitted, alpha dropped) - 8-digit [RRGGBBAA] in bare, terminal, and web (web uses rgba() with the alpha channel converted to the 0-1 CSS float) - 1-digit [A] alpha-only literal in terminal (re-emits the prior RGB) - Standalone color literal in web with no enclosing [c] wrapper Adding the web standalone-color test surfaced a latent bug: the web finalizer never closed dangling spans/tags. _finalize_output now balances any open color span and unclosed bold/italic/underline/strike depth so strings that omit closing tags still produce well-formed HTML. Total localization tests: 89 (was 77).
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.
Description
Update tokenization of localization string parser to more completely cover all possible formatting.
Related Issues
Closes #83
Type of Change
Checklist
feat:,fix:,refactor:, etc.)python -m pytest tests/ -v)ruff check src/ tests/)Testing
Tested via existing and expanded unit tests as well as manual spot tests in Python REPL