parent
a9cd2df73f
commit
36f2d72731
|
@ -5,14 +5,10 @@ script_version = "2.1.0"
|
||||||
script_namespace = "garret.restyler"
|
script_namespace = "garret.restyler"
|
||||||
|
|
||||||
local haveDepCtrl, DependencyControl, depctrl = pcall(require, "l0.DependencyControl")
|
local haveDepCtrl, DependencyControl, depctrl = pcall(require, "l0.DependencyControl")
|
||||||
local karaskel, cleantags
|
|
||||||
if haveDepCtrl then
|
if haveDepCtrl then
|
||||||
depctrl = DependencyControl {
|
depctrl = DependencyControl {
|
||||||
--feed="TODO",
|
--feed="TODO",
|
||||||
{"karaskel", "cleantags"}
|
|
||||||
}
|
}
|
||||||
kara, clean = depctrl:requireModules()
|
|
||||||
else
|
|
||||||
include("karaskel.lua")
|
include("karaskel.lua")
|
||||||
include("cleantags.lua")
|
include("cleantags.lua")
|
||||||
end
|
end
|
||||||
|
@ -49,15 +45,15 @@ end
|
||||||
|
|
||||||
function main(sub, sel)
|
function main(sub, sel)
|
||||||
local _, styles = karaskel.collect_head(sub, false)
|
local _, styles = karaskel.collect_head(sub, false)
|
||||||
local config.new_style = "Default"
|
local new_style_name = "Default"
|
||||||
local new_style = styles[config.new_style]
|
local new_style = styles[new_style_name]
|
||||||
for h, i in ipairs(sel) do
|
for h, i in ipairs(sel) do
|
||||||
-- TODO: automatically exclude styles (also configurable)
|
-- TODO: automatically exclude styles (also configurable)
|
||||||
local line = sub[i]
|
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 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 italic = get_new(old_style.italic, new_style.italic)
|
||||||
local align = get_new(old_style.align, new_style.align)
|
local align = get_new(old_style.align, new_style.align)
|
||||||
line.style = config.new_style
|
line.style = new_style_name
|
||||||
line.text = add_tags(line.text, italic, align)
|
line.text = add_tags(line.text, italic, align)
|
||||||
sub[i] = line
|
sub[i] = line
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue