em-dash: make trailing -s into em-dashes

This commit is contained in:
garret 2022-12-21 06:31:56 +00:00
parent 771a31da35
commit b3397f9ad9
1 changed files with 9 additions and 4 deletions

View File

@ -1,12 +1,17 @@
script_name = "Em-dash"
script_description = "I do not have an em-dash key on my keyboard"
script_author = "garret"
script_version = "2021-04-05"
em = ""
function append(sub, sel)
script_version = "2.0.0"
local em = ""
local function append(sub, sel)
for si, li in ipairs(sel) do
local line = sub[li]
line.text = line.text..em
if string.sub(line.text, -1) == "-" then
line.text = line.text:sub(1, #line.text - 1)
end
line.text = line.text..em
sub[li] = line
end
aegisub.set_undo_point(script_name)