rename cr restyler -> restyler

This commit is contained in:
garret 2021-08-21 13:48:00 +01:00
parent 131fac9291
commit 4f7469e56a
2 changed files with 14 additions and 15 deletions

View File

@ -62,16 +62,6 @@ Language is currently hardcoded to english.
**Done better by**: `Significance` by UA.
### CR Restyler
`become-fansubber.lua`
Changes style of selected lines to `Default` (for now),
and copies italic+alignment values from cr's styles to inline tags.
assumes a relatively clean cr script.
if not, you're on your own.
### Dupe and Comment
Duplicates a line and comments out the original.
@ -97,6 +87,16 @@ makes doing alpha timing significantly easier
originally created to convert stuff that should've been alpha timed in the first place
but used a weird hack with `\ko` instead.
### Restyler
`become-fansubber.lua`
Changes style of selected lines to `Default` (for now, will be configurable in future),
and copies italic+alignment values from the script's styles to inline tags.
Can't help if the source script isn't properly styled.
**cannot handle inline tags!**
### Scenebleed Detector
Finds scenebleeds in the selected lines, and marks them with an effect (`bleed`).

View File

@ -1,4 +1,4 @@
script_name="CR Restyler"
script_name="Restyler"
script_description="become a fansubber with a click of a button"
script_author = "garret"
script_version = "2.0.0-dev"
@ -35,14 +35,13 @@ function get_new(old, new)
end
function main(sub, sel)
local _, styles = karaskel.collect_head(sub) -- i'd like to not have it log if possible
local _, styles = karaskel.collect_head(sub, false)
local new_style_name = "Default" -- the one we'll be changing stuff to - TODO: configurable
local new_style = styles[new_style_name]
for h, i in ipairs(sel) do
-- maybe don't do if the style has "sign" in the name?
-- need proper list of stuff cr uses
-- TODO: automatically exclude styles (also configurable)
local line = sub[i]
local old_style = styles[line.style]
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