diff options
author | garret <garret@airmail.cc> | 2022-09-28 15:10:00 +0100 |
---|---|---|
committer | garret <garret@airmail.cc> | 2022-09-28 15:10:00 +0100 |
commit | e46d0618acd80dbe026a7d715fe4e929cd4b32c2 (patch) | |
tree | abebf755b50fe9f0525a5c5d1ddbfd3abf1bbe8c | |
parent | 0889affeebe6b89eac1928f9c025cb8479c34d2e (diff) | |
download | aegisub-scripts-e46d0618acd80dbe026a7d715fe4e929cd4b32c2.tar.gz aegisub-scripts-e46d0618acd80dbe026a7d715fe4e929cd4b32c2.tar.bz2 aegisub-scripts-e46d0618acd80dbe026a7d715fe4e929cd4b32c2.zip |
bring back em-dash.lua
apparently people actually use it
This reverts commit 7876e626d73b8010ed63a2423c354f2412f318be.
-rw-r--r-- | macros/em-dash.lua | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/macros/em-dash.lua b/macros/em-dash.lua new file mode 100644 index 0000000..99d22df --- /dev/null +++ b/macros/em-dash.lua @@ -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) |