~ubuntu-branches/ubuntu/wily/aegisub/wily-proposed

« back to all changes in this revision

Viewing changes to automation/include/cleantags.lua

  • Committer: Package Import Robot
  • Author(s): Sebastian Reichel
  • Date: 2013-11-14 16:49:59 UTC
  • mto: (5.1.1 sid)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: package-import@ubuntu.com-20131114164959-gcmzfp1gu1alvtib
Tags: upstream-3.0.4
Import upstream version 3.0.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
--[[ 
 
1
--[[ 
2
2
"Clean Tags" -- An Auto4 LUA script for cleaning up ASS subtitle lines of badly-formed override 
3
3
blocks and redundant/duplicate tags
4
4
* Designed to work for Aegisub 2.0 and above
97
97
        end
98
98
 
99
99
        --[[ Remove any spaces within parenteses within override blocks except for \clip tags ]]
100
 
        local comb = function(a,b,c,d,e) 
101
 
                if c ~= "\\i?clip" or d:sub(-1):find("[,%({]") or e:sub(1,1):find("[,%)}]") then return a..b..d..e 
102
 
                else return a..b..d..string.char(2)..e end 
 
100
        local comb = function(a,b,c,d,e)
 
101
                if (c ~= "\\clip" and c ~= "\\iclip") or d:sub(-1):find("[,%({]") or e:sub(1,1):find("[,%)}]") then return a..b..d..e
 
102
                else return a..b..d..string.char(2)..e end
103
103
        end
104
104
    repeat
105
105
        text, replaced2 = string.gsub(text, "({[^}\\]*)([^}%s]*(\\[^%(}\\%s]*))%s*(%([^%s%)}]*)%s+([^}]*)", comb)