summaryrefslogtreecommitdiff
path: root/tex
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2014-05-05 22:31:00 +0200
committerHans Hagen <pragma@wxs.nl>2014-05-05 22:31:00 +0200
commitb32b619990c38ea7e53081ce0430ca4fcccfe911 (patch)
tree3c1f0082a54733ed03d701d436907cb4fd50f700 /tex
parent3a9be11a68e3bd5453edf1c0c7d469442dbd0cf3 (diff)
downloadcontext-b32b619990c38ea7e53081ce0430ca4fcccfe911.tar.gz
beta 2014.05.05 22:31
Diffstat (limited to 'tex')
-rw-r--r--tex/context/base/buff-ini.lua10
-rw-r--r--tex/context/base/buff-ini.mkiv8
-rw-r--r--tex/context/base/buff-ver.mkiv2
-rw-r--r--tex/context/base/chem-str.lua39
-rw-r--r--tex/context/base/chem-str.mkiv14
-rw-r--r--tex/context/base/cldf-prs.lua42
-rw-r--r--tex/context/base/cont-new.mkiv2
-rw-r--r--tex/context/base/context-version.pdfbin4061 -> 4056 bytes
-rw-r--r--tex/context/base/context.mkiv2
-rw-r--r--tex/context/base/core-con.lua60
-rw-r--r--tex/context/base/core-con.mkiv4
-rw-r--r--tex/context/base/font-run.mkiv2
-rw-r--r--tex/context/base/math-map.lua2
-rw-r--r--tex/context/base/mtx-context-listing.tex17
-rw-r--r--tex/context/base/mult-ini.lua12
-rw-r--r--tex/context/base/mult-low.lua1
-rw-r--r--tex/context/base/node-ref.lua5
-rw-r--r--tex/context/base/pack-rul.lua44
-rw-r--r--tex/context/base/status-files.pdfbin24625 -> 24657 bytes
-rw-r--r--tex/context/base/status-lua.pdfbin242466 -> 242871 bytes
-rw-r--r--tex/context/base/strc-blk.mkiv3
-rw-r--r--tex/context/base/tabl-tbl.mkiv4
-rw-r--r--tex/context/base/tabl-xnt.mkvi2
-rw-r--r--tex/context/base/tabl-xtb.lua25
-rw-r--r--tex/context/base/tabl-xtb.mkvi8
-rw-r--r--tex/context/base/util-sci.lua78
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua2
27 files changed, 279 insertions, 109 deletions
diff --git a/tex/context/base/buff-ini.lua b/tex/context/base/buff-ini.lua
index 84532f072..c4046d649 100644
--- a/tex/context/base/buff-ini.lua
+++ b/tex/context/base/buff-ini.lua
@@ -194,7 +194,7 @@ local continue = false
-- An \n is unlikely to show up as \r is the endlinechar but \n is more generic
-- for us.
--- This fits the way we fetch verbatim: the indentatio before the sentinel
+-- This fits the way we fetch verbatim: the indentation before the sentinel
-- determines the stripping.
-- str = [[
@@ -238,7 +238,7 @@ local whatever = (P(1)-eol)^0 * eol^1
local strippers = { }
-local function undent(str) -- new version, needs testing
+local function undent(str) -- new version, needs testing: todo: not always needed, like in xtables
local margin = lpegmatch(getmargin,str)
if type(margin) ~= "string" then
return str
@@ -255,7 +255,7 @@ local function undent(str) -- new version, needs testing
return lpegmatch(stripper,str) or str
end
-function commands.grabbuffer(name,begintag,endtag,bufferdata,catcodes) -- maybe move \\ to call
+function commands.grabbuffer(name,begintag,endtag,bufferdata,catcodes,doundent) -- maybe move \\ to call
local dn = getcontent(name)
if dn == "" then
nesting = 0
@@ -291,8 +291,8 @@ function commands.grabbuffer(name,begintag,endtag,bufferdata,catcodes) -- maybe
if last == "\n" or last == "\r" then -- \n is unlikely as \r is the endlinechar
dn = sub(dn,1,-2)
end
- if autoundent then
- dn = undent(dn)
+ if doundent or (autoundent and doundent == nil) then
+ dn = undent(dn)
end
end
assign(name,dn,catcodes)
diff --git a/tex/context/base/buff-ini.mkiv b/tex/context/base/buff-ini.mkiv
index 4ea3042b6..6582e3587 100644
--- a/tex/context/base/buff-ini.mkiv
+++ b/tex/context/base/buff-ini.mkiv
@@ -39,8 +39,8 @@
\def\buff_start[#1][#2]%
{\buff_start_indeed{}{#1}{\e!start\v!buffer}{\e!stop\v!buffer}}
-\def\buff_start_indeed#1#2#3#4% \donothing needed !
- {\normalexpanded{\buff_pickup{#2}{#3}{#4}{}{\buff_stop{#4}}}}
+\def\buff_start_indeed#1#2#3#4#5% \donothing needed ! #5=undent)
+ {\normalexpanded{\buff_pickup{#2}{#3}{#4}{}{\buff_stop{#4}}\plusone}}
\unexpanded\def\grabbufferdata % was: \dostartbuffer
{\begingroup % (4)
@@ -64,7 +64,7 @@
\let\buff_finish\relax
\let\buff_gobble\relax
-\unexpanded\def\buff_pickup#1#2#3#4#5% name, startsequence, stopsequence, before, after
+\unexpanded\def\buff_pickup#1#2#3#4#5#6% name, startsequence, stopsequence, before, after, undent
{\begingroup % (1)
#4%
\begingroup % (2)
@@ -77,7 +77,7 @@
#5}%
\def\buff_gobble##1#3% is detokenize needed? TEST
%{\ctxcommand{grabbuffer("#1","#2","#3",\!!bs\detokenize{##1}\!!es)} % space ?
- {\ctxcommand{grabbuffer("#1","#2","#3",\!!bs>##1\!!es,\catcodetableofbuffer)}% space ?
+ {\ctxcommand{grabbuffer("#1","#2","#3",\!!bs>##1\!!es,\catcodetableofbuffer,\ifnum#6=\plusone true\else false\fi)}% space ?
\buff_gobble
\buff_finish}%
\buff_gobble}
diff --git a/tex/context/base/buff-ver.mkiv b/tex/context/base/buff-ver.mkiv
index 17dfd9d69..8b9bd1764 100644
--- a/tex/context/base/buff-ver.mkiv
+++ b/tex/context/base/buff-ver.mkiv
@@ -471,7 +471,7 @@
\normalexpanded{\buff_verbatim_type_block{\e!start\currenttyping}{\e!stop\currenttyping}}}
\unexpanded\def\buff_verbatim_type_block#1#2%
- {\buff_pickup{_typing_}{#1}{#2}{}{\buff_verbatim_type_block_verbatim_indeed{#1}{#2}}} % was dowithbuffer
+ {\buff_pickup{_typing_}{#1}{#2}{}{\buff_verbatim_type_block_verbatim_indeed{#1}{#2}}\plusone} % was dowithbuffer
\def\buff_verbatim_type_block_verbatim_indeed#1#2%
{\buff_verbatim_initialize_typing_two
diff --git a/tex/context/base/chem-str.lua b/tex/context/base/chem-str.lua
index 347363345..cd7a2db06 100644
--- a/tex/context/base/chem-str.lua
+++ b/tex/context/base/chem-str.lua
@@ -147,6 +147,8 @@ local one_keys = {
es = "line",
ed = "line",
et = "line",
+ au = "line",
+ ad = "line",
cz = "text",
rot = "transform",
dir = "transform",
@@ -156,6 +158,7 @@ local one_keys = {
local ring_keys = {
db = "line",
+ hb = "line",
br = "line",
lr = "line",
rr = "line",
@@ -316,7 +319,7 @@ local pattern =
-- print(lpegmatch(pattern,"RZ13=x")) -- 1 RZ false false table x
local f_initialize = 'if unknown context_chem : input mp-chem.mpiv ; fi ;'
-local f_start_structure = formatters['chem_start_structure(%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s);']
+local f_start_structure = formatters['chem_start_structure(%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s);']
local f_set_trace_bounds = formatters['chem_trace_boundingbox := %l ;']
local f_stop_structure = 'chem_stop_structure;'
local f_start_component = 'chem_start_component;'
@@ -536,6 +539,8 @@ local function process(level,spec,text,n,rulethickness,rulecolor,offset,default_
if not t then txt, t = fetch(txt) end
if t then
t = molecule(processor_tostring(t))
+-- local p, t = processors.split(t)
+-- m = m + 1 ; metacode[m] = f_text(operation,p or align,variant,si,t)
m = m + 1 ; metacode[m] = f_text(operation,align,variant,si,t)
end
end
@@ -605,7 +610,7 @@ end
--
-- rulethickness in points
-local function checked(d,factor,unit,scale)
+local function checked(d,bondlength,unit,scale)
if d == v_none then
return 0
end
@@ -613,9 +618,9 @@ local function checked(d,factor,unit,scale)
if not n then
-- assume dimen
elseif n >= 10 or n <= -10 then
- return factor * unit * n / 1000
+ return bondlength * unit * n / 1000
else
- return factor * unit * n
+ return bondlength * unit * n
end
local n = todimen(d)
if n then
@@ -625,7 +630,7 @@ local function checked(d,factor,unit,scale)
end
end
-local function calculated(height,bottom,top,factor,unit,scale)
+local function calculated(height,bottom,top,bondlength,unit,scale)
local scaled = 0
if height == v_none then
-- this always wins
@@ -634,24 +639,24 @@ local function calculated(height,bottom,top,factor,unit,scale)
top = "0pt"
elseif height == v_fit then
height = "true"
- bottom = bottom == v_fit and "true" or topoints(checked(bottom,factor,unit,scale))
- top = top == v_fit and "true" or topoints(checked(top, factor,unit,scale))
+ bottom = bottom == v_fit and "true" or topoints(checked(bottom,bondlength,unit,scale))
+ top = top == v_fit and "true" or topoints(checked(top, bondlength,unit,scale))
else
- height = checked(height,factor,unit,scale)
+ height = checked(height,bondlength,unit,scale)
if bottom == v_fit then
if top == v_fit then
bottom = height / 2
top = bottom
else
- top = checked(top,factor,unit,scale)
+ top = checked(top,bondlength,unit,scale)
bottom = height - top
end
elseif top == v_fit then
- bottom = checked(bottom,factor,unit,scale)
+ bottom = checked(bottom,bondlength,unit,scale)
top = height - bottom
else
- bottom = checked(bottom,factor,unit,scale)
- top = checked(top, factor,unit,scale)
+ bottom = checked(bottom,bondlength,unit,scale)
+ top = checked(top, bondlength,unit,scale)
local ratio = height / (bottom+top)
bottom = bottom * ratio
top = top * ratio
@@ -669,7 +674,7 @@ function chemistry.start(settings)
local width = settings.width or v_fit
local height = settings.height or v_fit
local unit = settings.unit or 655360
- local factor = settings.factor or 3
+ local bondlength = settings.factor or 3
local rulethickness = settings.rulethickness or 65536
local rulecolor = settings.rulecolor or ""
local axiscolor = settings.framecolor or ""
@@ -683,7 +688,7 @@ function chemistry.start(settings)
--
align = settings.symalign or "auto"
if trace_structure then
- report_chemistry("unit %p, factor %s, symalign %s",unit,factor,align)
+ report_chemistry("unit %p, bondlength %s, symalign %s",unit,bondlength,align)
end
if align ~= "" then
align = "." .. align
@@ -713,8 +718,8 @@ function chemistry.start(settings)
local sp_width = 0
local sp_height = 0
--
- width, left, right, sp_width = calculated(width, left, right,factor,unit,scale)
- height, bottom, top, sp_height = calculated(height,bottom,top, factor,unit,scale)
+ width, left, right, sp_width = calculated(width, left, right,bondlength,unit,scale)
+ height, bottom, top, sp_height = calculated(height,bottom,top, bondlength,unit,scale)
--
if width ~= "true" and height ~= "true" and texgetcount("@@trialtypesetting") ~= 0 then
if trace_structure then
@@ -736,7 +741,7 @@ function chemistry.start(settings)
metacode[#metacode+1] = f_start_structure(
chemistry.structures,
left, right, top, bottom,
- rotation, topoints(unit), factor, topoints(offset),
+ rotation, topoints(unit), bondlength, scale, topoints(offset),
tostring(settings.axis == v_on), topoints(rulethickness), tostring(axiscolor)
)
metacode[#metacode+1] = f_set_trace_bounds(trace_boundingbox) ;
diff --git a/tex/context/base/chem-str.mkiv b/tex/context/base/chem-str.mkiv
index d9ec1842b..6aec16f9e 100644
--- a/tex/context/base/chem-str.mkiv
+++ b/tex/context/base/chem-str.mkiv
@@ -705,14 +705,14 @@
\setupchemical
[\c!frame=,
- \c!width=\v!fit, % or unitless number, multiplies scale*EmWidth
- \c!height=\v!fit, % or unitless number, multiplies scale*EmWidth
- \c!left=\v!fit, % or unitless number, multiplies scale*EmWidth
- \c!right=\v!fit, % or unitless number, multiplies scale*EmWidth
- \c!top=\v!fit, % or unitless number, multiplies scale*EmWidth
- \c!bottom=\v!fit, % or unitless number, multiplies scale*EmWidth
+ \c!width=\v!fit, % or unitless number, multiplies scale*unit
+ \c!height=\v!fit, % or unitless number, multiplies scale*unit
+ \c!left=\v!fit, % or unitless number, multiplies scale*unit
+ \c!right=\v!fit, % or unitless number, multiplies scale*unit
+ \c!top=\v!fit, % or unitless number, multiplies scale*unit
+ \c!bottom=\v!fit, % or unitless number, multiplies scale*unit
\c!bodyfont=,
- \c!scale=\v!normal, % small, normal or medium, big, or unitless number (multiplies EmWidth)
+ \c!scale=\v!normal, % small, normal or medium, big, or unitless number (multiplies unit)
\c!size=\v!medium,
\c!textsize=\v!big, % how is textsize used??
\c!axis=\v!off,
diff --git a/tex/context/base/cldf-prs.lua b/tex/context/base/cldf-prs.lua
index 160d30b19..1554b5e57 100644
--- a/tex/context/base/cldf-prs.lua
+++ b/tex/context/base/cldf-prs.lua
@@ -15,17 +15,18 @@ local format = string.format
local cpatterns = patterns.context or { }
patterns.context = cpatterns
+local utf8char = patterns.utf8char
+local cardinal = patterns.cardinal
+
+local leftbrace = P("{")
+local rightbrace = P("}")
local backslash = P("\\")
-local csname = backslash * P(1) * (1-backslash)^0
+local csname = backslash * P(1) * (1-backslash-leftbrace)^0 * P(" ")^0
local sign = P("+") / "\\textplus "
+ P("-") / "\\textminus "
-local leftbrace = P("{")
-local rightbrace = P("}")
local nested = P { leftbrace * (V(1) + (1-rightbrace))^0 * rightbrace }
local subscript = P("_")
local superscript = P("^")
-local utf8char = patterns.utf8char
-local cardinal = patterns.cardinal
-- local scripts = P { "start",
-- start = V("csname") + V("lowfirst") + V("highfirst"),
@@ -35,22 +36,41 @@ local cardinal = patterns.cardinal
-- highfirst = superscript * ( Cc("\\hilo{%s}{%s}") * V("content") * subscript + Cc("\\high{%s}") ) * V("content") / format,
-- }
-local scripts = P { "start",
- start = V("csname") + V("lowfirst") + V("highfirst"),
+-- local scripts = P { "start",
+-- start = (V("csname") + V("lowfirst") + V("highfirst"))^1,
+-- csname = csname,
+-- content = Cs(V("csname") + nested + sign^-1 * (cardinal + utf8char)),
+-- lowfirst = (subscript /"") * ( Cc("\\lohi{") * V("content") * Cc("}{") * (superscript/"") + Cc("\\low{" ) ) * V("content") * Cc("}"),
+-- highfirst = (superscript/"") * ( Cc("\\hilo{") * V("content") * Cc("}{") * (subscript /"") + Cc("\\high{") ) * V("content") * Cc("}"),
+-- }
+
+local scripted = Cs { "start",
+ start = (V("csname") + V("nested") + V("lowfirst") + V("highfirst") + V("utf8char"))^1,
+ rest = V("csname") + V("nested") + V("lowfirst") + V("highfirst"),
csname = csname,
- content = Cs(V("csname") + nested + sign^-1 * (cardinal + utf8char)),
+ utf8char = utf8char,
+ -- nested = leftbrace * (V("rest") + (V("utf8char")-rightbrace))^0 * rightbrace,
+ nested = leftbrace * (V("start") -rightbrace)^0 * rightbrace,
+ content = Cs(V("nested") + sign^-1 * (cardinal + V("utf8char"))),
+ content = V("nested") + sign^-1 * (cardinal + V("utf8char")),
lowfirst = (subscript /"") * ( Cc("\\lohi{") * V("content") * Cc("}{") * (superscript/"") + Cc("\\low{" ) ) * V("content") * Cc("}"),
highfirst = (superscript/"") * ( Cc("\\hilo{") * V("content") * Cc("}{") * (subscript /"") + Cc("\\high{") ) * V("content") * Cc("}"),
}
-local scripted = Cs((csname + scripts + utf8char)^0)
-cpatterns.scripts = scripts
+-- local scripted = Cs((scripts))
+
+-- cpatterns.scripts = scripts
cpatterns.csname = csname
cpatterns.scripted = scripted
cpatterns.nested = nested
--- inspect(scripted)
-- print(lpegmatch(scripted,"10^-3_x"))
+-- print(lpegmatch(scripted,"\\L {C_5}"))
+-- print(lpegmatch(scripted,"\\SL{}"))
+-- print(lpegmatch(scripted,"\\SL{C_5}"))
+-- print(lpegmatch(scripted,"\\SL{C_5}"))
+-- print(lpegmatch(scripted,"{C_5}"))
+-- print(lpegmatch(scripted,"{\\C_5}"))
-- print(lpegmatch(scripted,"10^-a"))
diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv
index e3df6f7bf..cf9aa9a87 100644
--- a/tex/context/base/cont-new.mkiv
+++ b/tex/context/base/cont-new.mkiv
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2014.04.28 23:24}
+\newcontextversion{2014.05.05 22:31}
%D This file is loaded at runtime, thereby providing an excellent place for
%D hacks, patches, extensions and new features.
diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf
index 6450c43f1..b544f56fe 100644
--- a/tex/context/base/context-version.pdf
+++ b/tex/context/base/context-version.pdf
Binary files differ
diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv
index e1ade2ba1..9ef439e45 100644
--- a/tex/context/base/context.mkiv
+++ b/tex/context/base/context.mkiv
@@ -28,7 +28,7 @@
%D up and the dependencies are more consistent.
\edef\contextformat {\jobname}
-\edef\contextversion{2014.04.28 23:24}
+\edef\contextversion{2014.05.05 22:31}
\edef\contextkind {beta}
%D For those who want to use this:
diff --git a/tex/context/base/core-con.lua b/tex/context/base/core-con.lua
index 73ca3e304..3ccfb3e23 100644
--- a/tex/context/base/core-con.lua
+++ b/tex/context/base/core-con.lua
@@ -18,6 +18,7 @@ local floor, date, time, concat = math.floor, os.date, os.time, table.concat
local lower, rep, match = string.lower, string.rep, string.match
local utfchar, utfbyte = utf.char, utf.byte
local tonumber, tostring = tonumber, tostring
+local P, C, Cs, lpegmatch = lpeg.P, lpeg.C, lpeg.Cs, lpeg.match
local context = context
local commands = commands
@@ -124,13 +125,26 @@ local counters = allocate {
languages.counters = counters
-counters['ar'] = counters['arabic']
-counters['gr'] = counters['greek']
-counters['g'] = counters['greek']
-counters['sl'] = counters['slovenian']
-counters['kr'] = counters['korean']
-counters['kr-p'] = counters['korean-parent']
-counters['kr-c'] = counters['korean-circle']
+counters['ar'] = counters['arabic']
+counters['gr'] = counters['greek']
+counters['g'] = counters['greek']
+counters['sl'] = counters['slovenian']
+counters['kr'] = counters['korean']
+counters['kr-p'] = counters['korean-parent']
+counters['kr-c'] = counters['korean-circle']
+
+counters['thainumerals'] = counters['thai']
+counters['devanagarinumerals'] = counters['devanagari']
+counters['gurmurkhinumerals'] = counters['gurmurkhi']
+counters['gujaratinumerals'] = counters['gujarati']
+counters['tibetannumerals'] = counters['tibetan']
+counters['greeknumerals'] = counters['greek']
+counters['arabicnumerals'] = counters['arabic']
+counters['persiannumerals'] = counters['persian']
+counters['arabicexnumerals'] = counters['persian']
+counters['koreannumerals'] = counters['korean']
+counters['koreanparentnumerals'] = counters['korean-parent']
+counters['koreancirclenumerals'] = counters['korean-circle']
local fallback = utfbyte('0')
@@ -207,6 +221,11 @@ function converters.Character (n) return chr (n,upper_offset) end
function converters.characters(n) return chrs(n,lower_offset) end
function converters.Characters(n) return chrs(n,upper_offset) end
+converters['a'] = converters.characters
+converters['A'] = converters.Characters
+converters['AK'] = converters.Characters
+converters['KA'] = converters.Characters
+
function commands.alphabetic(n,c) context(do_alphabetic(n,counters[c],lowercharacter)) end
function commands.Alphabetic(n,c) context(do_alphabetic(n,counters[c],uppercharacter)) end
function commands.character (n) context(chr (n,lower_offset)) end
@@ -271,6 +290,13 @@ converters.toroman = toroman
converters.Romannumerals = toroman
converters.romannumerals = function(n) return lower(toroman(n)) end
+converters['i'] = converters.romannumerals
+converters['I'] = converters.Romannumerals
+converters['r'] = converters.romannumerals
+converters['R'] = converters.Romannumerals
+converters['KR'] = converters.Romannumerals
+converters['RK'] = converters.Romannumerals
+
function commands.romannumerals(n) context(lower(toroman(n))) end
function commands.Romannumerals(n) context( toroman(n)) end
@@ -472,6 +498,10 @@ function converters.chinesenumerals (n) return tochinese(n,"normal") end
function converters.chinesecapnumerals(n) return tochinese(n,"cap" ) end
function converters.chineseallnumerals(n) return tochinese(n,"all" ) end
+converters['cn'] = converters.chinesenumerals
+converters['cn-c'] = converters.chinesecapnumerals
+converters['cn-a'] = converters.chineseallnumerals
+
function commands.chinesenumerals (n) context(tochinese(n,"normal")) end
function commands.chinesecapnumerals(n) context(tochinese(n,"cap" )) end
function commands.chineseallnumerals(n) context(tochinese(n,"all" )) end
@@ -701,8 +731,6 @@ end
-- verbose numbers
--- verbose numbers
-
local data = allocate()
local verbose = { data = data }
converters.verbose = verbose
@@ -948,6 +976,20 @@ function commands.verbose(n,language)
context(t and t.translate(n) or n)
end
+-- These are just helpers but not really for the tex end. Do we have to
+-- use translate here?
+
+local whitespace = lpeg.patterns.whitespace
+local word = (1-whitespace) / characters.upper * (1-whitespace)^1
+local spacing = whitespace^1
+local pattern_one = Cs(word * P(1)^1)
+local pattern_all = Cs((word + spacing)^1)
+
+function converters.word (s) return s end
+function converters.words(s) return s end
+function converters.Word (s) return lpegmatch(pattern_one,s) end
+function converters.Words(s) return lpegmatch(pattern_all,s) end
+
-- --
local v_day = variables.day
diff --git a/tex/context/base/core-con.mkiv b/tex/context/base/core-con.mkiv
index a43473ced..47c7c88d5 100644
--- a/tex/context/base/core-con.mkiv
+++ b/tex/context/base/core-con.mkiv
@@ -686,8 +686,8 @@
\defineconversion [kr-c] [\koreancirclenumerals]
\defineconversion [chinesenumerals] [\chinesenumerals]
-\defineconversion [chinesecapnumeralscn] [\chinesecapnumerals]
-\defineconversion [chineseallnumeralscn] [\chineseallnumerals]
+\defineconversion [chinesecapnumerals] [\chinesecapnumerals]
+\defineconversion [chineseallnumerals] [\chineseallnumerals]
\defineconversion [cn] [\chinesenumerals]
\defineconversion [cn-c] [\chinesecapnumerals]
diff --git a/tex/context/base/font-run.mkiv b/tex/context/base/font-run.mkiv
index 66f1acc91..cb40adedd 100644
--- a/tex/context/base/font-run.mkiv
+++ b/tex/context/base/font-run.mkiv
@@ -311,7 +311,7 @@
\ifdefined\databox \else \newbox\databox \fi
-\unexpanded\gdef\testminimalbaseline#1%
+\unexpanded\gdef\testminimalbaseline#1% to be used in a tabulate
{\setbox\databox\ruledhbox{#1}%
\scratchdimen\ht\databox
\advance\scratchdimen\dp\databox
diff --git a/tex/context/base/math-map.lua b/tex/context/base/math-map.lua
index 8d301ac33..2ebcdfc86 100644
--- a/tex/context/base/math-map.lua
+++ b/tex/context/base/math-map.lua
@@ -445,6 +445,8 @@ mathematics.alphabets = alphabets
local boldmap = { }
+-- ["blackboard"] = { ["bf"] = { ["digits"] = {
+
local function remap(tf,bf)
for _, alphabet in next, alphabets do
local tfdata = alphabet[tf]
diff --git a/tex/context/base/mtx-context-listing.tex b/tex/context/base/mtx-context-listing.tex
index d69db9934..2a333c789 100644
--- a/tex/context/base/mtx-context-listing.tex
+++ b/tex/context/base/mtx-context-listing.tex
@@ -20,7 +20,8 @@
% --sort : sort filenames first
% --topspace=dimension : distance above first line
% --backspace=dimension : distance before left margin
-% --pretty : pretty print comform suffix (temporarily disabled)
+% --pretty : pretty print comform suffix
+% --scite : pretty print comform suffix using scite lexer
% --bodyfont=list : additional bodyfont settings
% --paperformat=spec : paper*print or paperxprint
%
@@ -70,11 +71,16 @@
}
local pattern = document.arguments.pattern
+ local scite = document.arguments.scite
if pattern then
document.files = dir.glob(pattern)
end
+ if scite then
+ context.usemodule { "scite" }
+ end
+
if #document.files > 0 then
if document.arguments.sort then
table.sort(document.files)
@@ -94,19 +100,24 @@
{ function() context.detokenize(pattern and filename or file.basename(filename)) return true end },
{ function() context.pagenumber() return true end }
)
- if pretty then
+ if scite then
+ context.scitefile { filename } -- here { }
+ elseif pretty then
if type(pretty) ~= "string" or pretty == "" then
context.setuptyping { option = "color" }
else
context.setuptyping { option = types[pretty] or pretty }
end
+ context.typefile(filename)
+ else
+ context.typefile(filename)
end
- context.typefile(filename)
end
end
else
context("no files given")
end
+
\stopluacode
\stoptext
diff --git a/tex/context/base/mult-ini.lua b/tex/context/base/mult-ini.lua
index 08f1639d0..62e983abc 100644
--- a/tex/context/base/mult-ini.lua
+++ b/tex/context/base/mult-ini.lua
@@ -265,9 +265,15 @@ function interfaces.cachesetup(t)
end
end
-function interfaces.is_command(str)
- return (str and str ~= "" and token.csname_name(token.create(str)) ~= "") or false -- there will be a proper function for this
-end
+-- if token.lookup then
+-- interfaces.is_command = token.lookup
+-- else
+
+ function interfaces.is_command(str)
+ return (str and str ~= "" and token.csname_name(token.create(str)) ~= "") or false -- there will be a proper function for this
+ end
+
+-- end
function interfaces.interfacedcommand(name)
local command = complete.commands[name]
diff --git a/tex/context/base/mult-low.lua b/tex/context/base/mult-low.lua
index 86095edab..f41104986 100644
--- a/tex/context/base/mult-low.lua
+++ b/tex/context/base/mult-low.lua
@@ -98,6 +98,7 @@ return {
"startproject", "stopproject", "project",
"starttext", "stoptext", "startnotext", "stopnotext","startdocument", "stopdocument", "documentvariable", "setupdocument",
"startmodule", "stopmodule", "usemodule", "usetexmodule", "useluamodule","setupmodule","currentmoduleparameter","moduleparameter",
+ "everystarttext",
--
"startTEXpage", "stopTEXpage",
-- "startMPpage", "stopMPpage", -- already catched by nested lexer
diff --git a/tex/context/base/node-ref.lua b/tex/context/base/node-ref.lua
index c55db4ea3..78ef409bc 100644
--- a/tex/context/base/node-ref.lua
+++ b/tex/context/base/node-ref.lua
@@ -416,17 +416,20 @@ function references.get(n) -- not public so functionality can change
return sn and sn[1]
end
-local function makereference(width,height,depth,reference)
+local function makereference(width,height,depth,reference) -- height and depth are of parent
local sr = stack[reference]
if sr then
if trace_references then
report_reference("resolving attribute %a",reference)
end
local resolved, ht, dp, set, n = sr[1], sr[2], sr[3], sr[4], sr[5]
+-- logs.report("temp","child: ht=%p dp=%p, parent: ht=%p dp=%p",ht,dp,height,depth)
if ht then
if height < ht then height = ht end
if depth < dp then depth = dp end
end
+-- logs.report("temp","used: ht=%p dp=%p",height,depth)
+-- step = 0
local annot = nodeinjections.reference(width,height,depth,set)
if annot then
annot = tonut(annot)
diff --git a/tex/context/base/pack-rul.lua b/tex/context/base/pack-rul.lua
index 5796da800..0c29eb5f1 100644
--- a/tex/context/base/pack-rul.lua
+++ b/tex/context/base/pack-rul.lua
@@ -14,6 +14,8 @@ if not modules then modules = { } end modules ['pack-rul'] = {
-- challenge: adapt glue_set
-- setfield(h,"glue_set", getfield(h,"glue_set") * getfield(h,"width")/maxwidth -- interesting ... doesn't matter much
+local type = type
+
local hlist_code = nodes.nodecodes.hlist
local vlist_code = nodes.nodecodes.vlist
local box_code = nodes.listcodes.box
@@ -29,6 +31,7 @@ local setfield = nuts.setfield
local getnext = nuts.getnext
local getprev = nuts.getprev
local getlist = nuts.getlist
+local getid = nuts.getid
local getsubtype = nuts.getsubtype
local getbox = nuts.getbox
@@ -152,3 +155,44 @@ function commands.doanalyzeframedbox(n)
texsetdimen("global","framedfirstheight",firstheight or 0)
texsetdimen("global","framedlastdepth",lastdepth or 0)
end
+
+
+function nodes.maxboxwidth(box)
+ local boxwidth = getfield(box,"width")
+ if boxwidth == 0 then
+ return 0
+ end
+ local list = getlist(box)
+ if not list then
+ return 0
+ end
+ if getid(box) == hlist_code then
+ return boxwidth
+ end
+ local lastlinelength = 0
+ local maxwidth = 0
+ local function check(n,repack)
+ local l = getlist(n)
+ if l then
+ if repack then
+ local subtype = getsubtype(n)
+ if subtype == box_code or subtype == line_code then
+ lastlinelength = node_dimensions(l,getfield(n,"dir"))
+ else
+ lastlinelength = getfield(n,"width")
+ end
+ else
+ lastlinelength = getfield(n,"width")
+ end
+ if lastlinelength > maxwidth then
+ maxwidth = lastlinelength
+ end
+ end
+ end
+ for h in traverse_id(hlist_code,list) do -- no dir etc needed
+ check(h,true)
+ end
+ for v in traverse_id(vlist_code,list) do -- no dir etc needed
+ check(v,false)
+ end
+end
diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf
index f7a228bfc..a4381c06d 100644
--- a/tex/context/base/status-files.pdf
+++ b/tex/context/base/status-files.pdf
Binary files differ
diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf
index 547c0e785..ad8475aed 100644
--- a/tex/context/base/status-lua.pdf
+++ b/tex/context/base/status-lua.pdf
Binary files differ
diff --git a/tex/context/base/strc-blk.mkiv b/tex/context/base/strc-blk.mkiv
index 1dd144aa9..bceb66beb 100644
--- a/tex/context/base/strc-blk.mkiv
+++ b/tex/context/base/strc-blk.mkiv
@@ -41,7 +41,8 @@
\unexpanded\def\strc_blocks_begin[#1][#2]%
{\normalexpanded{\buff_pickup{@block@}{\e!begin#1}{\e!end#1}}
{}% before
- {\ctxcommand{savestructureblock("#1","#2","@block@")}}}% after
+ {\ctxcommand{savestructureblock("#1","#2","@block@")}}%
+ \plusone}% after
\let\strc_blocks_setup\relax
diff --git a/tex/context/base/tabl-tbl.mkiv b/tex/context/base/tabl-tbl.mkiv
index 1aeaa2e56..d4d22af97 100644
--- a/tex/context/base/tabl-tbl.mkiv
+++ b/tex/context/base/tabl-tbl.mkiv
@@ -2067,9 +2067,9 @@
\donetrue
\fi\fi
\ifdone
- \c_tabl_tabulate_repeathead\executeifdefined{\??tabulateheader\tabulationparameter\c!header}\zerocount
+ \global\c_tabl_tabulate_repeathead\executeifdefined{\??tabulateheader\tabulationparameter\c!header}\zerocount
\else
- \c_tabl_tabulate_repeathead\zerocount
+ \global\c_tabl_tabulate_repeathead\zerocount
\fi
%
\the\t_tabl_tabulate_initializers_first % collect more here
diff --git a/tex/context/base/tabl-xnt.mkvi b/tex/context/base/tabl-xnt.mkvi
index ffa1f501e..fd2de5a13 100644
--- a/tex/context/base/tabl-xnt.mkvi
+++ b/tex/context/base/tabl-xnt.mkvi
@@ -130,6 +130,6 @@
{\bgroup
\tabl_x_prepare{#settings}%
\edef\tabl_x_current_buffer{\tabl_x_default_buffer}%
- \buff_pickup\tabl_x_current_buffer{bTABLE}{eTABLE}\relax\tabl_x_process}
+ \buff_pickup\tabl_x_current_buffer{bTABLE}{eTABLE}\relax\tabl_x_process\zerocount}
\protect \endinput
diff --git a/tex/context/base/tabl-xtb.lua b/tex/context/base/tabl-xtb.lua
index d9daefe69..5728b80e9 100644
--- a/tex/context/base/tabl-xtb.lua
+++ b/tex/context/base/tabl-xtb.lua
@@ -66,6 +66,7 @@ local setfield = nuts.setfield
local copy_node_list = nuts.copy_list
local hpack_node_list = nuts.hpack
local flush_node_list = nuts.flush_list
+local takebox = nuts.takebox
local nodepool = nuts.pool
@@ -81,6 +82,7 @@ local v_height = variables.height
local v_repeat = variables["repeat"]
local v_max = variables.max
local v_fixed = variables.fixed
+local v_auto = variables.auto
local xtables = { }
typesetters.xtables = xtables
@@ -257,13 +259,26 @@ function xtables.set_reflow_width()
elseif dimensionstate == 3 then
fixedrows[r] = height -- width
fixedcolumns[c] = width -- height
- else -- probably something frozen, like an image -- we could parse the list
+ elseif data.options[v_auto] then -- new per 5/5/2014
+ data.autowidths[c] = true
+ else
+ -- no dimensions are set in the cell
if width <= data.criterium_h and height >= data.criterium_v then
+ -- somewhat tricky branch
if width > fixedcolumns[c] then -- how about a span here?
- fixedcolumns[c] = width
+ -- maybe an image, so let's fix
+ fixedcolumns[c] = width
+ end
+ else
+ -- safeguard as it could be text that can be recalculated
+ -- and the previous branch could have happened in a previous
+ -- row and then forces a wrong one-liner in a multiliner
+ if width > fixedcolumns[c] then
+ data.autowidths[c] = true -- new per 5/5/2014
end
end
end
+ --
drc.dimensionstate = dimensionstate
--
local nx, ny = drc.nx, drc.ny
@@ -309,6 +324,7 @@ function xtables.initialize_reflow_height()
end
texsetdimen("d_tabl_x_width",w)
local dimensionstate = drc.dimensionstate or 0
+-- print(r,c,w,data.autowidths[c])
if dimensionstate == 1 or dimensionstate == 3 then
-- width was fixed so height is known
texsetcount("c_tabl_x_skip_mode",1)
@@ -385,7 +401,8 @@ function xtables.set_construct()
-- end
local drc = row[c]
-- this will change as soon as in luatex we can reset a box list without freeing
- drc.list = copy_node_list(getbox("b_tabl_x"))
+-- drc.list = copy_node_list(getbox("b_tabl_x"))
+drc.list = takebox("b_tabl_x")
-- c = c + drc.nx - 1
-- data.currentcolumn = c
end
@@ -395,7 +412,7 @@ local function showwidths(where,widths,autowidths)
for i=1,#widths do
result[#result+1] = format("%12s%s",points(widths[i]),autowidths[i] and "*" or " ")
end
- return report_xtable("%s : %s",where,concat(result," "))
+ return report_xtable("%s widths: %s",where,concat(result," "))
end
function xtables.reflow_width()
diff --git a/tex/context/base/tabl-xtb.mkvi b/tex/context/base/tabl-xtb.mkvi
index cca56dbee..06fb472cd 100644
--- a/tex/context/base/tabl-xtb.mkvi
+++ b/tex/context/base/tabl-xtb.mkvi
@@ -159,7 +159,7 @@
{\bgroup
\tabl_x_prepare{#settings}%
\edef\tabl_x_current_buffer{\tabl_x_default_buffer}%
- \buff_pickup{\tabl_x_current_buffer}{startxtable}{stopxtable}\relax\tabl_x_process}
+ \buff_pickup{\tabl_x_current_buffer}{startxtable}{stopxtable}\relax\tabl_x_process\zerocount}
\unexpanded\def\processxtablebuffer
{\dosingleempty\tabl_x_process_buffer_directly}
@@ -175,7 +175,7 @@
{\bgroup
\let\tabl_x_start_table\tabl_x_process_buffer
\edef\tabl_x_current_buffer{#name}%
- \tabl_x_get_buffer % pickup settings
+ \tabl_x_get_buffer % settings
\tabl_x_process}
\unexpanded\def\tabl_x_start_ignore[#settings]%
@@ -223,7 +223,7 @@
\tabl_x_check_textwidth
\forgetall
\edef\tabl_x_current_buffer{\tabl_x_default_buffer}%
- \normalexpanded{\buff_pickup{\tabl_x_current_buffer}{\e!start\currentxtable}{\e!stop\currentxtable}\relax\tabl_x_process}}
+ \normalexpanded{\buff_pickup{\tabl_x_current_buffer}{\e!start\currentxtable}{\e!stop\currentxtable}\relax\tabl_x_process\zerocount}}
\unexpanded\def\tabl_x_stop_named
{}
@@ -569,7 +569,7 @@
{\dostarttagged\t!tablecell\empty % can't we just tag the box
\setbox\b_tabl_x\hbox\bgroup
\letxtableparameter\c!width \d_tabl_x_width % overloads given width
- \letxtableparameter\c!height\d_tabl_x_height % overloads given height
+ \letxtableparameter\c!height\d_tabl_x_height % overloads given height (commenting it ... nice option)
\ctxcommand{x_table_init_construct()}%
\inheritedxtableframed\bgroup
\tabl_x_begin_of_cell
diff --git a/tex/context/base/util-sci.lua b/tex/context/base/util-sci.lua
index 98b05fe75..c3e24cd9d 100644
--- a/tex/context/base/util-sci.lua
+++ b/tex/context/base/util-sci.lua
@@ -54,7 +54,7 @@ local f_fore_none = formatters['.%s { display: inline ; font-weight: normal ; c
local f_none_bold = formatters['.%s { display: inline ; font-weight: bold ; }']
local f_none_none = formatters['.%s { display: inline ; font-weight: normal ; }']
local f_div_class = formatters['<div class="%s">%s</div>']
-local f_linenumber = formatters['\n<div class="linenumber">%s</div>']
+local f_linenumber = formatters['<div class="linenumber">%s</div>\n']
local f_div_number = formatters['.linenumber { display: inline-block ; font-weight: normal ; width: %sem ; margin-right: 2em ; padding-right: .25em ; text-align: right ; background-color: #C7C7C7 ; }']
local replacer_regular = lpeg.replacer {
@@ -63,13 +63,18 @@ local replacer_regular = lpeg.replacer {
["&"] = "&amp;",
}
-local linenumber = 0
+local linenumber = 0
+local linenumbers = { }
local replacer_numbered = lpeg.replacer {
["<"] = "&lt;",
[">"] = "&gt;",
["&"] = "&amp;",
- [lpeg.patterns.newline] = function() linenumber = linenumber + 1 return f_linenumber(linenumber) end,
+ [lpeg.patterns.newline] = function()
+ linenumber = linenumber + 1
+ linenumbers[linenumber] = f_linenumber(linenumber)
+ return "\n"
+ end,
}
local css = nil
@@ -114,24 +119,19 @@ end
local function exportstyled(lexer,text,numbered)
local result = lexer.lex(lexer,text,0)
- local start = 1
+ local start = 1
local whites = exportwhites()
- local buffer, b = { "<pre>" }, 1
- linenumber = 1
+ local buffer = { }
+ local b = 0
+ linenumber = 0
+ linenumbers = { }
local replacer = numbered and replacer_numbered or replacer_regular
- if numbered then
- b = b + 1
- buffer[b] = f_linenumber(1)
- end
local n = #result
for i=1,n,2 do
local ii = i + 1
local style = result[i]
local position = result[ii]
local txt = sub(text,start,position-1)
- if ii == n then
- txt = gsub(txt,"[%s]+$","")
- end
txt = lpegmatch(replacer,txt)
b = b + 1
if whites[style] then
@@ -141,9 +141,8 @@ local function exportstyled(lexer,text,numbered)
end
start = position
end
- buffer[b+1] = "</pre>"
buffer = concat(buffer)
- return buffer
+ return buffer, concat(linenumbers)
end
local function exportcsslinenumber()
@@ -154,28 +153,44 @@ local htmlfile = utilities.templates.replacer([[
<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
- <title>context util-sci web page: text</title>
+ <title>%title%</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<style type="text/css"><!--
%lexingstyles%
%numberstyles%
--></style>
<body>
-%lexedcontent%
+ <table style="padding:0; margin:0;">
+ <tr>
+ <td><pre>%linenumbers%</pre></td>
+ <td><pre>%lexedcontent%</pre></td>
+ </tr>
+ </table>
</body>
</html>
]])
-function scite.tohtml(data,lexname,numbered)
+function scite.tohtml(data,lexname,numbered,title)
+ local source, lines = exportstyled(loadedlexers[lexname],data or "",numbered)
return htmlfile {
- lexedcontent = exportstyled(loadedlexers[lexname],data or "",numbered), -- before numberstyles
+ lexedcontent = source, -- before numberstyles
lexingstyles = exportcsslexing(),
numberstyles = exportcsslinenumber(),
+ title = title or "context source file",
+ linenumbers = lines,
}
end
-function scite.filetohtml(filename,lexname,targetname,numbered)
- io.savedata(targetname or "util-sci.html",scite.tohtml(io.loaddata(filename),lexname or file.suffix(filename),numbered))
+local function maketargetname(name)
+ if name then
+ return file.removesuffix(name) .. "-" .. file.suffix(name) .. ".html"
+ else
+ return "util-sci.html"
+ end
+end
+
+function scite.filetohtml(filename,lexname,targetname,numbered,title)
+ io.savedata(targetname or "util-sci.html",scite.tohtml(io.loaddata(filename),lexname or file.suffix(filename),numbered,title or filename))
end
function scite.css()
@@ -192,7 +207,7 @@ local htmlfile = utilities.templates.replacer([[
<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
- <title>context util-sci web page: text</title>
+ <title>%title%</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<style type="text/css"><!--
%styles%
@@ -211,20 +226,22 @@ function scite.converttree(sourceroot,targetroot,numbered)
local skipped = { }
local noffiles = 0
dir.makedirs(targetroot)
- local function scan(sourceroot,targetroot)
+ local function scan(sourceroot,targetroot,subpath)
local tree = { }
for name in lfs.dir(sourceroot) do
if name ~= "." and name ~= ".." then
local sourcename = file.join(sourceroot,name)
local targetname = file.join(targetroot,name)
local mode = lfs.attributes(sourcename,'mode')
+ local path = subpath and file.join(subpath,name) or name
if mode == 'file' then
- local filetype = file.suffix(sourcename)
- local basename = file.basename(name)
- local targetname = file.replacesuffix(targetname,"html")
+ local filetype = file.suffix(sourcename)
+ local basename = file.basename(name)
+ local targetname = maketargetname(targetname)
+ local fullname = file.join(path,name)
if knownlexers[filetype] then
report("converting file %a to %a",sourcename,targetname)
- scite.filetohtml(sourcename,nil,targetname,numbered)
+ scite.filetohtml(sourcename,nil,targetname,numbered,fullname)
noffiles = noffiles + 1
tree[#tree+1] = f_tree_entry(file.basename(targetname),basename)
else
@@ -233,15 +250,16 @@ function scite.converttree(sourceroot,targetroot,numbered)
end
else
dir.makedirs(targetname)
- scan(sourcename,targetname)
+ scan(sourcename,targetname,path)
tree[#tree+1] = f_tree_entry(file.join(name,"files.html"),name)
end
end
end
- report("saving tree in %a",treename)
+ report("saving tree in %a",targetroot)
local htmldata = htmlfile {
dirlist = concat(tree,"\n"),
- styles = "",
+ styles = "",
+ title = path or "context dir listing",
}
io.savedata(file.join(targetroot,"files.html"),htmldata)
end
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index dd9868626..60083ae2f 100644
--- a/tex/generic/context/luatex/luatex-fonts-merged.lua
+++ b/tex/generic/context/luatex/luatex-fonts-merged.lua
@@ -1,6 +1,6 @@
-- merged file : luatex-fonts-merged.lua
-- parent file : luatex-fonts.lua
--- merge date : 04/28/14 23:24:10
+-- merge date : 05/05/14 22:31:19
do -- begin closure to overcome local limits and interference