diff options
author | garret <garret@airmail.cc> | 2022-11-18 02:54:29 +0000 |
---|---|---|
committer | garret <garret@airmail.cc> | 2022-11-18 02:54:29 +0000 |
commit | ffcca2c076220f313c4ffb2cd637589c74926a2f (patch) | |
tree | 19493b963b5933bbc76024ed829067bb8be5020f /macros | |
parent | 0e409d9fa3813282b4986a495863b328423c6927 (diff) | |
download | aegisub-scripts-ffcca2c076220f313c4ffb2cd637589c74926a2f.tar.gz aegisub-scripts-ffcca2c076220f313c4ffb2cd637589c74926a2f.tar.bz2 aegisub-scripts-ffcca2c076220f313c4ffb2cd637589c74926a2f.zip |
sylsplitter: move kana regex to within main function
hm perhaps i should not have this running on every script load lol
Diffstat (limited to 'macros')
-rw-r--r-- | macros/garret.sylsplitter.lua | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/macros/garret.sylsplitter.lua b/macros/garret.sylsplitter.lua index 2accca8..615f730 100644 --- a/macros/garret.sylsplitter.lua +++ b/macros/garret.sylsplitter.lua @@ -1,7 +1,7 @@ script_name = "Syllable Splitter" script_description = "splits romaji into syls of their original kana. for the lazy k-timer." script_author = "garret" -script_version = "1.0.0" +script_version = "1.0.1" script_namespace = "garret.sylsplitter" local haveDepCtrl, DependencyControl, depctrl = pcall(require, "l0.DependencyControl") @@ -16,8 +16,6 @@ else re = require("aegisub.re") end -local kana = re.compile("a|i|u|e|o|ya|yu|yo|ka|ki|ku|ke|ko|kya|kyu|kyo|sa|shi|su|se|so|sha|shu|sho|ta|chi|tsu|te|to|cha|chu|cho|na|ni|nu|ne|no|nya|nyu|nyo|ha|hi|fu|he|ho|hya|hyu|hyo|ma|mi|mu|me|mo|mya|myu|myo|ra|ri|ru|re|ro|rya|ryu|ryo|ga|gi|gu|ge|go|gya|gyu|gyo|za|ji|zu|ze|zo|ja|ju|jo|da|ji|zu|de|do|ja|ju|jo|ba|bi|bu|be|bo|bya|byu|byo|pa|pi|pu|pe|po|pya|pyu|pyo|wa|wo|n|-|[a-z]") -- all kana + all letters (for small っ) (probably dont need _all_ letters but whatever) - local function round(num, numDecimalPlaces) -- https://lua-users.org/wiki/SimpleRound local mult = 10^(numDecimalPlaces or 0) return math.floor(num * mult + 0.5) / mult @@ -30,6 +28,7 @@ local function add_tag(syl) end local function main(sub,sel) + local kana = re.compile("a|i|u|e|o|ya|yu|yo|ka|ki|ku|ke|ko|kya|kyu|kyo|sa|shi|su|se|so|sha|shu|sho|ta|chi|tsu|te|to|cha|chu|cho|na|ni|nu|ne|no|nya|nyu|nyo|ha|hi|fu|he|ho|hya|hyu|hyo|ma|mi|mu|me|mo|mya|myu|myo|ra|ri|ru|re|ro|rya|ryu|ryo|ga|gi|gu|ge|go|gya|gyu|gyo|za|ji|zu|ze|zo|ja|ju|jo|da|ji|zu|de|do|ja|ju|jo|ba|bi|bu|be|bo|bya|byu|byo|pa|pi|pu|pe|po|pya|pyu|pyo|wa|wo|n|-|[a-z]") -- all kana + all letters (for small っ) (probably dont need _all_ letters but whatever) for i = 1, #sel do line = sub[sel[i]] -- yes global, i know(ish) what im doing line.text = kana:sub(line.text, add_tag) |