Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KaraTemplater: Implement keeptags modifier #16

Open
wants to merge 2 commits into
base: trunk
Choose a base branch
from

Conversation

Senyksia
Copy link

@Senyksia Senyksia commented Jul 15, 2023

The keeptags modifier flags that non-k override tags from an input line should be preserved when generating resultant output lines.

The tags are extracted via preproc_chars; we match for override blocks in a syl, map which character they belong to, and prepend the blocks to char.text.
Notably, this process is performed regardless of keeptags. keeptags merely indicates if the output should be stripped or not.

As char previously only defined char.text, I have renamed what was char.text to char.text_stripped, with char.text now representing the character including tags. This makes it consistent with the other classes, but will be potentially breaking for old component lines expecting char.text to be stripped. An alternative could be storing tags in char.tags, leaving char.text untouched. I prefer the consistent fields, but I'll RFC for now.

A bug with word.text_stripped is also indirectly fixed, which relied on an undefined char.text_stripped - causing the string to always be nil.

`keeptags` will preserve all non-k override tags at a character level.
The modifier previously existed, but was unimplemented.

Non-k override tags are now always matched during `preproc_chars`, and prepended
to `char.text`. `keeptags` just flags for `char.text` to be used instead
of the new `char.text_stripped` during `build_text`.

BREAKING CHANGE: What was previously `char.text` has been renamed to
`char.text_stripped`.
@Senyksia Senyksia marked this pull request as ready for review July 15, 2023 07:55
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.

1 participant