diff options
author | garret <garret@airmail.cc> | 2024-02-25 23:01:13 +0000 |
---|---|---|
committer | garret <garret@airmail.cc> | 2024-02-25 23:08:47 +0000 |
commit | 67d261ab378fa9166ee6e0c31b7cb4e32a019925 (patch) | |
tree | 1fbd2153481e675f283f731c1da59d584513f2c9 /macros/garret.restyler.lua | |
parent | 5edf42a777b02ab939ab751a7d3e7eb0a7efde70 (diff) | |
download | aegisub-scripts-67d261ab378fa9166ee6e0c31b7cb4e32a019925.tar.gz aegisub-scripts-67d261ab378fa9166ee6e0c31b7cb4e32a019925.tar.bz2 aegisub-scripts-67d261ab378fa9166ee6e0c31b7cb4e32a019925.zip |
get rid of dependencycontrol bullshit
there is no sense in me keeping it around when all it does is
add faff to writing the script
add useless noise to the filenames/paths
and enforces its opinions upon me which i dont agree with
and all for absolutely ZERO reason since i don't even have a feed in the
first place
if you want to take my scripts and package them into a dependencycontrol
feed, you are more than welcome to do so, provided you comply with the
terms of the licence. but your life is going to be a little bit harder
i'm afraid, sorry about that.
i will keep all the script_namespace, depctrl registration and such
around for the time being (removing it is >effort)
Diffstat (limited to 'macros/garret.restyler.lua')
-rw-r--r-- | macros/garret.restyler.lua | 68 |
1 files changed, 0 insertions, 68 deletions
diff --git a/macros/garret.restyler.lua b/macros/garret.restyler.lua deleted file mode 100644 index 9430676..0000000 --- a/macros/garret.restyler.lua +++ /dev/null @@ -1,68 +0,0 @@ -script_name="Restyler" -script_description="become a fansubber with a click of a button" -script_author = "garret" -script_version = "2.1.1" -script_namespace = "garret.restyler" - -local haveDepCtrl, DependencyControl, depctrl = pcall(require, "l0.DependencyControl") -if haveDepCtrl then - depctrl = DependencyControl { - --feed="TODO", - } -end - -include("karaskel.lua") -include("cleantags.lua") - --- local config = simpleconf.get_config(aegisub.decode_path(config_dir.."/"..script_namespace..".conf"), {new_style = "Default"}) - --- TODO: detect pre-existing inline tags - -- probably need some kind of ass parsing, or a hack with match() - -function add_tags(txt, italic, align) -- everything except txt is boolean. nil = don't change, !nil = change to this value - ---[[not quite happy with this, it overwrites the alignment - ie line is "{\an4} blah blah" and style is an8, it just changes it to an8 -realisticly this _probably_ won't be a problem, but still would like to try and stop it at some point to be safe -italics is fine, it just does {\i1\i0}, which is jank and bad but works fine so i won't worry about it too much]] - if italic == true then - txt="{\\i1}"..txt - elseif italics == false then - txt="{\\i0}"..txt - end - if align ~= nil then - txt="{\\an"..align.."}"..txt - end - txt = cleantags(txt) - return txt -end - -function get_new(old, new) - local i = nil - if old ~= new then - i = old - end - return i -end - -function main(sub, sel) - local _, styles = karaskel.collect_head(sub, false) - local new_style_name = "Default" - local new_style = styles[new_style_name] - for h, i in ipairs(sel) do - -- TODO: automatically exclude styles (also configurable) - local line = sub[i] - local old_style = styles[line.style] -- reinventing the wheel a bit here, since karaskel can do this with preproc_line_size (line.styleref), but it also adds loads of other crap we don't care about for the same functionality in the end, so ¯\_(ツ)_/¯ - local italic = get_new(old_style.italic, new_style.italic) - local align = get_new(old_style.align, new_style.align) - line.style = new_style_name - line.text = add_tags(line.text, italic, align) - sub[i] = line - end - aegisub.set_undo_point(script_name) -end - -if haveDepCtrl then - depctrl:registerMacro(main) -else - aegisub.register_macro(script_name, script_description, main) -end |