bring back em-dash.lua

apparently people actually use it
This reverts commit 7876e626d7.
This commit is contained in:
garret 2022-09-28 15:10:00 +01:00
parent 0889affeeb
commit e46d0618ac
1 changed files with 27 additions and 0 deletions

27
macros/em-dash.lua Normal file
View File

@ -0,0 +1,27 @@
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)
for si, li in ipairs(sel) do
local line = sub[li]
line.text = line.text..em
sub[li] = line
end
aegisub.set_undo_point(script_name)
end
function replace(sub, sel)
for si, li in ipairs(sel) do
local line = sub[li]
local text = sub[li].text
text = text:gsub("%-%-",em)
line.text=text
sub[li] = line
end
aegisub.set_undo_point(script_name)
end
aegisub.register_macro(script_name.."/Append", "Appends an Em-dash to the selected line(s)", append)
aegisub.register_macro(script_name.."/Replace", "Replaces -- with "..em, replace)