diff options
author | Marius <mariausol@gmail.com> | 2014-01-21 02:00:14 +0200 |
---|---|---|
committer | Marius <mariausol@gmail.com> | 2014-01-21 02:00:14 +0200 |
commit | 7004566a3f05be822d9633027e5ff7d64768c99f (patch) | |
tree | 9759d19b7bdcda77f1acc2f04f7a7ec0590e24c9 /tex | |
parent | f06cd924de5cfe8c1ffbe8de4cb0c4221258046c (diff) | |
download | context-7004566a3f05be822d9633027e5ff7d64768c99f.tar.gz |
beta 2014.01.21 00:35
Diffstat (limited to 'tex')
-rw-r--r-- | tex/context/base/cont-new.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/context-version.pdf | bin | 4087 -> 4086 bytes | |||
-rw-r--r-- | tex/context/base/context.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/page-mak.mkvi | 12 | ||||
-rw-r--r-- | tex/context/base/publ-tra.lua | 241 | ||||
-rw-r--r-- | tex/context/base/publ-tra.mkiv | 8 | ||||
-rw-r--r-- | tex/context/base/status-files.pdf | bin | 24773 -> 24769 bytes | |||
-rw-r--r-- | tex/context/base/status-lua.pdf | bin | 229066 -> 231511 bytes | |||
-rw-r--r-- | tex/context/base/util-str.lua | 138 | ||||
-rw-r--r-- | tex/generic/context/luatex/luatex-fonts-merged.lua | 76 |
10 files changed, 367 insertions, 112 deletions
diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index 2476d4af1..3e00fa124 100644 --- a/tex/context/base/cont-new.mkiv +++ b/tex/context/base/cont-new.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2014.01.20 14:44} +\newcontextversion{2014.01.21 00:35} %D This file is loaded at runtime, thereby providing an excellent place for %D hacks, patches, extensions and new features. diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf Binary files differindex 11877c24a..d773a32d5 100644 --- a/tex/context/base/context-version.pdf +++ b/tex/context/base/context-version.pdf diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index 3ba9c3230..997c6422d 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -28,7 +28,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2014.01.20 14:44} +\edef\contextversion{2014.01.21 00:35} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/page-mak.mkvi b/tex/context/base/page-mak.mkvi index 71af520a1..708678878 100644 --- a/tex/context/base/page-mak.mkvi +++ b/tex/context/base/page-mak.mkvi @@ -92,9 +92,12 @@ {\doifelsecommandhandler\??makeup{#name}\page_makeup_start_indeed\page_makeup_start_nop[#name]}% \def\page_makeup_start_indeed[#name][#settings]% - {\doifelsenothing{\namedmakeupparameter{#name}\c!page} - {\page}% new, so best not have dangling mess here like references (we could capture then and flush embedded) - {\page[\namedmakeupparameter{#name}\c!page]}% + {\edef\p_page{\namedmakeupparameter{#name}\c!page} + \ifx\p_page\empty + \page % new, so best not have dangling mess here like references (we could capture then and flush embedded) + \else + \page[\p_page]% + \fi \startlayout[#name]% includes \page \bgroup \edef\currentmakeup{#name}% @@ -183,7 +186,8 @@ \c!textstate=\v!normal, \c!headerstate=\v!stop, \c!footerstate=\v!stop, - \c!pagestate=\v!stop] % in manual ! ! ! + % \c!pagestate=\v!stop] % in manual ! ! ! + \c!pagestate=\v!start] \definemakeup [\v!standard] diff --git a/tex/context/base/publ-tra.lua b/tex/context/base/publ-tra.lua index 90bae67e9..98c81d800 100644 --- a/tex/context/base/publ-tra.lua +++ b/tex/context/base/publ-tra.lua @@ -10,11 +10,14 @@ local sortedhash = table.sortedhash local tracers = { } publications.tracers = tracers +local datasets = publications.datasets local context = context -local NC, NR, bold = context.NC, context.NR, context.bold +local NC, NR = context.NC, context.NR +local bold = context.bold +local darkgreen, darkred, darkblue = context.darkgreen, context.darkred, context.darkblue -publications.tracers.fields = table.sorted { +local fields = table.sorted { "abstract", "address", "annotate", @@ -63,7 +66,7 @@ publications.tracers.fields = table.sorted { "revision", } -publications.tracers.citevariants = table.sorted { +local citevariants = table.sorted { "author", "authoryear", "authoryears", @@ -80,52 +83,214 @@ publications.tracers.citevariants = table.sorted { "num", } -publications.tracers.listvariants = table.sorted { +local listvariants = table.sorted { "author", "editor", "artauthor", } -publications.tracers.categories = table.sorted { - "article", - "book", - "booklet", - "conference", - "inbook", - "incollection", - "inproceedings", - "manual", - "mastersthesis", - "misc", - "phdthesis", - "proceedings", - "techreport", - "unpublished", +-- local categories = table.sorted { +-- "article", +-- "book", +-- "booklet", +-- "conference", +-- "inbook", +-- "incollection", +-- "inproceedings", +-- "manual", +-- "mastersthesis", +-- "misc", +-- "phdthesis", +-- "proceedings", +-- "techreport", +-- "unpublished", +-- } + +local categories = { + article = { + required = { "author", "title", "journal", "year" }, + optional = { "volume", "number", "pages", "month", "note" }, + }, + book = { + required = { { "author", "editor" }, "title", "publisher", "year" }, + optional = { { "volume", "number" }, "series", "address", "edition", "month","note" }, + }, + booklet = { + required = { "title" }, + optional = { "author", "howpublished", "address", "month", "year", "note" }, + }, + inbook = { + required = { { "author", "editor" }, "title", { "chapter", "pages" }, "publisher","year" }, + optional = { { "volume", "number" }, "series", "type", "address", "edition", "month", "note" }, + }, + incollection = { + required = { "author", "title", "booktitle", "publisher", "year" }, + optional = { "editor", { "volume", "number" }, "series", "type", "chapter", "pages", "address", "edition", "month", "note" }, + }, + inproceedings = { + required = { "author", "title", "booktitle", "year" }, + optional = { "editor", { "volume", "number" }, "series", "pages", "address", "month","organization", "publisher", "note" }, + }, + manual = { + required = { "title" }, + optional = { "author", "organization", "address", "edition", "month", "year", "note" }, + }, + mastersthesis = { + required = { "author", "title", "school", "year" }, + optional = { "type", "address", "month", "note" }, + }, + misc = { + required = { "author", "title", "howpublished", "month", "year", "note" }, + optional = { "author", "title", "howpublished", "month", "year", "note" }, + }, + phdthesis = { + required = { "author", "title", "school", "year" }, + optional = { "type", "address", "month", "note" }, + }, + proceedings = { + required = { "title", "year" }, + optional = { "editor", { "volume", "number" }, "series", "address", "month", "organization", "publisher", "note" }, + }, + techreport = { + required = { "author", "title", "institution", "year" }, + optional = { "type", "number", "address", "month", "note" }, + }, + unpublished = { + required = { "author", "title", "note" }, + optional = { "month", "year" }, + }, } -function tracers.showdatasetfields(name) - if name and name ~= "" then - local luadata = publications.datasets[name].luadata - if next(luadata) then - context.starttabulate { "|lT|lT|pT|" } - NC() bold("tag") - NC() bold("category") - NC() bold("fields") - NC() NR() context.FL() -- HL() - for k, v in sortedhash(luadata) do - NC() context(k) - NC() context(v.category) - NC() - for k, v in sortedhash(v) do - if k ~= "details" and k ~= "tag" and k ~= "category" then - context("%s ",k) + +publications.tracers.fields = fields +publications.tracers.categories = categories +publications.tracers.citevariants = citevariants +publications.tracers.listvariants = listvariants +-- -- -- + +function tracers.showdatasetfields(dataset) + local luadata = datasets[dataset].luadata + if next(luadata) then + context.starttabulate { "|lT|lT|pT|" } + NC() bold("tag") + NC() bold("category") + NC() bold("fields") + NC() NR() context.FL() -- HL() + for k, v in sortedhash(luadata) do + NC() context(k) + NC() context(v.category) + NC() + for k, v in sortedhash(v) do + if k ~= "details" and k ~= "tag" and k ~= "category" then + context("%s ",k) + end + end + NC() NR() + end + context.stoptabulate() + end +end + +function tracers.showdatasetcompleteness(dataset) + + dataset = datasets[dataset] + + local preamble = { "|lBTw(10em)|p|" } + + local function required(key,value,indirect) + NC() darkgreen(key) + NC() if indirect then + darkblue(value) + elseif value then + context(value) + else + darkred("\\tttf [missing]") + end + NC() NR() + end + + local function optional(key,value,indirect) + NC() context(key) + NC() if indirect then + darkblue(value) + elseif value then + context(value) + end + NC() NR() + end + + local function identified(tag,crossref) + NC() context("tag") + NC() if crossref then + context("\\tttf %s\\hfill\\darkblue => %s",tag,crossref) + else + context("\\tttf %s",tag) + end + NC() NR() + end + + local luadata = datasets[dataset].luadata + + if next(luadata) then + for tag, entry in table.sortedhash(luadata) do + local category = entry.category + local fields = categories[category] + if fields then + context.starttabulate(preamble) + identified(tag,entry.crossref) + context.HL() + local requiredfields = fields.required + local optionalfields = fields.optional + for i=1,#requiredfields do + local r = requiredfields[i] + if type(r) == "table" then + local okay = true + for i=1,#r do + local ri = r[i] + if rawget(entry,ri) then + required(ri,entry[ri]) + okay = true + elseif entry[ri] then + required(ri,entry[ri],true) + okay = true + end end + if not okay then + required(table.concat(r,"\\letterbar ")) + end + elseif rawget(entry,r) then + required(r,entry[r]) + elseif entry[r] then + required(r,entry[r],true) + else + required(r) end - NC() NR() end - context.stoptabulate() + for i=1,#optionalfields do + local o = optionalfields[i] + if type(o) == "table" then + for i=1,#o do + local oi = o[i] + if rawget(entry,oi) then + optional(oi,entry[oi]) + elseif entry[oi] then + optional(oi,entry[oi],true) + end + end + elseif rawget(entry,o) then + optional(o,entry[o]) + elseif entry[o] then + optional(o,entry[o],true) + end + end + context.stoptabulate() + else + -- error + end end end + end -commands.showbtxdatasetfields = tracers.showdatasetfields +commands.showbtxdatasetfields = tracers.showdatasetfields +commands.showbtxdatasetcompleteness = tracers.showdatasetcompleteness diff --git a/tex/context/base/publ-tra.mkiv b/tex/context/base/publ-tra.mkiv index 70db634fe..5f50d99f3 100644 --- a/tex/context/base/publ-tra.mkiv +++ b/tex/context/base/publ-tra.mkiv @@ -15,6 +15,8 @@ \registerctxluafile{publ-tra}{1.001} +% todo: use the module interface + \unprotect \unexpanded\def\showbtxdatasetfields @@ -23,4 +25,10 @@ \def\publ_dataset_show_fields[#1]% {\ctxcommand{showbtxdatasetfields("\iffirstargument#1\else\currentbtxdataset\fi")}} +\unexpanded\def\showbtxdatasetcompleteness + {\dosingleempty\publ_dataset_show_completeness} + +\def\publ_dataset_show_completeness[#1]% + {\ctxcommand{showbtxdatasetcompleteness("\iffirstargument#1\else\currentbtxdataset\fi")}} + \protect \endinput diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf Binary files differindex 6f85c7114..5fb2325b2 100644 --- a/tex/context/base/status-files.pdf +++ b/tex/context/base/status-files.pdf diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf Binary files differindex 19310e11b..b64c5f130 100644 --- a/tex/context/base/status-lua.pdf +++ b/tex/context/base/status-lua.pdf diff --git a/tex/context/base/util-str.lua b/tex/context/base/util-str.lua index af8b1651e..421eefdf3 100644 --- a/tex/context/base/util-str.lua +++ b/tex/context/base/util-str.lua @@ -20,8 +20,16 @@ local utfchar, utfbyte = utf.char, utf.byte ----- loadstripped = utilities.lua.loadstripped ----- setmetatableindex = table.setmetatableindex -local loadstripped = _LUAVERSION < 5.2 and load or function(str) - return load(dump(load(str),true)) -- it only makes sense in luajit and luatex where we have a stipped load +-- local loadstripped = _LUAVERSION < 5.2 and load or function(str) +-- return load(dump(load(str),true)) -- it only makes sense in luajit and luatex where we have a stipped load +-- end + +local loadstripped = function(str,shortcuts) + if shortcuts then + return load(dump(load(str),true),nil,nil,shortcuts) + else + return load(dump(load(str),true)) + end end -- todo: make a special namespace for the formatter @@ -291,33 +299,68 @@ function number.sparseexponent(f,n) return tostring(n) end -local preamble = [[ -local type = type -local tostring = tostring -local tonumber = tonumber -local format = string.format -local concat = table.concat -local signed = number.signed -local points = number.points -local basepoints = number.basepoints -local utfchar = utf.char -local utfbyte = utf.byte -local lpegmatch = lpeg.match -local nspaces = string.nspaces -local tracedchar = string.tracedchar -local autosingle = string.autosingle -local autodouble = string.autodouble -local sequenced = table.sequenced -local formattednumber = number.formatted -local sparseexponent = number.sparseexponent -]] - local template = [[ %s %s return function(%s) return %s end ]] +-- local environment = { +-- lpeg = lpeg, +-- type = type, +-- string = string, +-- number = number, +-- table = table, +-- utf = utf, +-- } +-- +-- local preamble = [[ +-- local type = type +-- local tostring = tostring +-- local tonumber = tonumber +-- local format = string.format +-- local concat = table.concat +-- local signed = number.signed +-- local points = number.points +-- local basepoints = number.basepoints +-- local utfchar = utf.char +-- local utfbyte = utf.byte +-- local lpegmatch = lpeg.match +-- local nspaces = string.nspaces +-- local tracedchar = string.tracedchar +-- local autosingle = string.autosingle +-- local autodouble = string.autodouble +-- local sequenced = table.sequenced +-- local formattednumber = number.formatted +-- local sparseexponent = number.sparseexponent +-- ]] + +local environment = { + lpeg = lpeg, + type = type, + tostring = tostring, + tonumber = tonumber, + format = string.format, + concat = table.concat, + signed = number.signed, + points = number.points, + basepoints = number.basepoints, + utfchar = utf.char, + utfbyte = utf.byte, + lpegmatch = lpeg.match, + nspaces = string.nspaces, + tracedchar = string.tracedchar, + autosingle = string.autosingle, + autodouble = string.autodouble, + sequenced = table.sequenced, + formattednumber = number.formatted, + sparseexponent = number.sparseexponent, +} + +local preamble = "" + +-- -- -- + local arguments = { "a1" } -- faster than previously used (select(n,...)) setmetatable(arguments, { __index = @@ -740,28 +783,37 @@ local builder = Cs { "start", -- we can be clever and only alias what is needed +-- local direct = Cs ( +-- P("%")/"" +-- * Cc([[local format = string.format return function(str) return format("%]]) +-- * (S("+- .") + R("09"))^0 +-- * S("sqidfgGeExXo") +-- * Cc([[",str) end]]) +-- * P(-1) +-- ) + local direct = Cs ( - P("%")/"" - * Cc([[local format = string.format return function(str) return format("%]]) - * (S("+- .") + R("09"))^0 - * S("sqidfgGeExXo") - * Cc([[",str) end]]) - * P(-1) - ) + P("%") + * (S("+- .") + R("09"))^0 + * S("sqidfgGeExXo") + * P(-1) / [[local format = string.format return function(str) return format("%0",str) end]] +) local function make(t,str) local f local p local p = lpegmatch(direct,str) if p then + -- f = loadstripped(p)() + -- print("builder 1 >",p) f = loadstripped(p)() else n = 0 p = lpegmatch(builder,str,1,"..",t._extensions_) -- after this we know n if n > 0 then p = format(template,preamble,t._preamble_,arguments[n],p) --- print("builder>",p) - f = loadstripped(p)() + -- print("builder 2 >",p) + f = loadstripped(p,t._environment_)() -- t._environment is not populated (was experiment) else f = function() return str end end @@ -817,7 +869,11 @@ strings.formatters = { } -- clear that table when a threshold is reached function strings.formatters.new() - local t = { _extensions_ = { }, _preamble_ = "", _type_ = "formatter" } + local e = { } -- better make a copy as we can overload + for k, v in next, environment do + e[k] = v + end + local t = { _extensions_ = { }, _preamble_ = "", _environment_ = e, _type_ = "formatter" } setmetatable(t, { __index = make, __call = use }) return t end @@ -838,8 +894,12 @@ string.formatter = function(str,...) return formatters[str](...) end -- someti local function add(t,name,template,preamble) if type(t) == "table" and t._type_ == "formatter" then t._extensions_[name] = template or "%s" - if preamble then + if type(preamble) == "string" then t._preamble_ = preamble .. "\n" .. t._preamble_ -- so no overload ! + elseif type(preamble) == "table" then + for k, v in next, preamble do + t._environment_[k] = v + end end end end @@ -856,9 +916,13 @@ patterns.luaquoted = Cs(Cc('"') * ((1-S('"\n'))^1 + P('"')/'\\"' + P('\n')/'\\n" -- escaping by lpeg is faster for strings without quotes, slower on a string with quotes, but -- faster again when other q-escapables are found (the ones we don't need to escape) -add(formatters,"xml", [[lpegmatch(xmlescape,%s)]],[[local xmlescape = lpeg.patterns.xmlescape]]) -add(formatters,"tex", [[lpegmatch(texescape,%s)]],[[local texescape = lpeg.patterns.texescape]]) -add(formatters,"lua", [[lpegmatch(luaescape,%s)]],[[local luaescape = lpeg.patterns.luaescape]]) +-- add(formatters,"xml", [[lpegmatch(xmlescape,%s)]],[[local xmlescape = lpeg.patterns.xmlescape]]) +-- add(formatters,"tex", [[lpegmatch(texescape,%s)]],[[local texescape = lpeg.patterns.texescape]]) +-- add(formatters,"lua", [[lpegmatch(luaescape,%s)]],[[local luaescape = lpeg.patterns.luaescape]]) + +add(formatters,"xml", [[lpegmatch(xmlescape,%s)]],{ xmlescape = lpeg.patterns.xmlescape }) +add(formatters,"tex", [[lpegmatch(texescape,%s)]],{ texescape = lpeg.patterns.texescape }) +add(formatters,"lua", [[lpegmatch(luaescape,%s)]],{ luaescape = lpeg.patterns.luaescape }) -- -- yes or no: -- diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 8afec4770..945039150 100644 --- a/tex/generic/context/luatex/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : luatex-fonts-merged.lua -- parent file : luatex-fonts.lua --- merge date : 01/20/14 14:44:35 +-- merge date : 01/21/14 00:35:43 do -- begin closure to overcome local limits and interference @@ -2516,8 +2516,12 @@ local unpack,concat=table.unpack,table.concat local P,V,C,S,R,Ct,Cs,Cp,Carg,Cc=lpeg.P,lpeg.V,lpeg.C,lpeg.S,lpeg.R,lpeg.Ct,lpeg.Cs,lpeg.Cp,lpeg.Carg,lpeg.Cc local patterns,lpegmatch=lpeg.patterns,lpeg.match local utfchar,utfbyte=utf.char,utf.byte -local loadstripped=_LUAVERSION<5.2 and load or function(str) - return load(dump(load(str),true)) +local loadstripped=function(str,shortcuts) + if shortcuts then + return load(dump(load(str),true),nil,nil,shortcuts) + else + return load(dump(load(str),true)) + end end if not number then number={} end local stripper=patterns.stripzeros @@ -2667,31 +2671,33 @@ function number.sparseexponent(f,n) end return tostring(n) end -local preamble=[[ -local type = type -local tostring = tostring -local tonumber = tonumber -local format = string.format -local concat = table.concat -local signed = number.signed -local points = number.points -local basepoints = number.basepoints -local utfchar = utf.char -local utfbyte = utf.byte -local lpegmatch = lpeg.match -local nspaces = string.nspaces -local tracedchar = string.tracedchar -local autosingle = string.autosingle -local autodouble = string.autodouble -local sequenced = table.sequenced -local formattednumber = number.formatted -local sparseexponent = number.sparseexponent -]] local template=[[ %s %s return function(%s) return %s end ]] +local environment={ + lpeg=lpeg, + type=type, + tostring=tostring, + tonumber=tonumber, + format=string.format, + concat=table.concat, + signed=number.signed, + points=number.points, + basepoints=number.basepoints, + utfchar=utf.char, + utfbyte=utf.byte, + lpegmatch=lpeg.match, + nspaces=string.nspaces, + tracedchar=string.tracedchar, + autosingle=string.autosingle, + autodouble=string.autodouble, + sequenced=table.sequenced, + formattednumber=number.formatted, + sparseexponent=number.sparseexponent, +} +local preamble="" local arguments={ "a1" } setmetatable(arguments,{ __index=function(t,k) local v=t[k-1]..",a"..k @@ -3013,8 +3019,8 @@ local builder=Cs { "start", ["!"]=Carg(2)*prefix_any*P("!")*C((1-P("!"))^1)*P("!")/format_extension, } local direct=Cs ( - P("%")/""*Cc([[local format = string.format return function(str) return format("%]])*(S("+- .")+R("09"))^0*S("sqidfgGeExXo")*Cc([[",str) end]])*P(-1) - ) + P("%")*(S("+- .")+R("09"))^0*S("sqidfgGeExXo")*P(-1)/[[local format = string.format return function(str) return format("%0",str) end]] +) local function make(t,str) local f local p @@ -3026,7 +3032,7 @@ local function make(t,str) p=lpegmatch(builder,str,1,"..",t._extensions_) if n>0 then p=format(template,preamble,t._preamble_,arguments[n],p) - f=loadstripped(p)() + f=loadstripped(p,t._environment_)() else f=function() return str end end @@ -3039,7 +3045,11 @@ local function use(t,fmt,...) end strings.formatters={} function strings.formatters.new() - local t={ _extensions_={},_preamble_="",_type_="formatter" } + local e={} + for k,v in next,environment do + e[k]=v + end + local t={ _extensions_={},_preamble_="",_environment_=e,_type_="formatter" } setmetatable(t,{ __index=make,__call=use }) return t end @@ -3049,8 +3059,12 @@ string.formatter=function(str,...) return formatters[str](...) end local function add(t,name,template,preamble) if type(t)=="table" and t._type_=="formatter" then t._extensions_[name]=template or "%s" - if preamble then + if type(preamble)=="string" then t._preamble_=preamble.."\n"..t._preamble_ + elseif type(preamble)=="table" then + for k,v in next,preamble do + t._environment_[k]=v + end end end end @@ -3059,9 +3073,9 @@ patterns.xmlescape=Cs((P("<")/"<"+P(">")/">"+P("&")/"&"+P('"')/"" patterns.texescape=Cs((C(S("#$%\\{}"))/"\\%1"+P(1))^0) patterns.luaescape=Cs(((1-S('"\n'))^1+P('"')/'\\"'+P('\n')/'\\n"')^0) patterns.luaquoted=Cs(Cc('"')*((1-S('"\n'))^1+P('"')/'\\"'+P('\n')/'\\n"')^0*Cc('"')) -add(formatters,"xml",[[lpegmatch(xmlescape,%s)]],[[local xmlescape = lpeg.patterns.xmlescape]]) -add(formatters,"tex",[[lpegmatch(texescape,%s)]],[[local texescape = lpeg.patterns.texescape]]) -add(formatters,"lua",[[lpegmatch(luaescape,%s)]],[[local luaescape = lpeg.patterns.luaescape]]) +add(formatters,"xml",[[lpegmatch(xmlescape,%s)]],{ xmlescape=lpeg.patterns.xmlescape }) +add(formatters,"tex",[[lpegmatch(texescape,%s)]],{ texescape=lpeg.patterns.texescape }) +add(formatters,"lua",[[lpegmatch(luaescape,%s)]],{ luaescape=lpeg.patterns.luaescape }) end -- closure |