diff options
author | garret <garret@airmail.cc> | 2022-12-21 06:31:56 +0000 |
---|---|---|
committer | garret <garret@airmail.cc> | 2022-12-21 07:03:50 +0000 |
commit | b3397f9ad988273ffa3c958829741dc66e71c3b1 (patch) | |
tree | 7cc747492f34f82c678c917963cade41fb0331db | |
parent | 771a31da3504a6dae607c7cf62a27889f92846c3 (diff) | |
download | aegisub-scripts-b3397f9ad988273ffa3c958829741dc66e71c3b1.tar.gz aegisub-scripts-b3397f9ad988273ffa3c958829741dc66e71c3b1.tar.bz2 aegisub-scripts-b3397f9ad988273ffa3c958829741dc66e71c3b1.zip |
em-dash: make trailing -s into em-dashes
-rw-r--r-- | macros/em-dash.lua | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/macros/em-dash.lua b/macros/em-dash.lua index 99d22df..3dfe696 100644 --- a/macros/em-dash.lua +++ b/macros/em-dash.lua @@ -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) |