diff options
author | Norbert Preining <norbert@preining.info> | 2022-09-23 03:02:24 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2022-09-23 03:02:24 +0000 |
commit | 93fb03ea65cbfc0770b6b22d07b1a2d8098b23aa (patch) | |
tree | 4ef3ac0722fccefb8c999f68e4cadf8e86d67c29 /macros/latex/contrib/semantex/stripsemantex.lua | |
parent | 2bb16a3bfa64e17e235ca1f7873f8f7a140ad767 (diff) |
CTAN sync 202209230302
Diffstat (limited to 'macros/latex/contrib/semantex/stripsemantex.lua')
-rw-r--r-- | macros/latex/contrib/semantex/stripsemantex.lua | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/macros/latex/contrib/semantex/stripsemantex.lua b/macros/latex/contrib/semantex/stripsemantex.lua index f50648dd23..30d4c58be6 100644 --- a/macros/latex/contrib/semantex/stripsemantex.lua +++ b/macros/latex/contrib/semantex/stripsemantex.lua @@ -55,7 +55,7 @@ end addIDsToRegisters = function(str) str = removeStricttexFormatting(str) - content = content:gsub('\\' .. str .. '([^%a])' ,'\\SemantexIDcommand{}\\' .. str .. '%1') + content = content:gsub('\\' .. str .. '([^%a])' ,'\\SemantexID{}\\' .. str .. '%1') -- '%f[^%a]' does not work here, as it will not react if the last character of str is a number, -- which stricttex allows. -- Because of this choice, there will be an issue if you use stricttex and let @@ -64,33 +64,33 @@ addIDsToRegisters = function(str) end removeSuperfluousIDs = function() - local p = content:find('([^\\]%%[^\n]-)\\SemantexIDcommand{}([^\n]-\n)') + local p = content:find('([^\\]%%[^\n]-)\\SemantexID{}([^\n]-\n)') while p do - content = content:gsub('([^\\]%%[^\n]-)\\SemantexIDcommand{}([^\n]-\n)','%1%2') - p = content:find('([^\\]%%[^\n]-)\\SemantexIDcommand{}([^\n]-\n)') + content = content:gsub('([^\\]%%[^\n]-)\\SemantexID{}([^\n]-\n)','%1%2') + p = content:find('([^\\]%%[^\n]-)\\SemantexID{}([^\n]-\n)') end - content = content:gsub('parent(%s*)=(%s*)\\SemantexIDcommand{}','parent%1=%2') - content = content:gsub('class(%s*)=(%s*)\\SemantexIDcommand{}','class%1=%2') - content = content:gsub('clone(%s*)=(%s*)\\SemantexIDcommand{}','clone%1=%2') - content = content:gsub('copy(%s*)=(%s*)\\SemantexIDcommand{}','copy%1=%2') - content = content:gsub('\\New(%w+)Class(%s*{?)\\SemantexIDcommand{}','\\New%1Class%2') - content = content:gsub('\\NewObject(%s*{?%s*)\\SemantexIDcommand{}(\\%w+%s*}?%s*{?%s*)\\SemantexIDcommand{}', '\\NewObject%1%2') - content = content:gsub('\\SetupClass(%s*{?%s*)\\SemantexIDcommand{}', '\\SetupClass%1') - content = content:gsub('\\SetupObject(%s*{?%s*)\\SemantexIDcommand{}', '\\SetupObject%1') + content = content:gsub('parent(%s*)=(%s*)\\SemantexID{}','parent%1=%2') + content = content:gsub('class(%s*)=(%s*)\\SemantexID{}','class%1=%2') + content = content:gsub('clone(%s*)=(%s*)\\SemantexID{}','clone%1=%2') + content = content:gsub('copy(%s*)=(%s*)\\SemantexID{}','copy%1=%2') + content = content:gsub('\\New(%w+)Class(%s*{?)\\SemantexID{}','\\New%1Class%2') + content = content:gsub('\\NewObject(%s*{?%s*)\\SemantexID{}(\\%w+%s*}?%s*{?%s*)\\SemantexID{}', '\\NewObject%1%2') + content = content:gsub('\\SetupClass(%s*{?%s*)\\SemantexID{}', '\\SetupClass%1') + content = content:gsub('\\SetupObject(%s*{?%s*)\\SemantexID{}', '\\SetupObject%1') end addNumbersToIDs = function() local n = 0 - local p,q = string.find(content,'\\SemantexIDcommand{}') + local p,q = string.find(content,'\\SemantexID{}') while q do n = n + 1 content = content:sub(1,q-1) .. n .. content:sub(q,-1) - p, q = string.find(content,'\\SemantexIDcommand{}') + p, q = string.find(content,'\\SemantexID{}') end end semantexIDluacommand = function(id, source, output) - local p, q = string.find(content, '\\SemantexIDcommand{' .. id .. '}') + local p, q = string.find(content, '\\SemantexID{' .. id .. '}') while p do content = content:sub(1,p-1) .. content:sub(q+1,-1) @@ -228,12 +228,12 @@ semantexIDluacommand = function(id, source, output) else content = content:sub(1,p-1) .. output .. content:sub(p,-1) end - p, q = string.find(content, '\\SemantexIDcommand{' .. id .. '}') + p, q = string.find(content, '\\SemantexID{' .. id .. '}') end end stripRemainingSemantexIDs = function() - content = content:gsub('\\SemantexIDcommand{%d+}', '') + content = content:gsub('\\SemantexID{%d+}', '') end removeParenthesisCommands = function() |