-
Notifications
You must be signed in to change notification settings - Fork 520
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
Make karaskel aware of style change when templating syllables #313
base: master
Are you sure you want to change the base?
Conversation
not sure if I should workaround the fact that the style change tag doesn't end up in the syllable where it happens at the karaskel level, or if I should move the style change tag to the syllable where it happens when parsing at the cpp level |
other caveat, it doesn't work for furi styles at the moment since edit: now it uses parent syllable style. Don't think I can do much better from the lua side |
note that this would not be entirely sufficient to make karaskel "aware" of style changes.
the above becomes the following if committing any changes (including no changes, just pressing the commit button) to ktiming:
I wrote all that before realizing I had misunderstood you somewhat. karaskel's behavior on splitting syls like this is fairly reasonable, but it should be fairly simple to check if the reset tag is actually at the end of the syl as well to work around this: syl.style = cur_style
local _, reset_end, style_reset_name = syl.text:find("%{.*\\%r([^}\\]+)")
if style_reset_name and styles[style_reset_name] then
cur_style = styles[style_reset_name]
-- match does not include final }
if reset_end + 1 < #syl.text then
syl.style = cur.style
end
end |
Thanks for the code block. It does exactly what I meant by working around the "style change tag belonging to previous syllable" issue from the lua side. The other solution would have been to change the way syl are split (from the c++ side) but maybe it's less reasonable to flip around blocks during the parsing... |
with caveat that it works only if the reset style tag is placed after the \k (ex: {\k20\rStyle Name}
For #312 with current caveat that it works only if the reset style tag is placed after the
\k
(ex:{\k20\rStyle Name}
.If the tags are placed in the other order (
\rStyle Name\k20
), then the reset style tag goes into thesyl.text
of the syllable preceding the style change, therefore giving incorrect style to the previous syllable.