clean_k_tags: work correctly with tags in the same block
This commit is contained in:
parent
71eca4db49
commit
026734c423
|
@ -7,11 +7,19 @@ script_version = "1.0"
|
|||
|
||||
function special_k(subs, sel)
|
||||
|
||||
local double_k = "^(.-{\\k[^}]-)(\\k.+)$"
|
||||
-- if the first tag is K/kf this would break the timing for the previous timing
|
||||
local expr = "^(.-){\\(ko?)([0-9.]+)[^}]-}([^{]-){\\[kK][fo]?([0-9.]+)[^}]-}( -{(\\[kK][fo]?)[0-9.]+[^}]-}.*)$"
|
||||
|
||||
for _, i in ipairs(sel) do
|
||||
line = subs[i]
|
||||
|
||||
before, after = line.text:match(double_k)
|
||||
while after ~= nil do
|
||||
line.text = before .. "}{" .. after
|
||||
before, after = line.text:match(double_k)
|
||||
end
|
||||
|
||||
before, tag, k1, between, k2, after = line.text:match(expr)
|
||||
while after ~= nil do
|
||||
line.text = before .. "{\\" .. tag .. tonumber(k1) + tonumber(k2) .. "}" .. between .. after
|
||||
|
|
Loading…
Reference in a new issue