summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2009-09-11 18:14:00 +0200
committerHans Hagen <pragma@wxs.nl>2009-09-11 18:14:00 +0200
commit31c85bed04f79cca40e26af118964bd86e8edd16 (patch)
tree64815e1310af371e9ad9f87913b7fa33357f0da2
parent8683bfc5e51de9f4436c7deebd9517c9f2779f0a (diff)
downloadcontext-31c85bed04f79cca40e26af118964bd86e8edd16.tar.gz
beta 2009.09.11 18:14
-rw-r--r--scripts/context/lua/mtx-context.lua19
-rw-r--r--scripts/context/lua/mtx-modules.lua162
-rw-r--r--scripts/context/ruby/texexec.rb6
-rw-r--r--tex/context/base/bibl-tra.lua14
-rw-r--r--tex/context/base/bibl-tra.mkii76
-rw-r--r--tex/context/base/bibl-tra.mkiv22
-rw-r--r--tex/context/base/cont-new.mkii3
-rw-r--r--tex/context/base/cont-new.tex2
-rw-r--r--tex/context/base/context.tex2
-rw-r--r--tex/context/base/core-ctx.lua4
-rw-r--r--tex/context/base/core-ctx.mkiv4
-rw-r--r--tex/context/base/l-number.lua15
-rw-r--r--tex/context/base/l-string.lua16
-rw-r--r--tex/context/base/lpdf-fld.lua182
-rw-r--r--tex/context/base/luat-run.lua2
-rw-r--r--tex/context/base/math-def.mkiv6
-rw-r--r--tex/context/base/math-dim.lua2
-rw-r--r--tex/context/base/math-ini.lua1
-rw-r--r--tex/context/base/math-ini.mkiv70
-rw-r--r--tex/context/base/math-map.lua259
-rw-r--r--tex/context/base/math-noa.lua64
-rw-r--r--tex/context/base/math-vfu.lua1
-rw-r--r--tex/context/base/node-pro.lua4
-rw-r--r--tex/context/base/node-tra.lua10
-rw-r--r--tex/context/base/pack-rul.mkiv148
-rw-r--r--tex/context/base/s-mod-00.tex11
-rw-r--r--tex/context/base/s-mod.ctx24
-rw-r--r--tex/context/base/scrn-fld.mkii2
-rw-r--r--tex/context/base/scrn-fld.mkiv23
-rw-r--r--tex/context/base/spec-fdf.mkii84
-rw-r--r--tex/context/base/strc-bkm.lua2
-rw-r--r--tex/context/base/strc-des.mkiv5
-rw-r--r--tex/context/base/strc-doc.lua19
-rw-r--r--tex/context/base/strc-doc.mkiv26
-rw-r--r--tex/context/base/strc-ini.lua1
-rw-r--r--tex/context/base/strc-lst.lua40
-rw-r--r--tex/context/base/strc-num.lua5
-rw-r--r--tex/context/base/strc-pag.lua8
-rw-r--r--tex/context/base/strc-reg.lua56
-rw-r--r--tex/context/base/syst-lua.lua7
-rw-r--r--tex/context/base/trac-tra.lua35
-rw-r--r--tex/generic/context/luatex-fonts-merged.lua18
42 files changed, 997 insertions, 463 deletions
diff --git a/scripts/context/lua/mtx-context.lua b/scripts/context/lua/mtx-context.lua
index 4010a6f8a..e95aead49 100644
--- a/scripts/context/lua/mtx-context.lua
+++ b/scripts/context/lua/mtx-context.lua
@@ -189,6 +189,9 @@ do
end
end
+usedname = resolvers.find_file(ctxdata.ctxname,"tex")
+found = usedname ~= ""
+
if not found and defaultname and defaultname ~= "" and lfs.isfile(defaultname) then
usedname, found = defaultname, true
end
@@ -340,6 +343,14 @@ do
end
+ function ctxrunner.preppedfile(ctxdata,filename)
+ if ctxdata.prepfiles[file.basename(filename)] then
+ return filename .. ".prep"
+ else
+ return filename
+ end
+ end
+
end
-- rest
@@ -594,12 +605,12 @@ local function analyze(filename)
return nil
end
-local function makestub(format,filename)
+local function makestub(format,filename,prepname)
local stubname = file.replacesuffix(file.basename(filename),'run')
local f = io.open(stubname,'w')
if f then
f:write("\\starttext\n")
- f:write(string.format(format,filename),"\n")
+ f:write(string.format(format,prepname or filename),"\n")
f:write("\\stoptext\n")
f:close()
filename = stubname
@@ -677,6 +688,7 @@ function scripts.context.run(ctxdata,filename)
end
if formatfile and scriptfile then
-- we default to mkiv xml !
+ -- the --prep argument might become automatic (and noprep)
local suffix = file.extname(filename) or "?"
if scripts.context.xmlsuffixes[suffix] or environment.argument("forcexml") then
if environment.argument("mkii") then
@@ -688,6 +700,9 @@ function scripts.context.run(ctxdata,filename)
filename = makestub("\\ctxlua{context.runfile('%s')}",filename)
elseif scripts.context.luasuffixes[suffix] or environment.argument("forcelua") then
filename = makestub("\\ctxlua{dofile('%s')}",filename)
+ elseif environment.argument("prep") then
+ -- we need to keep the original jobname
+ filename = makestub("\\readfile{%s}{}{}",filename,ctxrunner.preppedfile(ctxdata,filename))
end
--
-- todo: also other stubs
diff --git a/scripts/context/lua/mtx-modules.lua b/scripts/context/lua/mtx-modules.lua
new file mode 100644
index 000000000..65d9330ba
--- /dev/null
+++ b/scripts/context/lua/mtx-modules.lua
@@ -0,0 +1,162 @@
+if not modules then modules = { } end modules ['mtx-modules'] = {
+ version = 1.002,
+ comment = "companion to mtxrun.lua",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+scripts = scripts or { }
+scripts.modules = scripts.modules or { }
+
+-- Documentation can be woven into a source file. This script can generates
+-- a file with the documentation and source fragments properly tagged. The
+-- documentation is included as comment:
+--
+-- %D ...... some kind of documentation
+-- %M ...... macros needed for documenation
+-- %S B begin skipping
+-- %S E end skipping
+--
+-- The generated file is structured as:
+--
+-- \starttypen
+-- \startmodule[type=suffix]
+-- \startdocumentation
+-- \stopdocumentation
+-- \startdefinition
+-- \stopdefinition
+-- \stopmodule
+-- \stoptypen
+--
+-- Macro definitions specific to the documentation are not surrounded by
+-- start-stop commands. The suffix specificaction can be overruled at runtime,
+-- but defaults to the file extension. This specification can be used for language
+-- depended verbatim typesetting.
+
+local find, format, sub, is_empty, strip = string.find, string.format, string.sub, string.is_empty, string.strip
+
+local function source_to_ted(inpname,outname,filetype)
+ local inp = io.open(inpname)
+ if not inp then
+ logs.simple("unable to open '%s'",inpname)
+ end
+ local out = io.open(outname,"w")
+ if not out then
+ logs.simple("unable to open '%s'",outname)
+ end
+ logs.simple("converting '%s' to '%s'",inpname,outname)
+ local skiplevel, indocument, indefinition = 0, false, false
+ out:write(format("\\startmodule[type=%s]\n",filetype or file.suffix(inpname)))
+ for line in inp:lines() do
+ line = strip(line)
+ if find(line,"^%%D ") or find(line,"^%%D$") then
+ if skiplevel == 0 then
+ local someline = (#line < 3 and "") or sub(line,4,#line)
+ if indocument then
+ out:write(format("%s\n",someline))
+ else
+ if indefinition then
+ out:write("\\stopdefinition\n")
+ indefinition = false
+ end
+ if not indocument then
+ out:write("\n\\startdocumentation\n")
+ end
+ out:write(format("%s\n",someline))
+ indocument = true
+ end
+ end
+ elseif find(line,"^%%M ") or find(line,"^%%M$") then
+ if skiplevel == 0 then
+ local someline = (#line < 3 and "") or sub(line,4,#line)
+ out:write(format("%s\n",someline))
+ end
+ elseif find(line,"^%%S B") then
+ skiplevel = skiplevel + 1
+ elseif find(line,"^%%S E") then
+ skiplevel = skiplevel - 1
+ elseif find(line,"^%%") then
+ -- nothing
+ elseif skiplevel == 0 then
+ inlocaldocument = indocument
+ inlocaldocument = false
+ local someline = line
+ if indocument then
+ out:write("\\stopdocumentation\n")
+ indocument = false
+ end
+ if indefinition then
+ if is_empty(someline) then
+ out:write("\\stopdefinition\n")
+ indefinition = false
+ else
+ out:write(format("%s\n",someline))
+ end
+ elseif not is_empty(someline) then
+ out:write("\n\\startdefinition\n")
+ indefinition = true
+ if inlocaldocument then
+ -- nothing
+ else
+ out:write(format("%s\n",someline))
+ end
+ end
+ end
+ end
+ if indocument then
+ out:write("\\stopdocumentation\n")
+ end
+ if indefinition then
+ out:write("\\stopdefinition\n")
+ end
+ out:write("\\stopmodule\n")
+ out:close()
+ inp:close()
+ return true
+end
+
+local suffixes = table.tohash { 'tex','mkii','mkiv','mp' }
+
+function scripts.modules.process(runtex)
+ local processed = { }
+ local prep = environment.argument("prep")
+ for _, shortname in ipairs(environment.files) do
+ local suffix = file.suffix(shortname)
+ if suffixes[suffix] then
+ local longname
+ if prep then
+ longname = shortname .. ".prep"
+ else
+ longname = file.removesuffix(shortname) .. "-" .. suffix .. ".ted"
+ end
+ local done = source_to_ted(shortname,longname)
+ if done and runtex then
+ os.execute(format("mtxrun --script context --usemodule=mod-01 %s",longname))
+ processed[#processed+1] = longname
+ end
+ end
+ end
+ for _, name in ipairs(processed) do
+ logs.simple("modules","processed: %s",name)
+ end
+end
+
+-- context --ctx=m-modules.ctx xxx.mkiv
+
+
+logs.extendbanner("Module Documentation Tools 1.0",true)
+
+messages.help = [[
+--convert convert source files (tex, mkii, mkiv, mp) to 'ted' files
+--process process source files (tex, mkii, mkiv, mp) to 'pdf' files
+--prep use original name with suffix 'prep' appended
+]]
+
+if environment.argument("process") then
+ scripts.modules.process(true)
+elseif environment.argument("convert") then
+ scripts.modules.process(false)
+else
+ logs.help(messages.help)
+end
diff --git a/scripts/context/ruby/texexec.rb b/scripts/context/ruby/texexec.rb
index 94b14e428..747d76b68 100644
--- a/scripts/context/ruby/texexec.rb
+++ b/scripts/context/ruby/texexec.rb
@@ -164,7 +164,8 @@ class Commands
if fast or (files.length > 0) then
if f = File.open(job.tempfilename('tex'),'w') then
files.delete("texexec.pdf")
- Kpse.runscript('rlxtools', ['--identify','--collect'], files.join(' ')) unless fast
+ # Kpse.runscript('rlxtools', ['--identify','--collect'], files.join(' ')) unless fast
+ system("texmfstart rlxtools --identify --collect #{files.join(' ')}")
figures = @commandline.checkedoption('method', 'a').downcase
paperoffset = @commandline.checkedoption('paperoffset', '0pt')
backspace = @commandline.checkedoption('backspace', '1.5cm')
@@ -226,7 +227,8 @@ class Commands
else
markfile = nil
end
- Kpse.runscript('ctxtools',ffname,'--document')
+ # Kpse.runscript('ctxtools',['--document'],ffname)
+ system("texmfstart ctxtools --document #{ffname}")
if ted = File.silentopen(File.suffixed(ffname,'ted')) then
firstline = ted.gets
if firstline =~ /interface=/o then
diff --git a/tex/context/base/bibl-tra.lua b/tex/context/base/bibl-tra.lua
index b38fbae71..b2603a71d 100644
--- a/tex/context/base/bibl-tra.lua
+++ b/tex/context/base/bibl-tra.lua
@@ -13,16 +13,18 @@ local match, gmatch, format, concat, sort = string.match, string.gmatch, string.
local texsprint, ctxcatcodes = tex.sprint, tex.ctxcatcodes
local variables, constants = interfaces.variables, interfaces.constants
+local trace_bibtex = false trackers.register("publications.bibtex", function(v) trace_bibtex = v end)
+
local hacks = bibtex.hacks
local list, done, alldone, used, registered, ordered = { }, { }, { }, { }, { }, { }
local mode = 0
-local template = [[
+local template = string.striplong([[
\citation{*}
- \bibstyle{%s}
+ \bibstyle{cont-%s}
\bibdata{%s}
-]]
+]])
function hacks.process(settings)
local style = settings.style or ""
@@ -31,12 +33,18 @@ function hacks.process(settings)
if database ~= "" then
interfaces.showmessage("publications",3)
io.savedata(file.addsuffix(jobname,"aux"),format(template,style,database))
+ if trace_bibtex then
+ logs.report("publications","processing bibtex file '%s'",jobname)
+ end
os.execute(format("bibtex %s",jobname))
-- purge 'm
end
end
function hacks.register(str)
+ if trace_bibtex then
+ logs.report("publications","registering bibtex entry '%s'",str)
+ end
registered[#registered+1] = str
ordered[str] = #registered
end
diff --git a/tex/context/base/bibl-tra.mkii b/tex/context/base/bibl-tra.mkii
index 6e5e7c1ef..0f7c9b99d 100644
--- a/tex/context/base/bibl-tra.mkii
+++ b/tex/context/base/bibl-tra.mkii
@@ -176,37 +176,41 @@
%D how to load the references. There is some new stuff here
%D to support Idris' (incorrect :-)) use of projects
-\let\preloadbiblist\relax
-
-\ifx\currentcomponent\v!text
- % single file
- \edef\temp{\the\everystarttext}%
- \ifx\temp\empty
- % post-starttext
- \def\preloadbiblist{\dousepublications\jobname }%
- \else
- % pre-starttext
- \appendtoks \dousepublications\jobname \to \everystarttext
- \fi
- %
-\else \ifx\currentcomponent\v!project
- % a project file, have to set up the partial products!
- \def\startproduct #1 %
- {\doateverystarttext
- \dousepublications{#1}%
- \donextlevel\v!product\currentproduct
- \doexecutefileonce\doexecutefileonce
- \donotexecutefile\doexecutefile#1\\}%
- %
-\else \ifx\currentcomponent\v!product
- % a product file
- \def\preloadbiblist{\dousepublications\jobname }%
- %
-\else
- % a component? not sure what to do
- \def\preloadbiblist{\dousepublications\jobname }%
- %
-\fi \fi \fi
+% \let\preloadbiblist\relax
+%
+% \ifx\currentcomponent\v!text
+% % single file
+% \edef\temp{\the\everystarttext}%
+% \ifx\temp\empty
+% % post-starttext
+% \def\preloadbiblist{\dousepublications\jobname }%
+% \else
+% % pre-starttext
+% \appendtoks \dousepublications\jobname \to \everystarttext
+% \fi
+% %
+% \else \ifx\currentcomponent\v!project
+% % a project file, have to set up the partial products!
+% \def\startproduct #1 %
+% {\doateverystarttext
+% \dousepublications{#1}%
+% \donextlevel\v!product\currentproduct
+% \doexecutefileonce\doexecutefileonce
+% \donotexecutefile\doexecutefile#1\\}%
+% %
+% \else \ifx\currentcomponent\v!product
+% % a product file
+% \def\preloadbiblist{\dousepublications\jobname }%
+% %
+% \else
+% % a component? not sure what to do
+% \def\preloadbiblist{\dousepublications\jobname }%
+% %
+% \fi \fi \fi
+
+\def\preloadbiblist
+ {\globallet\preloadbiblist\relax
+ \dousepublications\jobname}
\definelist[pubs]
\setuplist[pubs][\c!width=]
@@ -1176,10 +1180,12 @@
%D Some macros to fetch the information provided by
%D \type{\startpublication}.
-\def\doifbibreferencefoundelse#1#2#3%
- {\doifdefinedelse{pbdk-#1}
- {#2}
- {\showmessage\m!publications{5}{#1 is unknown}#3}}
+\def\doifbibreferencefoundelse#1%
+ {\preloadbiblist
+ \doifdefinedelse{pbdk-#1}
+ {\firstiftwoarguments}
+ {\showmessage\m!publications{5}{#1 is unknown}%
+ \secondoftwoarguments}}
%D \macros{ixbibauthoryear,thebibauthors,thebibyears}
%D
diff --git a/tex/context/base/bibl-tra.mkiv b/tex/context/base/bibl-tra.mkiv
index 2be7f47bf..485d93fb7 100644
--- a/tex/context/base/bibl-tra.mkiv
+++ b/tex/context/base/bibl-tra.mkiv
@@ -163,7 +163,6 @@
%D \item All constants, variables, message etc.\ are now in the core.
%D \item Added: method=local|global (when global, previous shown entries are
%D not shown again.
-%D \item Added: state=start for initial loading.
%D \stopitemize
%D
%D \subject{WISHLIST}
@@ -724,6 +723,8 @@
% storing the keys in lua (and then do more in lua) and use calls to
% fetch the variables
+% hm, we can store at the lua end ...
+
\long\def\dostartpublication[#1]#2\stoppublication
{\doifassignmentelse{#1}%
{\getparameters[\??pb][k=\s!unknown,t=article,n=,s=,a=,y=,o=,u=,#1]}%
@@ -751,8 +752,11 @@
\def\bibgetvaru#1{\csname pbd:#1\endcsname\pluseight}
\def\bibgetvard#1{\csname pbd:#1\endcsname\plusnine }
-\def\doifbibreferencefoundelse#1#2#3%
- {\doifdefinedelse{pbd:#1}{#2}{\showmessage\m!publications{5}{#1 is unknown}#3}}
+\def\doifbibreferencefoundelse#1%
+ {\preloadbiblist
+ \doifdefinedelse{pbd:#1}
+ \firstoftwoarguments
+ {\showmessage\m!publications{5}{#1 is unknown}\secondoftwoarguments}}
%D \macros{bib@crossref}
%D
@@ -1490,19 +1494,17 @@
\def\c!monthconversion{monthconversion} % todo
\setuppublications
- [\c!state=\v!stop,
- \c!monthconversion=,
+ [\c!monthconversion=,
\c!alternative=apa,
\c!method=\v!global,
\c!refcommand=num,
\c!numbercommand=\bibleftnumber]
\def\preloadbiblist
- {\doif\@@pbstate\v!start
- {\globallet\preloadbiblist\relax
- \dousepublications\jobname}}
+ {\globallet\preloadbiblist\relax
+ \dousepublications\jobname}
-\appendtoks \preloadbiblist \to \everysetuppublications
-\appendtoks \preloadbiblist \to \everystarttext
+% \appendtoks \preloadbiblist \to \everysetuppublications
+% \appendtoks \preloadbiblist \to \everystarttext
\protect \endinput
diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii
index 8b5bed657..2defba6d7 100644
--- a/tex/context/base/cont-new.mkii
+++ b/tex/context/base/cont-new.mkii
@@ -16,4 +16,7 @@
\long\def\startluacode#1\stopluacode{}
\long\def\ctxlua #1{}
+\def\enabletrackers [#1]{}
+\def\disabletrackers[#1]{}
+
\endinput
diff --git a/tex/context/base/cont-new.tex b/tex/context/base/cont-new.tex
index 10c71dd06..6d028186b 100644
--- a/tex/context/base/cont-new.tex
+++ b/tex/context/base/cont-new.tex
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2009.09.09 14:31}
+\newcontextversion{2009.09.11 18:14}
%D This file is loaded at runtime, thereby providing an
%D excellent place for hacks, patches, extensions and new
diff --git a/tex/context/base/context.tex b/tex/context/base/context.tex
index 05612a3e0..4c95b9f59 100644
--- a/tex/context/base/context.tex
+++ b/tex/context/base/context.tex
@@ -20,7 +20,7 @@
%D your styles an modules.
\edef\contextformat {\jobname}
-\edef\contextversion{2009.09.09 14:31}
+\edef\contextversion{2009.09.11 18:14}
%D For those who want to use this:
diff --git a/tex/context/base/core-ctx.lua b/tex/context/base/core-ctx.lua
index 7c6cef07a..4dbff3663 100644
--- a/tex/context/base/core-ctx.lua
+++ b/tex/context/base/core-ctx.lua
@@ -18,13 +18,13 @@ function commands.loadctxpreplist()
local x = xml.load(ctlname)
if x then
islocal = xml.found(x,"ctx:preplist[@local=='yes']")
- if trace_prepfiles then
+--~ if trace_prepfiles then
if islocal then
commands.writestatus("systems","loading ctx log file (local)") -- todo: m!systems
else
commands.writestatus("systems","loading ctx log file (specified)") -- todo: m!systems
end
- end
+--~ end
for r, d, k in xml.elements(x,"ctx:prepfile") do
local dk = d[k]
local name = xml.content(dk)
diff --git a/tex/context/base/core-ctx.mkiv b/tex/context/base/core-ctx.mkiv
index c401b09f0..9bf456952 100644
--- a/tex/context/base/core-ctx.mkiv
+++ b/tex/context/base/core-ctx.mkiv
@@ -21,6 +21,8 @@
\def\loadctxpreplist{\ctxlua{commands.loadctxpreplist()}\global\let\loadctxpreplist\relax}
-\appendtoks\loadctxpreplist\to\everystarttext % will become: \prependtoks\loadctxpreplist\to\everyjob
+% \prependtoks\loadctxpreplist\to\everyjob
+
+\appendtoks\loadctxpreplist\to\everystarttext
\protect \endinput
diff --git a/tex/context/base/l-number.lua b/tex/context/base/l-number.lua
index c0434fd5d..39ca2c6b6 100644
--- a/tex/context/base/l-number.lua
+++ b/tex/context/base/l-number.lua
@@ -6,7 +6,7 @@ if not modules then modules = { } end modules ['l-number'] = {
license = "see context related readme files"
}
-local format = string.format
+local format, foor, insert = string.format, math.floor, table.insert
number = number or { }
@@ -42,4 +42,15 @@ function number.toset(n)
return one:match(tostring(n))
end
-
+function number.bits(n,zero)
+ local t, i = { }, (zero and 0) or 1
+ while n > 0 do
+ local m = n % 2
+ if m > 0 then
+ insert(t,1,i)
+ end
+ n = floor(n/2)
+ i = i + 1
+ end
+ return t
+end
diff --git a/tex/context/base/l-string.lua b/tex/context/base/l-string.lua
index faee66c54..0ee6d86d1 100644
--- a/tex/context/base/l-string.lua
+++ b/tex/context/base/l-string.lua
@@ -191,6 +191,16 @@ function string:pattesc()
return (gsub(self,".",patterns_escapes))
end
+local simple_escapes = {
+ ["-"] = "%-",
+ ["."] = "%.",
+ ["*"] = ".*",
+}
+
+function string:simpleesc()
+ return (gsub(self,".",simple_escapes))
+end
+
function string:tohash()
local t = { }
for s in gmatch(self,"([^, ]+)") do -- lpeg
@@ -239,3 +249,9 @@ function string:compactlong() -- strips newlines and leading spaces
self = gsub(self,"^ *","")
return self
end
+
+function string:striplong() -- strips newlines and leading spaces
+ self = gsub(self,"^%s*","")
+ self = gsub(self,"[\n\r]+ *","\n")
+ return self
+end
diff --git a/tex/context/base/lpdf-fld.lua b/tex/context/base/lpdf-fld.lua
index 0c2534699..a4524c09d 100644
--- a/tex/context/base/lpdf-fld.lua
+++ b/tex/context/base/lpdf-fld.lua
@@ -12,6 +12,8 @@ if not modules then modules = { } end modules ['lpdf-fld'] = {
local gmatch, lower, format = string.gmatch, string.lower, string.format
+local trace_fields = false trackers.register("widgets.fields", function(v) trace_fields = v end)
+
local texsprint, ctxcatcodes = tex.sprint, tex.ctxcatcodes
local variables = interfaces.variables
@@ -221,9 +223,9 @@ local function fieldappearances(specification)
return lpdf.sharedobj(tostring(appearance))
end
-local function fieldstates(specification,forceyes)
+local function fieldstates(specification,forceyes,values,default)
-- we don't use Opt here (too messy for radio buttons)
- local values, default = specification.values, specification.default
+ local values, default = values or specification.values, default or specification.default
if not values then
-- error
return
@@ -265,7 +267,11 @@ local function fieldstates(specification,forceyes)
if not offvalue then
offvalue = offn
end
- forceyes = forceyes and "On" -- spec likes Yes more but we've used On for ages now
+ if forceyes == true then
+ forceyes = forceyes and "On" -- spec likes Yes more but we've used On for ages now
+ else
+ -- false or string
+ end
if default == yesn then
default = pdfconstant(forceyes or yesn)
else
@@ -298,7 +304,7 @@ local function fieldoptions(specification)
end
end
-local function radiodefault(parent,field)
+local function radiodefault(parent,field,forceyes)
local default, values = parent.default, parent.values
if not default or default == "" then
values = aux.settings_to_array(values)
@@ -308,9 +314,9 @@ local function radiodefault(parent,field)
local fieldvalues = aux.settings_to_array(field.values)
local yes, off = fieldvalues[1], fieldvalues[2] or fieldvalues[1]
if not default then
- return pdfconstant(yes)
+ return pdfconstant((forceyes and "On") or yes)
elseif default == name then
- return pdfconstant(default)
+ return pdfconstant((forceyes and "On") or default)
else
return pdfconstant("Off")
end
@@ -325,7 +331,7 @@ end
-- defining
-local fields, radios, fieldsets, calculationset = { }, { }, { }, nil
+local fields, radios, clones, fieldsets, calculationset = { }, { }, { }, { }, nil
function codeinjections.definefieldset(tag,list)
fieldsets[tag] = list
@@ -382,14 +388,15 @@ function codeinjections.getdefaultfieldvalue(name)
end
end
-
function codeinjections.definefield(specification)
local n = specification.name
local f = fields[n]
if not f then
local kind = specification.kind
if not kind then
- -- name and kind are mandate
+ if trace_fields then
+ logs.report("fields","invalid definition of '%s': unknown type",n)
+ end
elseif kind == "radio" then
local values = specification.values
if values and values ~= "" then
@@ -398,8 +405,11 @@ function codeinjections.definefield(specification)
radios[values[v]] = { parent = n }
end
fields[n] = specification
- else
- -- invalid radio specification
+ if trace_fields then
+ logs.report("fields","defining '%s' as radio",n or "?")
+ end
+ elseif trace_fields then
+ logs.report("fields","invalid definition of radio '%s': missing values",n)
end
elseif kind == "sub" then
-- not in main field list !
@@ -409,38 +419,67 @@ function codeinjections.definefield(specification)
for key, value in next, specification do
radio[key] = value
end
+ if trace_fields then
+ local p = radios[n] and radios[n].parent
+ logs.report("fields","defining '%s' as sub of radio '%s'",n or "?",p or "?")
+ end
+ elseif trace_fields then
+ logs.report("fields","invalid definition of radio sub '%s': no parent",n)
end
predefinesymbols(specification)
else
fields[n] = specification
+ if trace_fields then
+ logs.report("fields","defining '%s' as %s",n,kind)
+ end
predefinesymbols(specification)
end
- else
- -- already done
+ elseif trace_fields then
+ logs.report("fields","invalid definition of '%s': already defined",n)
end
end
function codeinjections.clonefield(specification)
- local p = specification.parent
- local c = specification.children
+ local p, c, v = specification.parent, specification.children, specification.variant
if not p or not c then
- -- parent and children are mandate
+ if trace_fields then
+ logs.report("fields","invalid clone: children: '%s', parent '%s', variant: '%s'",p or "?",c or "?", v or "?")
+ end
else
for n in gmatch(c,"[^, ]+") do
- local f = fields[n]
- if f and not f.done then
- -- already done
+ local f, r, c, x = fields[n], radios[n], clones[n], fields[p]
+ if f or r or c then
+ if trace_fields then
+ logs.report("fields","already cloned: child: '%s', parent '%s', variant: '%s'",p or "?",n or "?", v or "?")
+ end
+ elseif x then
+ if trace_fields then
+ logs.report("fields","invalid clone: child: '%s', variant: '%s', no parent",n or "?", v or "?")
+ end
else
- fields[n] = specification
+ if trace_fields then
+ logs.report("fields","cloning: child: '%s', parent '%s', variant: '%s'",p or "?",n or "?", v or "?")
+ end
+ clones[n] = specification
+ predefinesymbols(specification)
end
end
end
end
function codeinjections.getfieldgroup(name)
- local f = fields[name]
- if f and f.group then
- texsprint(ctxcatcodes,f.group)
+ local f = fields[name] or radios[name] or clones[name]
+ local g = f and f.group
+ if not g then
+ local v = f.variant
+ if v == "clone" or v == "copy" then
+ local p = f.parent
+ f = fields[p] or radios[p]
+ g = f and f.group
+ end
+ end
+ if g then
+ texsprint(ctxcatcodes,g)
end
end
@@ -520,15 +559,21 @@ local pdf_no_rect = pdfarray { 0, 0, 0, 0 }
local methods = { }
function codeinjections.typesetfield(name,specification)
- local field = fields[name] or radios[name]
+ local field = fields[name] or radios[name] or clones[name]
if not field then
- tex.write("error: " .. name)
+ logs.report("fields", "unknown child '%s'",name)
-- unknown field
return
end
+ local variant, parent = field.variant, field.parent
+ if variant == "copy" or variant == "clone" then -- only in clones
+ field = fields[parent] or radios[parent]
+ end
local method = methods[field.kind]
if method then
- method(name,specification)
+ method(name,specification,variant)
+ else
+ logs.report("fields", "unknown method '%s' for child '%s'",field.kind,name)
end
end
@@ -550,10 +595,16 @@ local function save_kid(field,specification,d)
node.write(nodes.pdfannot(specification.width,specification.height,0,d(),kn))
end
-function methods.line(name,specification,extras)
+function methods.line(name,specification,variant,extras)
local field = fields[name]
+ if variant == "copy" or variant == "clone" then
+ logs.report("fields","todo: clones of text fields")
+ end
local kind = field.kind
if not field.pobj then
+ if trace_fields then
+ logs.report("fields","using parent text '%s'",name)
+ end
if extras then
enhance(specification,extras)
end
@@ -576,6 +627,9 @@ function methods.line(name,specification,extras)
field.specification = specification
end
specification = field.specification or { } -- todo: radio spec
+ if trace_fields then
+ logs.report("fields","using child text '%s'",name)
+ end
local d = pdfdictionary {
Subtype = pdf_widget,
Parent = pdfreference(field.pobj),
@@ -589,15 +643,21 @@ function methods.line(name,specification,extras)
save_kid(field,specification,d)
end
-function methods.text(name,specification)
- methods.line(name,specification,"MultiLine")
+function methods.text(name,specification,variant)
+ methods.line(name,specification,variant,"MultiLine")
end
-function methods.choice(name,specification,extras)
+function methods.choice(name,specification,variant,extras)
local field = fields[name]
+ if variant == "copy" or variant == "clone" then
+ logs.report("fields","todo: clones of choice fields")
+ end
local kind = field.kind
local d
if not field.pobj then
+ if trace_fields then
+ logs.report("fields","using parent choice '%s'",name)
+ end
if extras then
enhance(specification,extras)
end
@@ -615,6 +675,9 @@ function methods.choice(name,specification,extras)
field.specification = specification
end
specification = field.specification or { }
+ if trace_fields then
+ logs.report("fields","using child choice '%s'",name)
+ end
local d = pdfdictionary {
Subtype = pdf_widget,
Parent = pdfreference(field.pobj),
@@ -626,23 +689,29 @@ function methods.choice(name,specification,extras)
save_kid(field,specification,d)
end
-function methods.popup(name,specification)
- methods.choice(name,specification,"PopUp")
+function methods.popup(name,specification,variant)
+ methods.choice(name,specification,variant,"PopUp")
end
-function methods.combo(name,specification)
- methods.choice(name,specification,"PopUp,Edit")
+function methods.combo(name,specification,variant)
+ methods.choice(name,specification,variant,"PopUp,Edit")
end
-- Probably no default appearance needed for first kid and no javascripts for the
-- parent ... I will look into it when I have to make a complex document.
-function methods.check(name,specification)
+function methods.check(name,specification,variant)
-- no /Opt because (1) it's messy - see pdf spec, (2) it discouples kids and
-- contrary to radio there is no way to associate then
local field = fields[name]
+ if variant == "copy" or variant == "clone" then
+ logs.report("fields","todo: clones of check fields")
+ end
local kind = field.kind
local appearance, default = fieldstates(field,true)
if not field.pobj then
+ if trace_fields then
+ logs.report("fields","using parent check '%s'",name)
+ end
local d = pdfdictionary {
Subtype = pdf_widget,
T = pdfunicode(specification.title),
@@ -661,6 +730,9 @@ function methods.check(name,specification)
field.specification = specification
end
specification = field.specification or { } -- todo: radio spec
+ if trace_fields then
+ logs.report("fields","using child check '%s'",name)
+ end
local d = pdfdictionary {
Subtype = pdf_widget,
Parent = pdfreference(field.pobj),
@@ -677,10 +749,16 @@ function methods.check(name,specification)
save_kid(field,specification,d)
end
-function methods.push(name,specification)
+function methods.push(name,specification,variant)
local field = fields[name]
+ if variant == "copy" or variant == "clone" then
+ logs.report("fields","todo: clones of push fields")
+ end
local kind = field.kind
if not field.pobj then
+ if trace_fields then
+ logs.report("fields","using parent push '%s'",name)
+ end
enhance(specification,"PushButton")
local d = pdfdictionary {
Subtype = pdf_widget,
@@ -697,6 +775,9 @@ function methods.push(name,specification)
field.specification = specification
end
specification = field.specification or { } -- todo: radio spec
+ if trace_fields then
+ logs.report("fields","using child push '%s'",name)
+ end
local d = pdfdictionary {
Subtype = pdf_widget,
Parent = pdfreference(field.pobj),
@@ -710,18 +791,29 @@ function methods.push(name,specification)
save_kid(field,specification,d)
end
-function methods.sub(name,specification)
- local field = radios[name]
- if not field then
- return
+function methods.sub(name,specification,variant)
+ local field = radios[name] or fields[name] or clones[name] -- fields in case of a clone, maybe use dedicated clones
+ local values
+ if variant == "copy" or variant == "clone" then
+ name = field.parent
+ values = field.values -- clone only, copy has nil so same as parent
+ field = radios[name]
+ else
+ values = field.values
end
local parent = fields[field.parent]
if not parent then
return
end
+ local appearance = fieldstates(field,name,values) -- we need to force the 'On' name
+ local default = radiodefault(parent,field)
if not parent.pobj then
+ if trace_fields then
+ logs.report("fields","using parent '%s' of radio '%s' with values '%s' and default '%s'",parent.name,name,parent.values or "?",parent.default or "?")
+ end
local specification = parent.specification or { }
- enhance(specification,"Radio,RadiosInUnison")
+ -- enhance(specification,"Radio,RadiosInUnison")
+ enhance(specification,"RadiosInUnison") -- maybe also PushButton as acrobat does
local d = pdfdictionary {
T = parent.name,
FT = pdf_btn,
@@ -729,11 +821,13 @@ function methods.sub(name,specification)
F = fieldplus(specification),
Ff = fieldflag(specification),
H = pdf_n,
+ V = default,
}
save_parent(parent,specification,d)
end
- local appearance = fieldstates(field)
- local default = radiodefault(parent,field)
+ if trace_fields then
+ logs.report("fields","using child radio '%s' with values '%s'",name,values or "?")
+ end
local d = pdfdictionary {
Subtype = pdf_widget,
Parent = pdfreference(parent.pobj),
@@ -741,8 +835,6 @@ function methods.sub(name,specification)
DA = fieldattributes(specification),
OC = fieldlayer(specification),
AA = fieldactions(specification),
- DV = default,
- V = default,
AS = default,
AP = appearance,
H = pdf_n,
diff --git a/tex/context/base/luat-run.lua b/tex/context/base/luat-run.lua
index 8e0579b00..44126f526 100644
--- a/tex/context/base/luat-run.lua
+++ b/tex/context/base/luat-run.lua
@@ -62,7 +62,7 @@ end
-- this can be done later
callback.register('start_run', main.start)
-callback.register('stop_run' , main.stop)
+callback.register('stop_run', main.stop)
callback.register('report_output_pages', main.report_output_pages)
callback.register('report_output_log' , main.report_output_log)
callback.register('start_page_number' , main.start_shipout_page)
diff --git a/tex/context/base/math-def.mkiv b/tex/context/base/math-def.mkiv
index ad5e40672..e9291893b 100644
--- a/tex/context/base/math-def.mkiv
+++ b/tex/context/base/math-def.mkiv
@@ -39,9 +39,9 @@
\doifelse{\mathematicsparameter\v!autopunctuation}\v!yes\enablemathpunctuation\disablemathpunctuation
\to \everysetupmathematics
-\appendtoks
- \ifconditional\automathpunctuation\dosetattribute{mathpunc}\plusone\fi
-\to \everymathematics
+% \appendtoks
+% \ifconditional\automathpunctuation\dosetattribute{mathpunctuation}\plusone\fi
+% \to \everymathematics
\setupmathematics[\v!autopunctuation=\v!yes]
diff --git a/tex/context/base/math-dim.lua b/tex/context/base/math-dim.lua
index bd6e660df..bc3646872 100644
--- a/tex/context/base/math-dim.lua
+++ b/tex/context/base/math-dim.lua
@@ -204,7 +204,6 @@ end
-- local mt = { } setmetatable(defaults,mt)
--
-- mt.__index = function(t,s)
--- texio.write_nl("GETTING " .. s)
-- return t.default or t.text_style or 0
-- end
@@ -301,7 +300,6 @@ function mathematics.dimensions(dimens)
StretchStackBottomShiftDown = t . under_delimiter_bgap . text_style,
}
d.AccentBaseHeight = 0
- -- texio.write_nl(table.serialize(d))
return t, d -- this might change
else
return { }, { }
diff --git a/tex/context/base/math-ini.lua b/tex/context/base/math-ini.lua
index 093a635ff..9303858b0 100644
--- a/tex/context/base/math-ini.lua
+++ b/tex/context/base/math-ini.lua
@@ -68,6 +68,7 @@ classes.variable = classes.alphabetic
classes.number = classes.alphabetic
-- there will be proper functions soon (and we will move this code in-line)
+-- no need for " in class and family (saves space)
local function delcode(target,family,slot)
return format('\\Udelcode%s="%X "%X ',target,family,slot)
diff --git a/tex/context/base/math-ini.mkiv b/tex/context/base/math-ini.mkiv
index 51a9f8433..c7db680e5 100644
--- a/tex/context/base/math-ini.mkiv
+++ b/tex/context/base/math-ini.mkiv
@@ -94,17 +94,37 @@
\unexpanded\def\fraktur {\ifmmode\expandafter\mathfraktur \fi}
\unexpanded\def\gothic {\ifmmode\expandafter\mathfraktur \fi}
-\unexpanded\def\mathcal #1{{\setmathalphabet{script}#1}} % for AMS compatibility
-\unexpanded\def\mathfrak#1{{\setmathalphabet{fraktur}#1}} % for AMS compatibility
-\unexpanded\def\mathbb #1{{\setmathalphabet{blackboard}#1}} % for AMS compatibility
+\unexpanded\def\mathcal #1{{\mathscript #1}} % for AMS compatibility
+\unexpanded\def\mathfrak#1{{\mathfraktur #1}} % for AMS compatibility
+\unexpanded\def\mathbb #1{{\mathblackboard#1}} % for AMS compatibility
\let\normalmr\mr
+% \prependtoks
+% \let\mr\normalmr
+% \let\rm\mathrm \let\ss\mathss \let\tt\mathtt
+% \let\tf\mathtf \let\bf\mathbf \let\it\mathit \let\sl\mathsl \let\bi\mathbi \let\bs\mathbs
+% \let\frak\mathfraktur \let\cal\mathscript \let\bbd\mathblackboard
+% \mathdefault
+% \to \everymathematics
+
+\let\normaltf\tf \unexpanded\def\tf{\ifmmode\mathtf\else\normaltf\fi}
+\let\normalbf\bf \unexpanded\def\bf{\ifmmode\mathbf\else\normalbf\fi}
+\let\normalit\it \unexpanded\def\it{\ifmmode\mathit\else\normalit\fi}
+\let\normalsl\sl \unexpanded\def\sl{\ifmmode\mathsl\else\normalsl\fi}
+\let\normalbi\bi \unexpanded\def\bi{\ifmmode\mathbi\else\normalbi\fi}
+\let\normalbs\bs \unexpanded\def\bs{\ifmmode\mathbs\else\normalbs\fi}
+
+\let\normalrm\rm \unexpanded\def\rm{\ifmmode\mathrm\else\normalrm\fi}
+\let\normalss\ss \unexpanded\def\ss{\ifmmode\mathss\else\normalss\fi}
+\let\normaltt\tt \unexpanded\def\tt{\ifmmode\mathtt\else\normaltt\fi}
+ \unexpanded\def\mr{\ifmmode \normalmr\fi}
+
\prependtoks
- \let\mr\normalmr
- \let\rm\mathrm \let\ss\mathss \let\tt\mathtt
- \let\tf\mathtf \let\bf\mathbf \let\it\mathit \let\sl\mathsl \let\bi\mathbi \let\bs\mathbs
- \let\frak\mathfraktur \let\cal\mathscript \let\bbd\mathblackboard
+% \let\mr\normalmr
+% \let\rm\mathrm \let\ss\mathss \let\tt\mathtt
+% \let\tf\mathtf \let\bf\mathbf \let\it\mathit \let\sl\mathsl \let\bi\mathbi \let\bs\mathbs
+% \let\frak\mathfraktur \let\cal\mathscript \let\bbd\mathblackboard
\mathdefault
\to \everymathematics
@@ -427,24 +447,30 @@
%D \stopTEXpage
%D \stoptyping
-% [lc uc] normal (upright) = 1, italic = 2, none = 0
+% [lc uc] normal (upright) = 2, italic = 3, none = 0/1
+
+\setevalue{\??mo:greek:\v!normal :\v!normal }{\dosetattribute {mathgreek}{22}}
+\setevalue{\??mo:greek:\v!normal :\v!italic }{\dosetattribute {mathgreek}{23}}
+\setevalue{\??mo:greek:\v!normal :\v!default}{\dosetattribute {mathgreek}{21}}
+
+\setevalue{\??mo:greek:\v!italic :\v!normal }{\dosetattribute {mathgreek}{32}}
+\setevalue{\??mo:greek:\v!italic :\v!italic }{\dosetattribute {mathgreek}{33}}
+\setevalue{\??mo:greek:\v!italic :\v!default}{\dosetattribute {mathgreek}{31}}
+
+\setevalue{\??mo:greek:\v!default:\v!normal }{\dosetattribute {mathgreek}{12}}
+\setevalue{\??mo:greek:\v!default:\v!italic }{\dosetattribute {mathgreek}{13}}
+\setevalue{\??mo:greek:\v!default:\v!default}{\doresetattribute{mathgreek}}
+
+% bonus:
-\setevalue{\??mo:greek:\v!normal:\v!normal}{\dosetattribute {mathgreek}{11}}
-\setevalue{\??mo:greek:\v!normal:\v!italic}{\dosetattribute {mathgreek}{12}}
-\setevalue{\??mo:greek:\v!normal:\v!none }{\dosetattribute {mathgreek}{10}}
-\setevalue{\??mo:greek:\v!italic:\v!normal}{\dosetattribute {mathgreek}{21}}
-\setevalue{\??mo:greek:\v!italic:\v!italic}{\dosetattribute {mathgreek}{22}}
-\setevalue{\??mo:greek:\v!italic:\v!none }{\dosetattribute {mathgreek}{20}}
-\setevalue{\??mo:greek:\v!none :\v!normal}{\dosetattribute {mathgreek}{01}}
-\setevalue{\??mo:greek:\v!none :\v!italic}{\dosetattribute {mathgreek}{02}}
-\setevalue{\??mo:greek:\v!none :\v!none }{\doresetattribute{mathgreek}}
+\setevalue{\??mo:greek:\v!normal :\v!none }{\dosetattribute {mathgreek}{21}}
+\setevalue{\??mo:greek:\v!italic :\v!none }{\dosetattribute {mathgreek}{31}}
+\setevalue{\??mo:greek:\v!none :\v!normal }{\dosetattribute {mathgreek}{12}}
+\setevalue{\??mo:greek:\v!none :\v!italic }{\dosetattribute {mathgreek}{13}}
+\setevalue{\??mo:greek:\v!none :\v!none }{\doresetattribute{mathgreek}}
\appendtoks
- \csname
- \??mo:greek%
- :\ifcsname\??mo:lcgreek:\@@molcgreek\endcsname\@@molcgreek\else\v!none\fi
- :\ifcsname\??mo:ucgreek:\@@moucgreek\endcsname\@@moucgreek\else\v!none\fi
- \endcsname
+ \csname\??mo:greek:\@@molcgreek:\@@moucgreek\endcsname
\to \everymathematics
\setupmathematics
diff --git a/tex/context/base/math-map.lua b/tex/context/base/math-map.lua
index cf54971f9..b3c5c29cc 100644
--- a/tex/context/base/math-map.lua
+++ b/tex/context/base/math-map.lua
@@ -24,6 +24,8 @@ local floor = math.floor
local texattribute = tex.attribute
+local trace_greek = false trackers.register("math.greek", function(v) trace_greek = v end)
+
mathematics = mathematics or { }
-- we could use one level less and have tf etc be tables directly but the
@@ -36,19 +38,24 @@ mathematics.alphabets = {
digits = 0x00030,
ucletters = 0x00041,
lcletters = 0x00061,
- symbols = {
- [0x0391]=0x0391, [0x0392]=0x0392, [0x0393]=0x0393, [0x0394]=0x0394, [0x0395]=0x0395,
- [0x0396]=0x0396, [0x0397]=0x0397, [0x0398]=0x0398, [0x0399]=0x0399, [0x039A]=0x039A,
- [0x039B]=0x039B, [0x039C]=0x039C, [0x039D]=0x039D, [0x039E]=0x039E, [0x039F]=0x039F,
- [0x03A0]=0x03A0, [0x03A1]=0x03A1, [0x03A3]=0x03A3, [0x03A4]=0x03A4, [0x03A5]=0x03A5,
- [0x03A6]=0x03A6, [0x03A7]=0x03A7, [0x03A8]=0x03A8, [0x03A9]=0x03A9, [0x03B1]=0x03B1,
- [0x03B2]=0x03B2, [0x03B3]=0x03B3, [0x03B4]=0x03B4, [0x03B5]=0x03B5, [0x03B6]=0x03B6,
- [0x03B7]=0x03B7, [0x03B8]=0x03B8, [0x03B9]=0x03B9, [0x03BA]=0x03BA, [0x03BB]=0x03BB,
- [0x03BC]=0x03BC, [0x03BD]=0x03BD, [0x03BE]=0x03BE, [0x03BF]=0x03BF, [0x03C0]=0x03C0,
- [0x03C1]=0x03C1, [0x03C2]=0x03C2, [0x03C3]=0x03C3, [0x03C4]=0x03C4, [0x03C5]=0x03C5,
- [0x03C6]=0x03C6, [0x03C7]=0x03C7, [0x03C8]=0x03C8, [0x03C9]=0x03C9, [0x03D1]=0x03D1,
- [0x03D5]=0x03D5, [0x03D6]=0x03D6, [0x03F0]=0x03F0, [0x03F1]=0x03F1, [0x03F4]=0x03F4,
- [0x03F5]=0x03F5, [0x2202]=0x2202, [0x2207]=0x2207,
+ ucgreek = {
+ [0x0391]=0x0391, [0x0392]=0x0392, [0x0393]=0x0393, [0x0394]=0x0394, [0x0395]=0x0395,
+ [0x0396]=0x0396, [0x0397]=0x0397, [0x0398]=0x0398, [0x0399]=0x0399, [0x039A]=0x039A,
+ [0x039B]=0x039B, [0x039C]=0x039C, [0x039D]=0x039D, [0x039E]=0x039E, [0x039F]=0x039F,
+ [0x03A0]=0x03A0, [0x03A1]=0x03A1, [0x03A3]=0x03A3, [0x03A4]=0x03A4, [0x03A5]=0x03A5,
+ [0x03A6]=0x03A6, [0x03A7]=0x03A7, [0x03A8]=0x03A8, [0x03A9]=0x03A9,
+ },
+ lcgreek = {
+ [0x03B1]=0x03B1, [0x03B2]=0x03B2, [0x03B3]=0x03B3, [0x03B4]=0x03B4, [0x03B5]=0x03B5,
+ [0x03B6]=0x03B6, [0x03B7]=0x03B7, [0x03B8]=0x03B8, [0x03B9]=0x03B9, [0x03BA]=0x03BA,
+ [0x03BB]=0x03BB, [0x03BC]=0x03BC, [0x03BD]=0x03BD, [0x03BE]=0x03BE, [0x03BF]=0x03BF,
+ [0x03C0]=0x03C0, [0x03C1]=0x03C1, [0x03C2]=0x03C2, [0x03C3]=0x03C3, [0x03C4]=0x03C4,
+ [0x03C5]=0x03C5, [0x03C6]=0x03C6, [0x03C7]=0x03C7, [0x03C8]=0x03C8, [0x03C9]=0x03C9,
+ [0x03D1]=0x03D1, [0x03D5]=0x03D5, [0x03D6]=0x03D6, [0x03F0]=0x03F0, [0x03F1]=0x03F1,
+ [0x03F4]=0x03F4, [0x03F5]=0x03F5,
+ },
+ symbols = {
+ [0x2202]=0x2202, [0x2207]=0x2207,
},
},
it = {
@@ -61,56 +68,71 @@ mathematics.alphabets = {
[0x00075]=0x1D462, [0x00076]=0x1D463, [0x00077]=0x1D464, [0x00078]=0x1D465, [0x00079]=0x1D466,
[0x0007A]=0x1D467,
},
- symbols = {
+ ucgreek = {
[0x0391]=0x1D6E2, [0x0392]=0x1D6E3, [0x0393]=0x1D6E4, [0x0394]=0x1D6E5, [0x0395]=0x1D6E6,
[0x0396]=0x1D6E7, [0x0397]=0x1D6E8, [0x0398]=0x1D6E9, [0x0399]=0x1D6EA, [0x039A]=0x1D6EB,
[0x039B]=0x1D6EC, [0x039C]=0x1D6ED, [0x039D]=0x1D6EE, [0x039E]=0x1D6EF, [0x039F]=0x1D6F0,
[0x03A0]=0x1D6F1, [0x03A1]=0x1D6F2, [0x03A3]=0x1D6F4, [0x03A4]=0x1D6F5, [0x03A5]=0x1D6F6,
- [0x03A6]=0x1D6F7, [0x03A7]=0x1D6F8, [0x03A8]=0x1D6F9, [0x03A9]=0x1D6FA, [0x03B1]=0x1D6FC,
- [0x03B2]=0x1D6FD, [0x03B3]=0x1D6FE, [0x03B4]=0x1D6FF, [0x03B5]=0x1D700, [0x03B6]=0x1D701,
- [0x03B7]=0x1D702, [0x03B8]=0x1D703, [0x03B9]=0x1D704, [0x03BA]=0x1D705, [0x03BB]=0x1D706,
- [0x03BC]=0x1D707, [0x03BD]=0x1D708, [0x03BE]=0x1D709, [0x03BF]=0x1D70A, [0x03C0]=0x1D70B,
- [0x03C1]=0x1D70C, [0x03C2]=0x1D70D, [0x03C3]=0x1D70E, [0x03C4]=0x1D70F, [0x03C5]=0x1D710,
- [0x03C6]=0x1D711, [0x03C7]=0x1D712, [0x03C8]=0x1D713, [0x03C9]=0x1D714, [0x03D1]=0x1D717,
- [0x03D5]=0x1D719, [0x03D6]=0x1D71B, [0x03F0]=0x1D718, [0x03F1]=0x1D71A, [0x03F4]=0x1D6F3,
- [0x03F5]=0x1D716, [0x2202]=0x1D715, [0x2207]=0x1D6FB,
+ [0x03A6]=0x1D6F7, [0x03A7]=0x1D6F8, [0x03A8]=0x1D6F9, [0x03A9]=0x1D6FA,
+ },
+ lcgreek = {
+ [0x03B1]=0x1D6FC, [0x03B2]=0x1D6FD, [0x03B3]=0x1D6FE, [0x03B4]=0x1D6FF, [0x03B5]=0x1D700,
+ [0x03B6]=0x1D701, [0x03B7]=0x1D702, [0x03B8]=0x1D703, [0x03B9]=0x1D704, [0x03BA]=0x1D705,
+ [0x03BB]=0x1D706, [0x03BC]=0x1D707, [0x03BD]=0x1D708, [0x03BE]=0x1D709, [0x03BF]=0x1D70A,
+ [0x03C0]=0x1D70B, [0x03C1]=0x1D70C, [0x03C2]=0x1D70D, [0x03C3]=0x1D70E, [0x03C4]=0x1D70F,
+ [0x03C5]=0x1D710, [0x03C6]=0x1D711, [0x03C7]=0x1D712, [0x03C8]=0x1D713, [0x03C9]=0x1D714,
+ [0x03D1]=0x1D717, [0x03D5]=0x1D719, [0x03D6]=0x1D71B, [0x03F0]=0x1D718, [0x03F1]=0x1D71A,
+ [0x03F4]=0x1D6F3, [0x03F5]=0x1D716,
+ },
+ symbols = {
+ [0x2202]=0x1D715, [0x2207]=0x1D6FB,
},
},
bf= {
digits = 0x1D7CE,
ucletters = 0x1D400,
lcletters = 0x1D41A,
- symbols = {
+ ucgreek = {
[0x0391]=0x1D6A8, [0x0392]=0x1D6A9, [0x0393]=0x1D6AA, [0x0394]=0x1D6AB, [0x0395]=0x1D6AC,
[0x0396]=0x1D6AD, [0x0397]=0x1D6AE, [0x0398]=0x1D6AF, [0x0399]=0x1D6B0, [0x039A]=0x1D6B1,
[0x039B]=0x1D6B2, [0x039C]=0x1D6B3, [0x039D]=0x1D6B4, [0x039E]=0x1D6B5, [0x039F]=0x1D6B6,
[0x03A0]=0x1D6B7, [0x03A1]=0x1D6B8, [0x03A3]=0x1D6BA, [0x03A4]=0x1D6BB, [0x03A5]=0x1D6BC,
- [0x03A6]=0x1D6BD, [0x03A7]=0x1D6BE, [0x03A8]=0x1D6BF, [0x03A9]=0x1D6C0, [0x03B1]=0x1D6C2,
- [0x03B2]=0x1D6C3, [0x03B3]=0x1D6C4, [0x03B4]=0x1D6C5, [0x03B5]=0x1D6C6, [0x03B6]=0x1D6C7,
- [0x03B7]=0x1D6C8, [0x03B8]=0x1D6C9, [0x03B9]=0x1D6CA, [0x03BA]=0x1D6CB, [0x03BB]=0x1D6CC,
- [0x03BC]=0x1D6CD, [0x03BD]=0x1D6CE, [0x03BE]=0x1D6CF, [0x03BF]=0x1D6D0, [0x03C0]=0x1D6D1,
- [0x03C1]=0x1D6D2, [0x03C2]=0x1D6D3, [0x03C3]=0x1D6D4, [0x03C4]=0x1D6D5, [0x03C5]=0x1D6D6,
- [0x03C6]=0x1D6D7, [0x03C7]=0x1D6D8, [0x03C8]=0x1D6D9, [0x03C9]=0x1D6DA, [0x03D1]=0x1D6DD,
- [0x03D5]=0x1D6DF, [0x03D6]=0x1D6E1, [0x03F0]=0x1D6DE, [0x03F1]=0x1D6E0, [0x03F4]=0x1D6B9,
- [0x03F5]=0x1D6DC, [0x2202]=0x1D6DB, [0x2207]=0x1D6C1,
+ [0x03A6]=0x1D6BD, [0x03A7]=0x1D6BE, [0x03A8]=0x1D6BF, [0x03A9]=0x1D6C0,
+ },
+ lcgreek = {
+ [0x03B1]=0x1D6C2, [0x03B2]=0x1D6C3, [0x03B3]=0x1D6C4, [0x03B4]=0x1D6C5, [0x03B5]=0x1D6C6,
+ [0x03B6]=0x1D6C7, [0x03B7]=0x1D6C8, [0x03B8]=0x1D6C9, [0x03B9]=0x1D6CA, [0x03BA]=0x1D6CB,
+ [0x03BB]=0x1D6CC, [0x03BC]=0x1D6CD, [0x03BD]=0x1D6CE, [0x03BE]=0x1D6CF, [0x03BF]=0x1D6D0,
+ [0x03C0]=0x1D6D1, [0x03C1]=0x1D6D2, [0x03C2]=0x1D6D3, [0x03C3]=0x1D6D4, [0x03C4]=0x1D6D5,
+ [0x03C5]=0x1D6D6, [0x03C6]=0x1D6D7, [0x03C7]=0x1D6D8, [0x03C8]=0x1D6D9, [0x03C9]=0x1D6DA,
+ [0x03D1]=0x1D6DD, [0x03D5]=0x1D6DF, [0x03D6]=0x1D6E1, [0x03F0]=0x1D6DE, [0x03F1]=0x1D6E0,
+ [0x03F4]=0x1D6B9, [0x03F5]=0x1D6DC,
+ },
+ symbols = {
+ [0x2202]=0x1D6DB, [0x2207]=0x1D6C1,
},
},
bi = {
ucletters = 0x1D468,
lcletters = 0x1D482,
- symbols = {
+ ucgreek = {
[0x0391]=0x1D71C, [0x0392]=0x1D71D, [0x0393]=0x1D71E, [0x0394]=0x1D71F, [0x0395]=0x1D720,
[0x0396]=0x1D721, [0x0397]=0x1D722, [0x0398]=0x1D723, [0x0399]=0x1D724, [0x039A]=0x1D725,
[0x039B]=0x1D726, [0x039C]=0x1D727, [0x039D]=0x1D728, [0x039E]=0x1D729, [0x039F]=0x1D72A,
[0x03A0]=0x1D72B, [0x03A1]=0x1D72C, [0x03A3]=0x1D72E, [0x03A4]=0x1D72F, [0x03A5]=0x1D730,
- [0x03A6]=0x1D731, [0x03A7]=0x1D732, [0x03A8]=0x1D733, [0x03A9]=0x1D734, [0x03B1]=0x1D736,
- [0x03B2]=0x1D737, [0x03B3]=0x1D738, [0x03B4]=0x1D739, [0x03B5]=0x1D73A, [0x03B6]=0x1D73B,
- [0x03B7]=0x1D73C, [0x03B8]=0x1D73D, [0x03B9]=0x1D73E, [0x03BA]=0x1D73F, [0x03BB]=0x1D740,
- [0x03BC]=0x1D741, [0x03BD]=0x1D742, [0x03BE]=0x1D743, [0x03BF]=0x1D744, [0x03C0]=0x1D745,
- [0x03C1]=0x1D746, [0x03C2]=0x1D747, [0x03C3]=0x1D748, [0x03C4]=0x1D749, [0x03C5]=0x1D74A,
- [0x03C6]=0x1D74B, [0x03C7]=0x1D74C, [0x03C8]=0x1D74D, [0x03C9]=0x1D74E, [0x03D1]=0x1D751,
- [0x03D5]=0x1D753, [0x03D6]=0x1D755, [0x03F0]=0x1D752, [0x03F1]=0x1D754, [0x03F4]=0x1D72D,
- [0x03F5]=0x1D750, [0x2202]=0x1D74F, [0x2207]=0x1D735,
+ [0x03A6]=0x1D731, [0x03A7]=0x1D732, [0x03A8]=0x1D733, [0x03A9]=0x1D734,
+ },
+ lcgreek = {
+ [0x03B1]=0x1D736, [0x03B2]=0x1D737, [0x03B3]=0x1D738, [0x03B4]=0x1D739, [0x03B5]=0x1D73A,
+ [0x03B6]=0x1D73B, [0x03B7]=0x1D73C, [0x03B8]=0x1D73D, [0x03B9]=0x1D73E, [0x03BA]=0x1D73F,
+ [0x03BB]=0x1D740, [0x03BC]=0x1D741, [0x03BD]=0x1D742, [0x03BE]=0x1D743, [0x03BF]=0x1D744,
+ [0x03C0]=0x1D745, [0x03C1]=0x1D746, [0x03C2]=0x1D747, [0x03C3]=0x1D748, [0x03C4]=0x1D749,
+ [0x03C5]=0x1D74A, [0x03C6]=0x1D74B, [0x03C7]=0x1D74C, [0x03C8]=0x1D74D, [0x03C9]=0x1D74E,
+ [0x03D1]=0x1D751, [0x03D5]=0x1D753, [0x03D6]=0x1D755, [0x03F0]=0x1D752, [0x03F1]=0x1D754,
+ [0x03F4]=0x1D72D, [0x03F5]=0x1D750,
+ },
+ symbols = {
+ [0x2202]=0x1D74F, [0x2207]=0x1D735,
},
},
},
@@ -128,37 +150,47 @@ mathematics.alphabets = {
digits = 0x1D7EC,
ucletters = 0x1D5D4,
lcletters = 0x1D5EE,
- symbols = {
+ ucgreek = {
[0x0391]=0x1D756, [0x0392]=0x1D757, [0x0393]=0x1D758, [0x0394]=0x1D759, [0x0395]=0x1D75A,
[0x0396]=0x1D75B, [0x0397]=0x1D75C, [0x0398]=0x1D75D, [0x0399]=0x1D75E, [0x039A]=0x1D75F,
[0x039B]=0x1D760, [0x039C]=0x1D761, [0x039D]=0x1D762, [0x039E]=0x1D763, [0x039F]=0x1D764,
[0x03A0]=0x1D765, [0x03A1]=0x1D766, [0x03A3]=0x1D768, [0x03A4]=0x1D769, [0x03A5]=0x1D76A,
- [0x03A6]=0x1D76B, [0x03A7]=0x1D76C, [0x03A8]=0x1D76D, [0x03A9]=0x1D76E, [0x03B1]=0x1D770,
- [0x03B2]=0x1D771, [0x03B3]=0x1D772, [0x03B4]=0x1D773, [0x03B5]=0x1D774, [0x03B6]=0x1D775,
- [0x03B7]=0x1D776, [0x03B8]=0x1D777, [0x03B9]=0x1D778, [0x03BA]=0x1D779, [0x03BB]=0x1D77A,
- [0x03BC]=0x1D77B, [0x03BD]=0x1D77C, [0x03BE]=0x1D77D, [0x03BF]=0x1D77E, [0x03C0]=0x1D77F,
- [0x03C1]=0x1D780, [0x03C2]=0x1D781, [0x03C3]=0x1D782, [0x03C4]=0x1D783, [0x03C5]=0x1D784,
- [0x03C6]=0x1D785, [0x03C7]=0x1D786, [0x03C8]=0x1D787, [0x03C9]=0x1D788, [0x03D1]=0x1D78B,
- [0x03D5]=0x1D78D, [0x03D6]=0x1D78F, [0x03F0]=0x1D78C, [0x03F1]=0x1D78E, [0x03F4]=0x1D767,
- [0x03F5]=0x1D78A, [0x2202]=0x1D789, [0x2207]=0x1D76F,
+ [0x03A6]=0x1D76B, [0x03A7]=0x1D76C, [0x03A8]=0x1D76D, [0x03A9]=0x1D76E,
+ },
+ lcgreek = {
+ [0x03B1]=0x1D770, [0x03B2]=0x1D771, [0x03B3]=0x1D772, [0x03B4]=0x1D773, [0x03B5]=0x1D774,
+ [0x03B6]=0x1D775, [0x03B7]=0x1D776, [0x03B8]=0x1D777, [0x03B9]=0x1D778, [0x03BA]=0x1D779,
+ [0x03BB]=0x1D77A, [0x03BC]=0x1D77B, [0x03BD]=0x1D77C, [0x03BE]=0x1D77D, [0x03BF]=0x1D77E,
+ [0x03C0]=0x1D77F, [0x03C1]=0x1D780, [0x03C2]=0x1D781, [0x03C3]=0x1D782, [0x03C4]=0x1D783,
+ [0x03C5]=0x1D784, [0x03C6]=0x1D785, [0x03C7]=0x1D786, [0x03C8]=0x1D787, [0x03C9]=0x1D788,
+ [0x03D1]=0x1D78B, [0x03D5]=0x1D78D, [0x03D6]=0x1D78F, [0x03F0]=0x1D78C, [0x03F1]=0x1D78E,
+ [0x03F4]=0x1D767, [0x03F5]=0x1D78A,
+ },
+ symbols = {
+ [0x2202]=0x1D789, [0x2207]=0x1D76F,
},
},
bi = {
ucletters = 0x1D63C,
lcletters = 0x1D656,
- symbols = {
+ ucgreek = {
[0x0391]=0x1D790, [0x0392]=0x1D791, [0x0393]=0x1D792, [0x0394]=0x1D793, [0x0395]=0x1D794,
[0x0396]=0x1D795, [0x0397]=0x1D796, [0x0398]=0x1D797, [0x0399]=0x1D798, [0x039A]=0x1D799,
[0x039B]=0x1D79A, [0x039C]=0x1D79B, [0x039D]=0x1D79C, [0x039E]=0x1D79D, [0x039F]=0x1D79E,
[0x03A0]=0x1D79F, [0x03A1]=0x1D7A0, [0x03A3]=0x1D7A2, [0x03A4]=0x1D7A3, [0x03A5]=0x1D7A4,
- [0x03A6]=0x1D7A5, [0x03A7]=0x1D7A6, [0x03A8]=0x1D7A7, [0x03A9]=0x1D7A8, [0x03B1]=0x1D7AA,
- [0x03B2]=0x1D7AB, [0x03B3]=0x1D7AC, [0x03B4]=0x1D7AD, [0x03B5]=0x1D7AE, [0x03B6]=0x1D7AF,
- [0x03B7]=0x1D7B0, [0x03B8]=0x1D7B1, [0x03B9]=0x1D7B2, [0x03BA]=0x1D7B3, [0x03BB]=0x1D7B4,
- [0x03BC]=0x1D7B5, [0x03BD]=0x1D7B6, [0x03BE]=0x1D7B7, [0x03BF]=0x1D7B8, [0x03C0]=0x1D7B9,
- [0x03C1]=0x1D7BA, [0x03C2]=0x1D7BB, [0x03C3]=0x1D7BC, [0x03C4]=0x1D7BD, [0x03C5]=0x1D7BE,
- [0x03C6]=0x1D7BF, [0x03C7]=0x1D7C0, [0x03C8]=0x1D7C1, [0x03C9]=0x1D7C2, [0x03D1]=0x1D7C5,
- [0x03D5]=0x1D7C7, [0x03D6]=0x1D7C9, [0x03F0]=0x1D7C6, [0x03F1]=0x1D7C8, [0x03F4]=0x1D7A1,
- [0x03F5]=0x1D7C4, [0x2202]=0x1D7C3, [0x2207]=0x1D7A9,
+ [0x03A6]=0x1D7A5, [0x03A7]=0x1D7A6, [0x03A8]=0x1D7A7, [0x03A9]=0x1D7A8,
+ },
+ lcgreek = {
+ [0x03B1]=0x1D7AA, [0x03B2]=0x1D7AB, [0x03B3]=0x1D7AC, [0x03B4]=0x1D7AD, [0x03B5]=0x1D7AE,
+ [0x03B6]=0x1D7AF, [0x03B7]=0x1D7B0, [0x03B8]=0x1D7B1, [0x03B9]=0x1D7B2, [0x03BA]=0x1D7B3,
+ [0x03BB]=0x1D7B4, [0x03BC]=0x1D7B5, [0x03BD]=0x1D7B6, [0x03BE]=0x1D7B7, [0x03BF]=0x1D7B8,
+ [0x03C0]=0x1D7B9, [0x03C1]=0x1D7BA, [0x03C2]=0x1D7BB, [0x03C3]=0x1D7BC, [0x03C4]=0x1D7BD,
+ [0x03C5]=0x1D7BE, [0x03C6]=0x1D7BF, [0x03C7]=0x1D7C0, [0x03C8]=0x1D7C1, [0x03C9]=0x1D7C2,
+ [0x03D1]=0x1D7C5, [0x03D5]=0x1D7C7, [0x03D6]=0x1D7C9, [0x03F0]=0x1D7C6, [0x03F1]=0x1D7C8,
+ [0x03F4]=0x1D7A1, [0x03F5]=0x1D7C4,
+ },
+ symbols = {
+ [0x2202]=0x1D7C3, [0x2207]=0x1D7A9,
},
},
},
@@ -227,16 +259,16 @@ mathematics.alphabets = {
}
local alphabets = mathematics.alphabets
-local attribs = { }
+local mathremap = { }
for alphabet, styles in next, alphabets do
for style, data in next, styles do
-- let's keep the long names (for tracing)
- local n = #attribs+1
+ local n = #mathremap + 1
data.attribute = n
data.alphabet = alphabet
data.style = style
- attribs[n] = data
+ mathremap[n] = data
end
end
@@ -247,31 +279,47 @@ alphabets.regular.it.digits = alphabets.regular.tf.digits
alphabets.regular.bi.digits = alphabets.regular.bf.digits
alphabets.sansserif.tf.symbols = alphabets.regular.tf.symbols
+alphabets.sansserif.tf.lcgreek = alphabets.regular.tf.lcgreek
+alphabets.sansserif.tf.ucgreek = alphabets.regular.tf.ucgreek
alphabets.sansserif.tf.digits = alphabets.regular.tf.digits
alphabets.sansserif.it.symbols = alphabets.regular.tf.symbols
+alphabets.sansserif.it.lcgreek = alphabets.regular.tf.lcgreek
+alphabets.sansserif.it.ucgreek = alphabets.regular.tf.ucgreek
alphabets.sansserif.bi.digits = alphabets.regular.bf.digits
alphabets.monospaced.tf.symbols = alphabets.sansserif.tf.symbols
+alphabets.monospaced.tf.lcgreek = alphabets.sansserif.tf.lcgreek
+alphabets.monospaced.tf.ucgreek = alphabets.sansserif.tf.ucgreek
alphabets.monospaced.it = alphabets.sansserif.tf
alphabets.monospaced.bf = alphabets.sansserif.tf
alphabets.monospaced.bi = alphabets.sansserif.bf
alphabets.blackboard.tf.symbols = alphabets.regular.tf.symbols
+alphabets.blackboard.tf.lcgreek = alphabets.regular.tf.lcgreek
+alphabets.blackboard.tf.ucgreek = alphabets.regular.tf.ucgreek
alphabets.blackboard.it = alphabets.blackboard.tf
alphabets.blackboard.bf = alphabets.blackboard.tf
alphabets.blackboard.bi = alphabets.blackboard.bf
alphabets.fraktur.tf.digits = alphabets.regular.tf.digits
alphabets.fraktur.tf.symbols = alphabets.regular.tf.symbols
+alphabets.fraktur.tf.lcgreek = alphabets.regular.tf.lcgreek
+alphabets.fraktur.tf.ucgreek = alphabets.regular.tf.ucgreek
alphabets.fraktur.bf.digits = alphabets.regular.bf.digits
alphabets.fraktur.bf.symbols = alphabets.regular.bf.symbols
+alphabets.fraktur.bf.lcgreek = alphabets.regular.bf.lcgreek
+alphabets.fraktur.bf.ucgreek = alphabets.regular.bf.ucgreek
alphabets.fraktur.it = alphabets.fraktur.tf
alphabets.fraktur.bi = alphabets.fraktur.bf
alphabets.script.tf.digits = alphabets.regular.tf.digits
alphabets.script.tf.symbols = alphabets.regular.tf.symbols
+alphabets.script.tf.lcgreek = alphabets.regular.tf.lcgreek
+alphabets.script.tf.ucgreek = alphabets.regular.tf.ucgreek
alphabets.script.bf.digits = alphabets.regular.bf.digits
alphabets.script.bf.symbols = alphabets.regular.bf.symbols
+alphabets.script.bf.lcgreek = alphabets.regular.bf.lcgreek
+alphabets.script.bf.ucgreek = alphabets.regular.bf.ucgreek
alphabets.script.it = alphabets.script.tf
alphabets.script.bi = alphabets.script.bf
@@ -287,12 +335,12 @@ alphabets.type = alphabets.monospaced
alphabets.teletype = alphabets.monospaced
function mathematics.to_a_style(attribute)
- local r = attribs[attribute]
+ local r = mathremap[attribute]
return r and r.style or "tf"
end
function mathematics.to_a_name(attribute)
- local r = attribs[attribute]
+ local r = mathremap[attribute]
return r and r.alphabet or "regular"
end
@@ -307,28 +355,60 @@ function mathematics.sync_a_both(alphabet,style)
end
function mathematics.sync_a_style(style)
- local r = attribs[mathalphabet]
+--~ local r = mathremap[mathalphabet]
+ local r = mathremap[texattribute[mathalphabet]]
local alphabet = r and r.alphabet or "regular"
local data = alphabets[alphabet][style]
texattribute[mathalphabet] = data and data.attribute or texattribute[mathalphabet]
end
function mathematics.sync_a_name(alphabet)
- local r = attribs[mathalphabet]
+--~ local r = mathremap[mathalphabet]
+ local r = mathremap[texattribute[mathalphabet]]
local style = r and r.style or "tf"
local data = alphabets[alphabet][style]
texattribute[mathalphabet] = data and data.attribute or texattribute[mathalphabet]
end
-local issymbol = mathematics.alphabets.regular.tf.symbols
+local issymbol = mathematics.alphabets.regular.tf.symbols
+local islcgreek = mathematics.alphabets.regular.tf.lcgreek
+local isucgreek = mathematics.alphabets.regular.tf.ucgreek
-function mathematics.remap_alphabets(attribute,char)
- -- we could use a map[attribute][char] => newchar but first we have
- -- to finish the table
- local offset = attribs[attribute]
- if offset then
+local remapping = {
+ [1] = { what = "unchanged" }, -- upright
+ [2] = { what = "upright", it = "tf", bi = "bf" }, -- upright
+ [3] = { what = "italic", tf = "it", bf = "bi" }, -- italic
+}
+
+function mathematics.remap_alphabets(char,mathalphabet,mathgreek)
+ if mathgreek > 0 then
+ local lc, uc = floor(mathgreek/10), mathgreek % 10 -- 2 == upright 3 == italic
+ if lc > 1 or uc > 1 then
+ local islc, isuc = islcgreek[char] and lc, isucgreek[char] and uc
+ if islc or isuc then
+ local r = mathremap[mathalphabet] -- what if 0
+ local alphabet = r and r.alphabet or "regular"
+ local style = r and r.style or "tf"
+ if trace_greek then
+ logs.report("math","before: char: %05X, alphabet: %s %s, lcgreek: %s, ucgreek: %s",char,alphabet,style,remapping[lc].what,remapping[uc].what)
+ end
+ local s = remapping[islc or isuc][style]
+ if s then
+ local data = alphabets[alphabet][s]
+ mathalphabet, style = data and data.attribute or mathalphabet, s
+ end
+ if trace_greek then
+ logs.report("math","after : char: %05X, alphabet: %s %s, lcgreek: %s, ucgreek: %s",char,alphabet,style,remapping[lc].what,remapping[uc].what)
+ end
+ end
+ end
+ end
+ if mathalphabet > 0 then
local newchar
- if char >= 0x030 and char <= 0x039 then
+ local offset = mathremap[mathalphabet]
+ if not offset then
+ -- nothing to remap
+ elseif char >= 0x030 and char <= 0x039 then
local o = offset.digits
newchar = (type(o) == "table" and (o[char] or char)) or (char - 0x030 + o)
elseif char >= 0x041 and char <= 0x05A then
@@ -337,6 +417,10 @@ function mathematics.remap_alphabets(attribute,char)
elseif char >= 0x061 and char <= 0x07A then
local o = offset.lcletters
newchar = (type(o) == "table" and (o[char] or char)) or (char - 0x061 + o)
+ elseif islcgreek[char] then
+ newchar = offset.lcgreek[char]
+ elseif isucgreek[char] then
+ newchar = offset.ucgreek[char]
elseif issymbol[char] then
newchar = offset.symbols[char]
end
@@ -344,34 +428,3 @@ function mathematics.remap_alphabets(attribute,char)
end
return nil
end
-
--- [lc uc] normal (upright) = 1, italic = 2, none = 0
-
-mathematics.lcgreek = {
- upright = {
- [0x1D6FC] = 0x003B1,
- },
-}
-
-mathematics.ucgreek = {
- upright = {
- },
-}
-
-local lcgreek, ucgreek = mathematics.lcgreek, mathematics.ucgreek
-
-lcgreek.italic = table.swapped(lcgreek.upright)
-ucgreek.italic = table.swapped(ucgreek.upright)
-
-lcgreek[1], lcgreek[2] = lcgreek.upright, ucgreek.italic
-ucgreek[1], ucgreek[2] = lcgreek.upright, ucgreek.italic
-
-function mathematics.remap_greek(attribute,char)
- local lc, uc = floor(attribute/10), attribute % 10
- local g = lcgreek[lc] or ucgreek[uc]
- if g then
- local newchar = g[char]
- return newchar ~= char and newchar
- end
- return nil
-end
diff --git a/tex/context/base/math-noa.lua b/tex/context/base/math-noa.lua
index f8484dfb4..7a2a60e84 100644
--- a/tex/context/base/math-noa.lua
+++ b/tex/context/base/math-noa.lua
@@ -89,7 +89,7 @@ local function process(start,what,n)
if n then n = n + 1 else n = 0 end
while start do
if trace_processing then
- texio.write_nl(format("%s%s",rep(" ",n or 0),tostring(start)))
+ logs.report("math","%s%s",rep(" ",n or 0),tostring(start))
end
local id = start.id
local proc = what[id]
@@ -150,49 +150,39 @@ local function report_remap(tag,id,old,new,extra)
end
local remap_alphabets = mathematics.remap_alphabets
-local remap_greek = mathematics.remap_greek
local fcs = fonts.color.set
-local function relocate(pointer,what,char,newchar)
- local fam = pointer.fam
- local id = font_of_family(fam)
- local tfmdata = fontdata[id]
- if tfmdata and tfmdata.characters[newchar] then -- we could probably speed this up
- if trace_remapping then
- report_remap(what,id,char,newchar)
- end
- if trace_analyzing then
- fcs(pointer,"font:isol")
- end
- pointer.char = newchar
- return true
- elseif trace_remapping then
- report_remap(what,id,char,newchar," fails")
- end
- return false
-end
-
noads.processors.relocate[math_char] = function(pointer)
- local done = 0
- local a = has_attribute(pointer,mathalphabet)
- if a and a > 0 then
- set_attribute(pointer,mathalphabet,0)
- local char = pointer.char
- local newchar = remap_alphabets(a,char)
- if newchar and relocate(pointer,"char",char,newchar) then
- done = done + 1
+ local g = has_attribute(pointer,mathgreek) or 0
+ local a = has_attribute(pointer,mathalphabet) or 0
+ if a > 0 or g > 0 then
+ if a > 0 then
+ set_attribute(pointer,mathgreek,0)
+ end
+ if g > 0 then
+ set_attribute(pointer,mathalphabet,0)
end
- end
- local a = has_attribute(pointer,mathgreek)
- if a and a > 0 then
- set_attribute(pointer,mathgreek,0)
local char = pointer.char
- local newchar = remap_greek(a,char)
- if newchar and relocate(pointer,"greek",char,newchar) then
- done = done + 1
+ local newchar = remap_alphabets(char,a,g)
+ if newchar then
+ local fam = pointer.fam
+ local id = font_of_family(fam)
+ local tfmdata = fontdata[id]
+ if tfmdata and tfmdata.characters[newchar] then -- we could probably speed this up
+ if trace_remapping then
+ report_remap("char",id,char,newchar)
+ end
+ if trace_analyzing then
+ fcs(pointer,"font:isol")
+ end
+ pointer.char = newchar
+ return true
+ elseif trace_remapping then
+ report_remap("char",id,char,newchar," fails")
+ end
end
end
- if done > 0 and trace_analyzing then
+ if trace_analyzing then
fcs(pointer,"font:medi")
end
end
diff --git a/tex/context/base/math-vfu.lua b/tex/context/base/math-vfu.lua
index c21f214f0..67deef21b 100644
--- a/tex/context/base/math-vfu.lua
+++ b/tex/context/base/math-vfu.lua
@@ -257,7 +257,6 @@ function fonts.vf.math.define(specification,set)
local size = specification.size -- given size
local fnt, lst, main = { }, { }, nil
local start = (trace_virtual or trace_timings) and os.clock()
---~ texio.write_nl("defining font " .. name .. " " .. size)
local okset, n = { }, 0
for s=1,#set do
local ss = set[s]
diff --git a/tex/context/base/node-pro.lua b/tex/context/base/node-pro.lua
index 8737d7603..8b2e92ff2 100644
--- a/tex/context/base/node-pro.lua
+++ b/tex/context/base/node-pro.lua
@@ -52,9 +52,9 @@ local function tracer(what,state,head,groupcode,before,after,show)
end
n = n + 1
if show then
- texio.write_nl(format("%s %s: %s, group: %s, nodes: %s -> %s, string: %s",what,n,state,groupcode,before,after,reconstruct(head)))
+ logs.report("nodes","%s %s: %s, group: %s, nodes: %s -> %s, string: %s",what,n,state,groupcode,before,after,reconstruct(head))
else
- texio.write_nl(format("%s %s: %s, group: %s, nodes: %s -> %s",what,n,state,groupcode,before,after))
+ logs.report("nodes","%s %s: %s, group: %s, nodes: %s -> %s",what,n,state,groupcode,before,after)
end
end
diff --git a/tex/context/base/node-tra.lua b/tex/context/base/node-tra.lua
index b20cda34c..1e0feb5a1 100644
--- a/tex/context/base/node-tra.lua
+++ b/tex/context/base/node-tra.lua
@@ -360,22 +360,22 @@ function nodes.tosequence(start,stop,compact)
return concat(t," ")
end
else
- return "<empty>"
+ return "[empty]"
end
end
function nodes.report(t,done)
if done then
if status.output_active then
- texio.write(format("<++ %s>",count(t)))
+ logs.report("nodes","output, changed, %s nodes",nodes.count(t))
else
- texio.write(format("<+ %s>",count(t)))
+ texio.write("nodes","normal, changed, %s nodes",nodes.count(t))
end
else
if status.output_active then
- texio.write(format("<-- %s>",count(t)))
+ logs.report("nodes","output, unchanged, %s nodes",nodes.count(t))
else
- texio.write(format("<- %s>",count(t)))
+ texio.write("nodes","normal, unchanged, %s nodes",nodes.count(t))
end
end
end
diff --git a/tex/context/base/pack-rul.mkiv b/tex/context/base/pack-rul.mkiv
index 26fdaadea..04d9cc9a7 100644
--- a/tex/context/base/pack-rul.mkiv
+++ b/tex/context/base/pack-rul.mkiv
@@ -13,6 +13,8 @@
\writestatus{loading}{ConTeXt Packaging Macros / Ruled Content}
+%D redo framedtexts like framedcontent (parameter stuff)
+
%D After a few months testing this solution is now added
%D to the core. This introduces a possible incompatibility
%D between \MKII\ and \MKIV\ but for the better.
@@ -610,6 +612,8 @@
\def\inheritlocalframed[#1]#2[#3]{\letvalue{#1\s!parent}#3}
\def\copylocalframed [#1]#2[#3]{\setvalue{#1\s!parent}{#3}}
+\let\setuplocalframed\getparameters % obsolete
+
\presetlocalframed[\??ol]
\newcount\framednesting
@@ -2648,7 +2652,7 @@
%D because we have to handle an optional identifier (and
%D because these commands evolved out of a single case).
-\def\framedtextparameter#1#2%
+\def\framedtextparameter#1#2% todo: currentframedtext
{\csname\??kd#1#2\endcsname}
\def\dosetupframedtexts[#1][#2]%
@@ -3312,24 +3316,101 @@
%D
%D \typebuffer
+% \def\defineframedcontent
+% {\dodoubleempty\dodefineframedcontent}
+%
+% \def\dodefineframedcontent[#1][#2]%
+% {\presetlocalframed[\??fc#1]%
+% \getparameters[\??fc#1]
+% [\c!leftoffset=\zeropoint,
+% \c!rightoffset=\getvalue{\??fc#1\c!leftoffset},
+% \c!topoffset=\zeropoint,
+% \c!bottomoffset=\getvalue{\??fc#1\c!topoffset},
+% \c!strut=\v!no,
+% \c!offset=\v!overlay,
+% \c!linecorrection=\v!no,
+% \c!left=,
+% \c!right=,
+% #2]}
+%
+% \def\setupframedcontent
+% {\dodoubleempty\dosetupframedcontent}
+%
+% \def\dosetupframedcontent[#1][#2]%
+% {\def\docommand##1{\getparameters[\??fc##1][#2]}%
+% \processcommacommand[#1]\docommand}
+%
+% \def\startframedcontent[#1]%
+% {\bgroup
+% \doifelse{#1}\v!off
+% {\let\stopframedcontent\egroup}
+% {\ifcsname\??fc#1\c!frame\endcsname
+% \dostartframedcontent{#1}%
+% \fi}}
+%
+% \def\dostartframedcontent#1%
+% {\def\stopframedcontent{\dostopframedcontent{#1}}%
+% \setbox\framebox\hbox\bgroup
+% \setlocalhsize
+% \hsize\localhsize
+% \advance\hsize\dimexpr-\getvalue{\??fc#1\c!leftoffset}-\getvalue{\??fc#1\c!rightoffset} \relax
+% \advance\vsize\dimexpr-\getvalue{\??fc#1\c!topoffset} -\getvalue{\??fc#1\c!bottomoffset}\relax
+% \hskip\getvalue{\??fc#1\c!leftoffset}%
+% \vbox\bgroup
+% \vskip\getvalue{\??fc#1\c!topoffset}%
+% \vbox\bgroup
+% \forgetall
+% \blank[\v!disable]}
+%
+% \def\dostopframedcontent#1%
+% {\removelastskip
+% \egroup
+% \vskip\getvalue{\??fc#1\c!bottomoffset}%
+% \egroup
+% \hskip\getvalue{\??fc#1\c!rightoffset}%
+% \egroup
+% \doifvalue{\??fc#1\c!width}\v!fit
+% {\letvalue{\??fc#1\c!width}\v!fixed}% no shapebox
+% \ifinsidefloat
+% \donefalse
+% \else
+% \doifelsevalue{\??fc#1\c!linecorrection}\v!yes\donetrue\donefalse
+% \fi
+% % plaats ?
+% \ifdone\startlinecorrection\fi
+% \getvalue{\??fc#1\c!left}% new
+% \localframed[\??fc#1]{\box\framebox}%
+% \getvalue{\??fc#1\c!right}% new
+% \ifdone\stoplinecorrection\fi
+% \egroup}
+
+\def\framedcontentparameter #1{\csname\doframedcontentparameter{\??fc\@@framedcontent}#1\endcsname}
+\def\doframedcontentparameter #1#2{\ifcsname#1#2\endcsname#1#2\else\expandafter\doframedcontentparentparameter\csname#1\s!parent\endcsname#2\fi}
+\def\doframedcontentparentparameter#1#2{\ifx#1\relax\s!empty\else\doframedcontentparameter#1#2\fi}
+
+\presetlocalframed[\??fc]
+
+\getparameters
+ [\??fc]
+ [\c!leftoffset=\zeropoint,
+ \c!rightoffset=\framedcontentparameter\c!leftoffset,
+ \c!topoffset=\zeropoint,
+ \c!bottomoffset=\framedcontentparameter\c!topoffset,
+ \c!strut=\v!no,
+ %\c!linecorrection=\v!no,
+ %\c!left=,
+ %\c!right=,
+ %\c!width=\v!fit,
+ \c!offset=\v!overlay]
+
+\def\letframedcontentparameter#1%
+ {\letvalue{\??fc\@@framedcontent#1}}
+
\def\defineframedcontent
{\dodoubleempty\dodefineframedcontent}
\def\dodefineframedcontent[#1][#2]%
- {\presetlocalframed[\??fc#1]%
- \getparameters[\??fc#1]
- [\c!leftoffset=\zeropoint,
- \c!rightoffset=\getvalue{\??fc#1\c!leftoffset},
- \c!topoffset=\zeropoint,
- \c!bottomoffset=\getvalue{\??fc#1\c!topoffset},
- \c!strut=\v!no,
- \c!offset=\v!overlay,
- \c!linecorrection=\v!no,
- \c!left=,
- \c!right=,
- #2]}
-
-\let\setuplocalframed\getparameters
+ {\getparameters[\??fc#1][\s!parent=\??fc,#2]}
\def\setupframedcontent
{\dodoubleempty\dosetupframedcontent}
@@ -3338,24 +3419,25 @@
{\def\docommand##1{\getparameters[\??fc##1][#2]}%
\processcommacommand[#1]\docommand}
-\def\startframedcontent[#1]%
+\def\startframedcontent
+ {\dosingleempty\dostartframedcontent}
+
+\def\dostartframedcontent[#1]%
{\bgroup
- \doifelse{#1}\v!off
- {\let\stopframedcontent\egroup}
- {\ifcsname\??fc#1\c!frame\endcsname
- \dostartframedcontent{#1}%
- \fi}}
+ \edef\@@framedcontent{#1}%
+ \let\stopframedcontent\egroup
+ \doifnot{#1}\v!off{\dodostartframedcontent{#1}}}
-\def\dostartframedcontent#1%
+\def\dodostartframedcontent#1%
{\def\stopframedcontent{\dostopframedcontent{#1}}%
\setbox\framebox\hbox\bgroup
\setlocalhsize
\hsize\localhsize
- \advance\hsize\dimexpr-\getvalue{\??fc#1\c!leftoffset}-\getvalue{\??fc#1\c!rightoffset} \relax
- \advance\vsize\dimexpr-\getvalue{\??fc#1\c!topoffset} -\getvalue{\??fc#1\c!bottomoffset}\relax
- \hskip\getvalue{\??fc#1\c!leftoffset}%
+ \advance\hsize\dimexpr-\framedcontentparameter\c!leftoffset-\framedcontentparameter\c!rightoffset \relax
+ \advance\vsize\dimexpr-\framedcontentparameter\c!topoffset -\framedcontentparameter\c!bottomoffset\relax
+ \hskip\framedcontentparameter\c!leftoffset
\vbox\bgroup
- \vskip\getvalue{\??fc#1\c!topoffset}%
+ \vskip\framedcontentparameter\c!topoffset
\vbox\bgroup
\forgetall
\blank[\v!disable]}
@@ -3363,22 +3445,22 @@
\def\dostopframedcontent#1%
{\removelastskip
\egroup
- \vskip\getvalue{\??fc#1\c!bottomoffset}%
+ \vskip\framedcontentparameter\c!bottomoffset
\egroup
- \hskip\getvalue{\??fc#1\c!rightoffset}%
+ \hskip\framedcontentparameter\c!rightoffset
\egroup
- \doifvalue{\??fc#1\c!width}\v!fit
- {\letvalue{\??fc#1\c!width}\v!fixed}% no shapebox
+ \doif{\framedcontentparameter\c!width}\v!fit
+ {\letframedcontentparameter\c!width\v!fixed}% no shapebox
\ifinsidefloat
\donefalse
\else
- \doifelsevalue{\??fc#1\c!linecorrection}\v!yes\donetrue\donefalse
+ \doifelse{\framedcontentparameter\c!linecorrection}\v!yes\donetrue\donefalse
\fi
% plaats ?
\ifdone\startlinecorrection\fi
- \getvalue{\??fc#1\c!left}% new
+ \framedcontentparameter\c!left % new
\localframed[\??fc#1]{\box\framebox}%
- \getvalue{\??fc#1\c!right}% new
+ \framedcontentparameter\c!right % new
\ifdone\stoplinecorrection\fi
\egroup}
diff --git a/tex/context/base/s-mod-00.tex b/tex/context/base/s-mod-00.tex
index d16688de5..270f7a9b4 100644
--- a/tex/context/base/s-mod-00.tex
+++ b/tex/context/base/s-mod-00.tex
@@ -22,7 +22,10 @@
\usemodule[units]
-\enableactivediscretionaries \newprettytrue
+\doifnotmode{mkiv}{
+ \enableactivediscretionaries
+ \newprettytrue
+}
\unprotect
@@ -57,7 +60,8 @@
\getrawparameters[Module][type=tex,#1]}
\def\startmodule
- {\dosingleempty\dostartmodule}
+ {\starttext
+ \dosingleempty\dostartmodule}
\def\complexmodule[#1]%
{\startglobal % i.v.m. \bgroup in \startdocumentation
@@ -71,7 +75,8 @@
[\v!index]
[\c!balance=\v!yes,
\c!indicator=\v!no,
- \c!criterium=\v!text]}
+ \c!criterium=\v!text]
+ \stoptext}
\def\simplemodule#1%
{\type{#1}}
diff --git a/tex/context/base/s-mod.ctx b/tex/context/base/s-mod.ctx
new file mode 100644
index 000000000..a85c991a5
--- /dev/null
+++ b/tex/context/base/s-mod.ctx
@@ -0,0 +1,24 @@
+<?xml version='1.0' standalone='yes'?>
+
+<ctx:job>
+ <ctx:message>TeX Documentation Generator</ctx:message>
+ <ctx:preprocess>
+ <ctx:processors>
+ <ctx:processor name='ted'>mtxrun --script modules --convert --prep <ctx:value name='old'/></ctx:processor>
+ </ctx:processors>
+ <ctx:files>
+ <ctx:file processor='ted'><ctx:value name='old'/></ctx:file>
+ </ctx:files>
+ </ctx:preprocess>
+ <ctx:flags>
+ <!-- ctx:flag>purge</ctx:flag -->
+ <ctx:flag>global</ctx:flag>
+ <ctx:flag>prep</ctx:flag>
+ </ctx:flags>
+ <ctx:process>
+ <ctx:resources>
+ <ctx:module>mod-01</ctx:module>
+ </ctx:resources>
+ </ctx:process>
+</ctx:job>
+
diff --git a/tex/context/base/scrn-fld.mkii b/tex/context/base/scrn-fld.mkii
index 85e4aa738..4e1b34fa9 100644
--- a/tex/context/base/scrn-fld.mkii
+++ b/tex/context/base/scrn-fld.mkii
@@ -340,6 +340,8 @@
%D \field[XXXX]
%D \fitfield[XXXX]
%D \stoptyping
+%D
+%D Beware, in \MKII\ we don't support autocloning for radiofields.
\newif\ifdefinemainfield \definemainfieldfalse
diff --git a/tex/context/base/scrn-fld.mkiv b/tex/context/base/scrn-fld.mkiv
index 4bcc0eabd..8db990612 100644
--- a/tex/context/base/scrn-fld.mkiv
+++ b/tex/context/base/scrn-fld.mkiv
@@ -150,29 +150,6 @@
\def\donormalfield{\doprocessfield\dohandlefield}
\def\dofitfield {\doprocessfield\dohandlefitfield}
-% \def\doprocessfield#1[#2][#3]% \method [name] [label]
-% {\dontleavehmode
-% \begingroup
-% \loadfieldscripts
-% \edef\currentfieldname {#2}%
-% \edef\currentfieldlabel{#3}%
-% \edef\currentfieldgroup{\ctxlua{backends.codeinjections.getfieldgroup("#2")}}%
-% \ifx\currentfieldlabel\empty
-% \let\currentfieldlabel\currentfieldname
-% \fi
-% \ifx\currentfieldgroup\empty
-% #1[#2][\v!label,\v!frame,\v!horizontal][][][]%
-% \else
-% \getvalue{\??fd::\currentfieldgroup}%
-% #1[#2][][][][]% todo: pass setups
-% \fi
-% \endgroup}
-
-% \def\dosetupfieldindeed#1#2[#3][#4][#5][#6][#7]%
-% {#1[#2][#4][#5][#6][#7]}
-%
-% equals:
-
\def\dosetupfieldindeed#1#2[#3]% [#4][#5][#6][#7]%
{#1[#2]} % [#4][#5][#6][#7]}
diff --git a/tex/context/base/spec-fdf.mkii b/tex/context/base/spec-fdf.mkii
index 6579a9247..6f5a83bcb 100644
--- a/tex/context/base/spec-fdf.mkii
+++ b/tex/context/base/spec-fdf.mkii
@@ -1171,7 +1171,7 @@
\def\FDFflagMultiLine {4096} % 13
\def\FDFflagNoToggleToOff {16384} % 15
-\def\FDFflagRadio {32768} % 16
+\def\FDFflagRadio {32768} % 16 (not used as such)
\def\FDFflagPushButton {65536} % 17
\def\FDFflagPopUp {131072} % 18
\def\FDFflagEdit {262144} % 19
@@ -1376,66 +1376,31 @@
\let\FDFactions\empty
-%\def\setFDFactions[#1,#2,#3,#4,#5,#6,#7,#8]%
-% {\global\let\FDFactions\empty
-% \setFDFaction D#1% mousedown
-% \setFDFaction U#2% mouseup
-% \setFDFaction E#3% enterregion
-% \setFDFaction X#4% exitregion
-% \setFDFaction K#5% afterkeystroke
-% \setFDFaction F#6% formatresult
-% \setFDFaction V#7% validateresult
-% \setFDFaction C#8% calculatewhatever
-% \ifx\FDFactions\empty\else
-% \xdef\FDFactions{/AA << \FDFactions >>}% since 1.3 no longer inherited
-% \fi}
-%% {\setFDFaction A#2}% mouseup % changed for version 5
-
-% \def\setFDFactions[#1,#2,#3,#4,#5,#6,#7,#8,%
-% {\global\let\FDFactions\empty
-% \setFDFaction D#1% mousedown
-% %\setFDFaction U#2% mouseup
-% \setFDFaction E#3% enterregion
-% \setFDFaction X#4% exitregion
-% \setFDFaction K#5% afterkeystroke
-% \setFDFaction F#6% formatresult
-% \setFDFaction V#7% validateresult
-% \setFDFaction C#8% calculatewhatever
-% \setFDFactionsmore#2,}
-
-% \def\setFDFactionsmore#1,#2,#3]%
-% {\setFDFaction{Fo}#2% focusin
-% \setFDFaction{Bl}#3% focusout % was I (now pdf ref manual explicitly talks about lowercase l)
-% \ifx\FDFactions\empty\else
-% \xdef\FDFactions{/AA << \FDFactions >>}% since 1.3 no longer inherited
-% \fi
-% \setFDFaction A#1}% mouseup
-
\def\setFDFactions[#1,#2,#3,#4,#5,#6,#7,#8,%
{\global\let\FDFactions\empty
- \setFDFaction D#1% mousedown
- \setFDFaction U#2% mouseup
- \setFDFaction E#3% enterregion
- \setFDFaction X#4% exitregion
- \setFDFaction K#5% afterkeystroke
- \setFDFaction F#6% formatresult
- \setFDFaction V#7% validateresult
- \setFDFaction C#8% calculatewhatever
+ \setFDFaction D#1\relax% mousedown
+ \setFDFaction U#2\relax% mouseup
+ \setFDFaction E#3\relax% enterregion
+ \setFDFaction X#4\relax% exitregion
+ \setFDFaction K#5\relax% afterkeystroke
+ \setFDFaction F#6\relax% formatresult
+ \setFDFaction V#7\relax% validateresult
+ \setFDFaction C#8\relax% calculatewhatever
\setFDFactionsmore}
\def\setFDFactionsmore#1,#2]%
- {\setFDFaction{Fo}#1% focusin
- \setFDFaction{Bl}#2% focusout % was I (now pdf ref manual explicitly talks about lowercase l)
+ {\setFDFaction{Fo}#1\relax% focusin
+ \setFDFaction{Bl}#2\relax% focusout % was I (now pdf ref manual explicitly talks about lowercase l)
\ifx\FDFactions\empty\else
\xdef\FDFactions{/AA << \FDFactions >>}% since 1.3 no longer inherited
\fi}
% todo, when new var scheme is implemented
%
-% \setFDFaction{PO}\@@DriverFieldPageOpen
-% \setFDFaction{PC}\@@DriverFieldPageClose
-% \setFDFaction{PV}\@@DriverFieldPageVisible
-% \setFDFaction{PI}\@@DriverFieldPageInVisible
+% \setFDFaction{PO}\@@DriverFieldPageOpen\relax
+% \setFDFaction{PC}\@@DriverFieldPageClose\relax
+% \setFDFaction{PV}\@@DriverFieldPageVisible\relax
+% \setFDFaction{PI}\@@DriverFieldPageInVisible\relax
%D The event handler becomes something:
%D
@@ -1444,7 +1409,7 @@
%D /A << /S /JavaScript /JS (...) >>
%D \stoptyping
-% \def\setFDFaction#1#2%
+% \def\setFDFaction#1#2\relax%
% {\bgroup
% \global\let\sanitizedJScode\empty
% \def\setFDFaction##1%
@@ -1466,7 +1431,7 @@
%
% acrobat 5 supports other that JS actions too
-\def\setFDFaction#1#2%
+\def\setFDFaction#1#2\relax%
{\bgroup
\def\docommand{\xdef\FDFactions{\FDFactions /#1 << \lastPDFaction >> }}%
\@EA\handlereferenceactions\@EA{#2}\docommand % one level expansion
@@ -1486,7 +1451,7 @@
%D a message to the console.
\def\testFDFactions
- {\def\setFDFaction##1##2%
+ {\def\setFDFaction##1##2\relax%
{\doPSsanitizeJScode console.show();console.println("executing:##1"); \to\sanitizedJScode
\edef\FDFactions{\FDFactions /##1 << /S /JavaScript /JS (\sanitizedJScode) >> }}}
@@ -1919,6 +1884,11 @@
\def\doFDFpresetcheckfield#1#2#3#4#5#6#7%
{\doFDFpresetpushcheckfield{#1}{#2}{#3}{#4}{#5}{#6}{#7}{1}}
+% As pdf widgets are rather consistently upward incompatible
+% especially with regards to inheritance, the following code is not
+% quite okay. I've decided no longer to bother about in it in MkII
+% and use a flat model in MkIV which somehow seems to work better.
+
\def\doFDFpresetradiofield#1#2#3#4#5#6#7#8%
{\bgroup
\setFDFlayer\@@DriverFieldLayer
@@ -2003,13 +1973,19 @@
% seems to be more important than compatibility of documents, which in
% turn renders acrobat useless for forms.] Anyway, synchronization is
% broken or not depending on the combination pdfversion/acrobatversion.
+%
+% Hm, nowadays Radio will overload RadiosInUnison so we need to use only one
+% of them.
\def\doFDFpresetradiorecord#1#2#3#4#5%
{\bgroup
% < pdf 1.5 (1.5 was broken)
% \setFDFswitches[Radio,NoToggleToOff,RadiosInUnison,#3]%
% > pdf 1.5
- \setFDFswitches[Radio,RadiosInUnison,#3]%
+ % \setFDFswitches[Radio,RadiosInUnison,#3]%
+ % > pdf 1.6
+ \setFDFswitches[RadiosInUnison,#3]%
+ %setFDFswitches[PushButton,RadiosInUnison,#3]% this is what acrobat itself does
% older, else fatal error
% \setFDFkids[#4][]%
% newer
diff --git a/tex/context/base/strc-bkm.lua b/tex/context/base/strc-bkm.lua
index 5868ce423..f098ea864 100644
--- a/tex/context/base/strc-bkm.lua
+++ b/tex/context/base/strc-bkm.lua
@@ -112,4 +112,4 @@ end
--~ end
--~ return table.concat(t,"")
--~ end
---~ texio.write_nl(nodes.toutf(tex.box[999].list))
+--~ print(nodes.toutf(tex.box[999].list))
diff --git a/tex/context/base/strc-des.mkiv b/tex/context/base/strc-des.mkiv
index 2c3a0d641..1313ce097 100644
--- a/tex/context/base/strc-des.mkiv
+++ b/tex/context/base/strc-des.mkiv
@@ -742,7 +742,10 @@
\xdef\currentdescriptionlabel {\descriptionparameter\c!label}%
\xdef\currentdescriptionreference{\descriptionparameter\c!reference}%
%
- \doif{\descriptionparameter\c!title}\v!none{\global\nodescriptioncaptiontrue\global\nodescriptionnumbertrue}% will become obsolete
+% \doif{\descriptionparameter\c!title}\v!none{\global\nodescriptioncaptiontrue\global\nodescriptionnumbertrue}% will become obsolete
+ \ifx\currentdescriptiontitle\v!none % will become obsolete
+ \global\nodescriptioncaptiontrue\global\nodescriptionnumbertrue
+ \fi
%
\ifconditional\enumerationnumberenabled
\doifelsedescriptioncomponent\donothing\doenumerationincrementcounter
diff --git a/tex/context/base/strc-doc.lua b/tex/context/base/strc-doc.lua
index 051c682ec..225ad62d8 100644
--- a/tex/context/base/strc-doc.lua
+++ b/tex/context/base/strc-doc.lua
@@ -13,7 +13,7 @@ local texsprint, texwrite = tex.sprint, tex.write
local ctxcatcodes = tex.ctxcatcodes
local variables = interfaces.variables
-if not trackers then trackers = { register = function() end } end
+--~ if not trackers then trackers = { register = function() end } end
local trace_sectioning = false trackers.register("structure.sectioning", function(v) trace_sectioning = v end)
@@ -328,6 +328,23 @@ function sections.number_at_depth(depth)
return data.numbers[tonumber(depth) or sections.getlevel(depth) or 0] or 0
end
+function sections.numbers()
+ return data.numbers
+end
+
+function sections.matching_till_depth(depth,numbers)
+ local dn = data.numbers
+ local ok = false
+ for i=1,depth do
+ if dn[i] == numbers[i] then
+ ok = true
+ else
+ return false
+ end
+ end
+ return ok
+end
+
function sections.getnumber(depth)
return texwrite(data.numbers[depth] or 0)
end
diff --git a/tex/context/base/strc-doc.mkiv b/tex/context/base/strc-doc.mkiv
index 2a003021f..2970fbc85 100644
--- a/tex/context/base/strc-doc.mkiv
+++ b/tex/context/base/strc-doc.mkiv
@@ -53,13 +53,19 @@
\def\dostructurecomponent[#1][#2]% #1=interfaced-settings, #2=optional user data (not yet supported)
{\begingroup
\getparameters[\??ns][#1]%
- \xdef\currentstructurename {\structureparameter\c!name}%
- \xdef\currentstructurecoupling {\structureparameter\c!coupling}%
- \xdef\currentstructureownnumber{\structureparameter\c!ownnumber}% optional own number
- \xdef\currentstructurelevel {\structureparameter\c!level}%
- \edef\currentstructureexpansion{\structureparameter\c!expansion}%
- \xdef\currentstructurexmlsetup {\structureparameter\c!xmlsetup}%
- \xdef\currentstructurecatcodes {\structureparameter\s!catcodes}%
+ \xdef\currentstructurename {\structureparameter\c!name}%
+ \xdef\currentstructurecoupling {\structureparameter\c!coupling}%
+ \xdef\currentstructureownnumber {\structureparameter\c!ownnumber}% optional own number
+ \xdef\currentstructurelevel {\structureparameter\c!level}%
+ \edef\currentstructureexpansion {\structureparameter\c!expansion}%
+ \xdef\currentstructurexmlsetup {\structureparameter\c!xmlsetup}%
+ \xdef\currentstructurecatcodes {\structureparameter\s!catcodes}%
+ \xdef\currentstructurelabel {\structureparameter\c!label}%
+ \xdef\currentstructurereference {\structureparameter\c!reference}%
+ \xdef\currentstructurereferenceprefix{\structureparameter\c!referenceprefix}%
+ \xdef\currentstructureshownumber {\structureparameter\c!number}%
+ \xdef\currentstructuresaveinlist {\structureparameter\c!saveinlist}%
+ \xdef\currentstructureincrementnumber{\structureparameter\c!incrementnumber}%
\ifx\currentstructureexpansion\s!xml
\xmlstartraw
\xdef\currentstructuretitle {\structureparameter\c!title}%
@@ -94,12 +100,6 @@
\fi
\globallet\currentstructurecoding\s!tex
\fi
- \xdef\currentstructurelabel {\structureparameter\c!label}%
- \xdef\currentstructurereference {\structureparameter\c!reference}%
- \xdef\currentstructurereferenceprefix{\structureparameter\c!referenceprefix}%
- \xdef\currentstructureshownumber {\structureparameter\c!number}%
- \xdef\currentstructuresaveinlist {\structureparameter\c!saveinlist}%
- \xdef\currentstructureincrementnumber{\structureparameter\c!incrementnumber}%
\setnextinternalreference
\xdef\currentstructurenumber{\ctxlua{ % todo: combine with next call, adapt marks accordingly
structure.sections.somelevel {
diff --git a/tex/context/base/strc-ini.lua b/tex/context/base/strc-ini.lua
index e4d4922f2..a46827902 100644
--- a/tex/context/base/strc-ini.lua
+++ b/tex/context/base/strc-ini.lua
@@ -278,7 +278,6 @@ function sets.get(namespace,block,name,level,default) -- check if name is passed
if not ds then
return default
end
---~ print(namespace,block,name,level,ds)
local dn
if name and name ~= "" then
if block and block ~= "" then
diff --git a/tex/context/base/strc-lst.lua b/tex/context/base/strc-lst.lua
index 65bf8b4c7..e48138166 100644
--- a/tex/context/base/strc-lst.lua
+++ b/tex/context/base/strc-lst.lua
@@ -15,6 +15,8 @@ local format, tonumber = string.format, tonumber
local texsprint, texprint, texwrite, texcount = tex.sprint, tex.print, tex.write, tex.count
local insert, remove = table.insert, table.remove
+local trace_lists = false trackers.register("structure.lists", function(v) trace_lists = v end)
+
local ctxcatcodes = tex.ctxcatcodes
structure.lists = structure.lists or { }
@@ -135,7 +137,7 @@ end
local function filter_collected(names, criterium, number, collected)
local numbers, depth = documents.data.numbers, documents.data.depth
- local hash, result, all = { }, { }, not names or names == "" or names == variables.all
+ local hash, result, all, detail = { }, { }, not names or names == "" or names == variables.all, nil
if not all then
for s in names:gmatch("[^, ]+") do
hash[s] = true
@@ -267,26 +269,36 @@ local function filter_collected(names, criterium, number, collected)
return filter_collected(names,variables.current,number,collected)
end
else -- sectionname, number
+ -- now same as register
local depth = sections.getlevel(criterium)
- local number = tonumber(number) or 0
- for i=1,#collected do
- local v = collected[i]
- local r = v.references
- if r then
- local sectionnumber = jobsections.collected[r.section]
- if sectionnumber then -- and not sectionnumber.hidenumber then
- local cnumbers = sectionnumber.numbers
- local metadata = v.metadata
- if cnumbers then
--- if metadata and not metadata.nolist and (all or hash[metadata.name or false]) and #cnumbers >= depth and cnumbers[depth] == number then
- if metadata and not metadata.nolist and (all or hash[metadata.name or false]) and #cnumbers >= depth and (number == 0 or cnumbers[depth] == number) then
- result[#result+1] = v
+ local number = tonumber(number) or sections.number_at_depth(depth) or 0
+ detail = format("depth: %s, number: %s, numbers: %s",depth,number,concat(sections.numbers(),".",1,depth))
+ if number > 0 then
+ for i=1,#collected do
+ local v = collected[i]
+ local r = v.references
+ if r then
+ local sectionnumber = jobsections.collected[r.section]
+ if sectionnumber then
+ local metadata = v.metadata
+ local cnumbers = sectionnumber.numbers
+ if cnumbers then
+ if (all or hash[metadata.name or false]) and #cnumbers >= depth and sections.matching_till_depth(depth,cnumbers) then
+ result[#result+1] = v
+ end
end
end
end
end
end
end
+ if trace_lists then
+ if detail then
+ logs.report("lists","criterium: %s, %s, found: %s",criterium,detail,#result)
+ else
+ logs.report("lists","criterium: %s, found: %s",criterium,#result)
+ end
+ end
return result
end
diff --git a/tex/context/base/strc-num.lua b/tex/context/base/strc-num.lua
index e32657019..e07b59fc7 100644
--- a/tex/context/base/strc-num.lua
+++ b/tex/context/base/strc-num.lua
@@ -426,7 +426,7 @@ function counters.converted(name,spec) -- name can be number and reference to st
if cd then
local spec = spec or { }
local numbers, ownnumbers = { }, { }
- local reverse = spec.order == variables["reverse"]
+ local reverse = spec.order == variables.reverse
local kind = spec.type or "number"
local v_first, v_next, v_previous, v_last = variables.first, variables.next, variables.previous, variables.last
local data = cd.data
@@ -451,7 +451,8 @@ function counters.converted(name,spec) -- name can be number and reference to st
local vf = v.first
local vl = v.last
if vl > 0 then
- vn = vl - vn + 1 + vf
+ -- vn = vl - vn + 1 + vf
+ vn = vl - vn + vf -- see testbed for test
end
end
end
diff --git a/tex/context/base/strc-pag.lua b/tex/context/base/strc-pag.lua
index 564961191..7edd91f77 100644
--- a/tex/context/base/strc-pag.lua
+++ b/tex/context/base/strc-pag.lua
@@ -97,11 +97,11 @@ end
function pages.number(realdata,pagespec)
local userpage, block = realdata.number, realdata.block or "" -- sections.currentblock()
local numberspec = realdata.numberdata
- local conversionset = (pagespec and pagespec.conversionset and pagespec.conversionset ~= "") or (numberspec and numberspec.conversionset ~= "" and numberspec.conversionset) or ""
- local conversion = (pagespec and pagespec.conversion and pagespec.conversion ~= "") or (numberspec and numberspec.conversion ~= "" and numberspec.conversion ) or ""
- local stopper = (pagespec and pagespec.stopper and pagespec.stopper ~= "") or (numberspec and numberspec.stopper ~= "" and numberspec.stopper ) or ""
+ local conversionset = (pagespec and pagespec.conversionset ~= "" and pagespec.conversionset) or (numberspec and numberspec.conversionset ~= "" and numberspec.conversionset) or ""
+ local conversion = (pagespec and pagespec.conversion ~= "" and pagespec.conversion ) or (numberspec and numberspec.conversion ~= "" and numberspec.conversion ) or ""
+ local stopper = (pagespec and pagespec.stopper ~= "" and pagespec.stopper ) or (numberspec and numberspec.stopper ~= "" and numberspec.stopper ) or ""
if conversion ~= "" then
- texsprint(ctxcatcodes,format("\\convertnumber{%s}{%s}",conversion,number))
+ texsprint(ctxcatcodes,format("\\convertnumber{%s}{%s}",conversion,userpage))
else
if conversionset == "" then conversionset = "default" end
local theconversion = sets.get("structure:conversions",block,conversionset,index,"numbers")
diff --git a/tex/context/base/strc-reg.lua b/tex/context/base/strc-reg.lua
index 6c7c26efe..ac0426504 100644
--- a/tex/context/base/strc-reg.lua
+++ b/tex/context/base/strc-reg.lua
@@ -8,9 +8,11 @@ if not modules then modules = { } end modules ['strc-reg'] = {
local next, type = next, type
local texwrite, texsprint, texcount = tex.write, tex.sprint, tex.count
-local format, gmatch = string.format, string.gmatch
+local format, gmatch, concat = string.format, string.gmatch, table.concat
local utfchar = utf.char
+local trace_registers = false trackers.register("structure.registers", function(v) trace_registers = v end)
+
local ctxcatcodes = tex.ctxcatcodes
local variables = interfaces.variables
@@ -20,13 +22,14 @@ local sections = structure.sections
local documents = structure.documents
local pages = structure.pages
--- to be shared, but tested first
+-- some day we will share registers and lists (although there are some conceptual
+-- differences in the application of keywords)
local function filter_collected(names,criterium,number,collected,prevmode)
if not criterium or criterium == "" then criterium = variables.all end
local data = documents.data
local numbers, depth = data.numbers, data.depth
- local hash, result, all = { }, { }, not names or names == "" or names == variables.all
+ local hash, result, all, detail = { }, { }, not names or names == "" or names == variables.all, nil
if not all then
for s in gmatch(names,"[^, ]+") do
hash[s] = true
@@ -117,38 +120,49 @@ local function filter_collected(names,criterium,number,collected,prevmode)
return filter_collected(names,variables.current,number,collected,prevmode)
end
else -- sectionname, number
+ -- beware, this works ok for registers
local depth = sections.getlevel(criterium)
- local number = tonumber(number) or 0
- for i=1,#collected do
- local v = collected[i]
- local r = v.references
- if r then
- local sectionnumber = jobsections.collected[r.section]
- if sectionnumber then
- local metadata = v.metadata
- local cnumbers = sectionnumber.numbers
- if cnumbers then
- if (all or hash[metadata.name or false]) and #cnumbers >= depth and (number == 0 or cnumbers[depth] == number) then
- result[#result+1] = v
+ local number = tonumber(number) or sections.number_at_depth(depth) or 0
+ detail = format("depth: %s, number: %s, numbers: %s",depth,number,concat(sections.numbers(),".",1,depth))
+ if number > 0 then
+ for i=1,#collected do
+ local v = collected[i]
+ local r = v.references
+ if r then
+ local sectionnumber = jobsections.collected[r.section]
+ if sectionnumber then
+ local metadata = v.metadata
+ local cnumbers = sectionnumber.numbers
+ if cnumbers then
+ if (all or hash[metadata.name or false]) and #cnumbers >= depth and sections.matching_till_depth(depth,cnumbers) then
+ result[#result+1] = v
+ end
end
end
end
end
end
end
+ if trace_registers then
+ if detail then
+ logs.report("registers","criterium: %s, %s, found: %s",criterium,detail,#result)
+ else
+ logs.report("registers","criterium: %s, found: %s",criterium,#result)
+ end
+ end
return result
end
-structure.filter_collected = filter_collected
+jobregisters = jobregisters or { }
+jobregisters.collected = jobregisters.collected or { }
+jobregisters.tobesaved = jobregisters.tobesaved or { }
+
+jobregisters.filter_collected = filter_collected
-- we follow a different strategy than by lists, where we have a global
-- result table; we might do that here as well but since sorting code is
-- older we delay that decision
-jobregisters = jobregisters or { }
-jobregisters.collected = jobregisters.collected or { }
-jobregisters.tobesaved = jobregisters.tobesaved or { }
-
local tobesaved, collected = jobregisters.tobesaved, jobregisters.collected
local function initializer()
@@ -302,7 +316,7 @@ function jobregisters.compare(a,b)
end
function jobregisters.filter(data,options)
- data.result = structure.filter_collected(nil,options.criterium,options.number,data.entries,true)
+ data.result = jobregisters.filter_collected(nil,options.criterium,options.number,data.entries,true)
end
function jobregisters.prepare(data)
diff --git a/tex/context/base/syst-lua.lua b/tex/context/base/syst-lua.lua
index dce6cf2da..228765eea 100644
--- a/tex/context/base/syst-lua.lua
+++ b/tex/context/base/syst-lua.lua
@@ -20,6 +20,13 @@ function commands.writestatus(a,b,c,...)
texiowrite_nl(format("%-16s: %s\n",a,b)) -- b can have %'s
end
end
+function commands.writedebug(a,b,c,...)
+ if c then
+ texiowrite_nl(format("%-16s| %s\n",a,format(b,c,...)))
+ else
+ texiowrite_nl(format("%-16s| %s\n",a,b)) -- b can have %'s
+ end
+end
function commands.doifelse(b)
if b then -- faster with if than with expression
diff --git a/tex/context/base/trac-tra.lua b/tex/context/base/trac-tra.lua
index afa264379..56ca02dfb 100644
--- a/tex/context/base/trac-tra.lua
+++ b/tex/context/base/trac-tra.lua
@@ -15,7 +15,7 @@ debugger = debugger or { }
local counters = { }
local names = { }
local getinfo = debug.getinfo
-local format, find, lower, gmatch = string.format, string.find, string.lower, string.gmatch
+local format, find, lower, gmatch, gsub = string.format, string.find, string.lower, string.gmatch, string.gsub
-- one
@@ -149,7 +149,7 @@ local data, done = { }, { }
local function set(what,value)
if type(what) == "string" then
- what = aux.settings_to_array(what)
+ what = aux.settings_to_array(what) -- inefficient but ok
end
for i=1,#what do
local w = what[i]
@@ -174,6 +174,19 @@ local function reset()
end
end
+local function enable(what)
+ set(what,true)
+end
+
+local function disable(what)
+ if not what or what == "" then
+ done = { }
+ reset()
+ else
+ set(what,false)
+ end
+end
+
function trackers.register(what,...)
what = lower(what)
local w = data[what]
@@ -192,20 +205,20 @@ function trackers.register(what,...)
end
function trackers.enable(what)
- done = { }
- set(what,true)
+ local e = trackers.enable
+ trackers.enable, done = enable, { }
+ enable(string.simpleesc(what))
+ trackers.enable, done = e, { }
end
function trackers.disable(what)
- done = { }
- if not what or what == "" then
- trackers.reset(what)
- else
- set(what,false)
- end
+ local e = trackers.disable
+ trackers.disable, done = disable, { }
+ disable(string.simpleesc(what))
+ trackers.disable, done = e, { }
end
-function trackers.reset(what)
+function trackers.reset()
done = { }
reset()
end
diff --git a/tex/generic/context/luatex-fonts-merged.lua b/tex/generic/context/luatex-fonts-merged.lua
index ad4c1896b..e32e2fc76 100644
--- a/tex/generic/context/luatex-fonts-merged.lua
+++ b/tex/generic/context/luatex-fonts-merged.lua
@@ -1,6 +1,6 @@
-- merged file : c:/data/develop/context/texmf/tex/generic/context/luatex-fonts-merged.lua
-- parent file : c:/data/develop/context/texmf/tex/generic/context/luatex-fonts.lua
--- merge date : 09/09/09 14:33:34
+-- merge date : 09/11/09 18:16:02
do -- begin closure to overcome local limits and interference
@@ -197,6 +197,16 @@ function string:pattesc()
return (gsub(self,".",patterns_escapes))
end
+local simple_escapes = {
+ ["-"] = "%-",
+ ["."] = "%.",
+ ["*"] = ".*",
+}
+
+function string:simpleesc()
+ return (gsub(self,".",simple_escapes))
+end
+
function string:tohash()
local t = { }
for s in gmatch(self,"([^, ]+)") do -- lpeg
@@ -246,6 +256,12 @@ function string:compactlong() -- strips newlines and leading spaces
return self
end
+function string:striplong() -- strips newlines and leading spaces
+ self = gsub(self,"^%s*","")
+ self = gsub(self,"[\n\r]+ *","\n")
+ return self
+end
+
end -- closure
do -- begin closure to overcome local limits and interference