summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--scripts/context/ruby/base/tex.rb8
-rw-r--r--scripts/context/ruby/base/texutil.rb2
-rw-r--r--tex/context/base/cont-new.tex2
-rw-r--r--tex/context/base/context.tex2
-rw-r--r--tex/context/base/font-dum.lua2
-rw-r--r--tex/context/base/node-ref.lua61
-rw-r--r--tex/context/base/strc-ref.mkiv27
-rw-r--r--tex/context/base/syst-aux.mkiv19
-rw-r--r--tex/context/base/syst-ext.mkii17
-rw-r--r--tex/generic/context/luatex-fonts-merged.lua4
10 files changed, 127 insertions, 17 deletions
diff --git a/scripts/context/ruby/base/tex.rb b/scripts/context/ruby/base/tex.rb
index 4a60ad4c1..23db7f1e8 100644
--- a/scripts/context/ruby/base/tex.rb
+++ b/scripts/context/ruby/base/tex.rb
@@ -894,7 +894,7 @@ class TEX
def scantexpreamble(filename)
begin
- if FileTest.file?(filename) and tex = File.open(filename) then
+ if FileTest.file?(filename) and tex = File.open(filename,'rb') then
bomdone = false
while str = tex.gets and str.chomp! do
unless bomdone then
@@ -940,7 +940,7 @@ end
end
def scantexcontent(filename)
- if FileTest.file?(filename) and tex = File.open(filename) then
+ if FileTest.file?(filename) and tex = File.open(filename,'rb') then
while str = tex.gets do
case str.chomp
when /^\%/o then
@@ -1075,7 +1075,7 @@ end
end
def checkxmlfile(rawname)
- if FileTest.file?(rawname) && (xml = File.open(rawname)) then
+ if FileTest.file?(rawname) && (xml = File.open(rawname,'rb')) then
xml.each do |line|
case line
when /<\?context\-directive\s+(\S+)\s+(\S+)\s+(\S+)\s*(.*?)\s*\?>/o then
@@ -2011,7 +2011,7 @@ end
end
if true then # autopurge
begin
- File.open(File.suffixed(rawbase, 'tuo')) do |f|
+ File.open(File.suffixed(rawbase, 'tuo'),'rb') do |f|
ok = 0
f.each do |line|
case ok
diff --git a/scripts/context/ruby/base/texutil.rb b/scripts/context/ruby/base/texutil.rb
index 3775469ed..868e3ca16 100644
--- a/scripts/context/ruby/base/texutil.rb
+++ b/scripts/context/ruby/base/texutil.rb
@@ -1028,7 +1028,7 @@ class TeXUtil
tuifile = File.suffixed(filename,'tui')
if FileTest.file?(tuifile) then
report("parsing file #{tuifile}")
- if f = open(tuifile) then
+ if f = File.open(tuifile,'rb') then
f.each do |line|
case line.chomp
when /^f (.*)$/o then @plugins.reader('MyFiles', $1.splitdata)
diff --git a/tex/context/base/cont-new.tex b/tex/context/base/cont-new.tex
index 4ba8f7755..590015260 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.08.09 22:57}
+\newcontextversion{2009.08.10 15:04}
%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 73106ae70..8c85fadfd 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.08.09 22:57}
+\edef\contextversion{2009.08.10 15:04}
%D For those who want to use this:
diff --git a/tex/context/base/font-dum.lua b/tex/context/base/font-dum.lua
index 401d2a343..ef267a42c 100644
--- a/tex/context/base/font-dum.lua
+++ b/tex/context/base/font-dum.lua
@@ -60,7 +60,7 @@ function fonts.names.resolve(name,sub)
local d = { }
for k, v in pairs(data.mapping) do
local t = v[1]
- if t == "ttf" or t == "otf" or t == "ttc" or t = "dfont" then
+ if t == "ttf" or t == "otf" or t == "ttc" or t == "dfont" then
d[k] = v
end
end
diff --git a/tex/context/base/node-ref.lua b/tex/context/base/node-ref.lua
index 36f6928fd..873302d6b 100644
--- a/tex/context/base/node-ref.lua
+++ b/tex/context/base/node-ref.lua
@@ -162,6 +162,8 @@ local function inject_list(id,current,reference,make,stack,pardir,txtdir)
end
end
+-- skip is somewhat messy
+
local function inject_areas(head,attribute,make,stack,done,skip,parent,pardir,txtdir) -- main
if head then
local current, first, last, firstdir, reference = head, nil, nil, nil, nil
@@ -182,11 +184,13 @@ local function inject_areas(head,attribute,make,stack,done,skip,parent,pardir,tx
inject_list(id,current,r,make,stack,pardir,txtdir)
done[r] = true
end
+--~ if r then done[r] = (done[r] or 0) + 1 end
local list = current.list
if list then
local _
current.list, _, pardir, txtdir = inject_areas(list,attribute,make,stack,done,r or skip or 0,current,pardir,txtdir)
end
+--~ if r then done[r] = done[r] - 1 end
elseif not r then
-- just go on, can be kerns
elseif not reference then
@@ -194,6 +198,7 @@ local function inject_areas(head,attribute,make,stack,done,skip,parent,pardir,tx
elseif r == reference then
last = current
elseif not done[reference] then
+--~ elseif (done[reference] or 0) == 0 then
if not skip or r > skip then
head, current = inject_range(head,first,last,reference,make,stack,parent,pardir,firstdir)
reference, first, last, firstdir = nil, nil, nil, nil
@@ -204,12 +209,68 @@ local function inject_areas(head,attribute,make,stack,done,skip,parent,pardir,tx
current = current.next
end
if reference and not done[reference] then
+--~ if reference and (done[reference] or 0) == 0 then
head = inject_range(head,first,last,reference,make,stack,parent,pardir,firstdir)
end
end
return head, true, pardir, txtdir
end
+local function inject_areas(head,attribute,make,stack,done,skip,parent,pardir,txtdir) -- main
+ if head then
+ local current, first, last, firstdir, reference = head, nil, nil, nil, nil
+ pardir = pardir or "==="
+ txtdir = txtdir or "==="
+ while current do
+ local id = current.id
+ local r = has_attribute(current,attribute)
+ if id == whatsit then
+ local subtype = current.subtype
+ if subtype == 6 then
+ pardir = current.dir
+ elseif subtype == 7 then
+ txtdir = current.dir
+ end
+ elseif id == hlist or id == vlist then
+--~ if r and (not skip or r > skip) then
+ if not reference and r and (not skip or r > skip) then
+ inject_list(id,current,r,make,stack,pardir,txtdir)
+--~ done[r] = true
+ end
+if r then done[r] = (done[r] or 0) + 1 end
+ local list = current.list
+ if list then
+ local _
+ current.list, _, pardir, txtdir = inject_areas(list,attribute,make,stack,done,r or skip or 0,current,pardir,txtdir)
+ end
+if r then done[r] = done[r] - 1 end
+ elseif not r then
+ -- just go on, can be kerns
+ elseif not reference then
+ reference, first, last, firstdir = r, current, current, txtdir
+ elseif r == reference then
+ last = current
+--~ elseif not done[reference] then
+elseif (done[reference] or 0) == 0 then
+ if not skip or r > skip then
+ head, current = inject_range(head,first,last,reference,make,stack,parent,pardir,firstdir)
+ reference, first, last, firstdir = nil, nil, nil, nil
+ end
+ else
+ reference, first, last, firstdir = r, current, current, txtdir
+ end
+ current = current.next
+ end
+--~ if reference and not done[reference] then
+ if reference and (done[reference] or 0) == 0 then
+ head = inject_range(head,first,last,reference,make,stack,parent,pardir,firstdir)
+ end
+ end
+ return head, true, pardir, txtdir
+end
+
+
+
local function inject_area(head,attribute,make,stack,done,pardir,txtdir) -- singular !
if head then
pardir = pardir or "==="
diff --git a/tex/context/base/strc-ref.mkiv b/tex/context/base/strc-ref.mkiv
index e010b0ad3..5225fc17b 100644
--- a/tex/context/base/strc-ref.mkiv
+++ b/tex/context/base/strc-ref.mkiv
@@ -985,6 +985,11 @@
\unexpanded\def\directgoto {\ifconditional\uselocationstrut\expandafter\dodirectgoto\else\expandafter\directgotohtdp\fi}
\unexpanded\def\goto {\ifconditional\uselocationstrut\expandafter\dogoto \else\expandafter\gotohtdp \fi}
+% The unbox trick is needed in order to permit \par inside a reference. Otherwise
+% the reference attribute migrates to the outer boxes.
+
+\newbox\referencebox
+
\def\dodirectgoto#1[#2]% no test for valid references
{\dontleavehmode
\begingroup
@@ -1013,6 +1018,7 @@
\def\dogoto#1#2[#3]% #2 gobbles spaces after #1 so that \goto{xx} [yy] works ok
{\dontleavehmode
\begingroup
+ %\setbox\referencebox\hbox\bgroup % experiment, might change again to non \par support
\attribute\referenceattribute\attributeunsetvalue
\iflocation
\ctxlua{jobreferences.doifelse("\referenceprefix","#3",\extrareferencearguments)}%
@@ -1024,6 +1030,7 @@
{\unknownreference{#3}}%
\fi
#1%
+ %\egroup\unhbox\referencebox}
\endgroup}
\def\dogotohtdp#1#2[#3]% #2 gobbles spaces after #1 so that \goto{xx} [yy] works ok
@@ -1666,3 +1673,23 @@
%D We cannot set up buttons (not yet, this one calls a menu macro):
\protect \endinput
+
+% tricky:
+%
+% \enabletrackers[nodes.references]
+% \setupinteraction[state=start]
+% \def\KnuthTest{\input knuth }
+% \def\KnuthTest{\input tufte }
+% \def\TufteTest{\input tufte }
+% \defineoverlay[xxx][\overlaybutton{page(3)}]
+% \setupbackgrounds[text][background=xxx]
+% \starttext
+% test {\red \KnuthTest} test \par
+% \button{test}[page(1)] \par
+% \goto{page 2 \TeX}[page(2)] \goto{page 2 \TeX}[page(2)] \goto{\TufteTest}[page(2)] test \page
+% test \goto{page 3}[page(3)] \goto{\TufteTest\space\par\TufteTest}[page(4)] test \page
+% \goto{page 1}[page(1)] \goto{\TufteTest\space test}[page(1)] \page
+% \goto{page 1}[page(1)] \goto{\KnuthTest\space test}[page(1)] \page
+% test \goto{page 1}[page(1)] {\goto{\KnuthTest\space test}[page(1)]} test
+% \goto{page 1}[page(1)] \goto{\TufteTest}[page(1)] test \page
+% \stoptext
diff --git a/tex/context/base/syst-aux.mkiv b/tex/context/base/syst-aux.mkiv
index 9a32ce58a..d650e4513 100644
--- a/tex/context/base/syst-aux.mkiv
+++ b/tex/context/base/syst-aux.mkiv
@@ -2895,7 +2895,7 @@
%D \bagger [a] {b}
%D \stoptyping
-% \starttexdefinition test {}
+% \starttexdefinition test
% oeps
% \stoptexdefinition
%
@@ -2908,14 +2908,25 @@
\obeylines%
\dostarttexdefinition}
-\gdef\dostarttexdefinition #1 #2
+\gdef\dostarttexdefinition #1
{\catcode13=\@@ignore%
- \dodostarttexdefinition{#1}{#2}}%
+ \doifinstringelse\letterhash{\detokenize{#1}}\dodostarttexdefinition\nonostarttexdefinition#1
+ }
-\long\gdef\dodostarttexdefinition#1#2#3\stoptexdefinition%
+\long\gdef\dodostarttexdefinition#1 #2
+ {\dododostarttexdefinition{#1}{#2}}
+
+\long\gdef\dododostarttexdefinition#1#2#3\stoptexdefinition%
{\egroup%
\long\setvalue{#1}#2{#3}}
+\long\gdef\nonostarttexdefinition#1
+ {\nononostarttexdefinition{#1}{}}
+
+\long\gdef\nononostarttexdefinition#1#2#3\stoptexdefinition%
+ {\egroup%
+ \long\setvalue{#1}{#3}}
+
\egroup
%D \macros
diff --git a/tex/context/base/syst-ext.mkii b/tex/context/base/syst-ext.mkii
index 3eb91cb5d..898ee8000 100644
--- a/tex/context/base/syst-ext.mkii
+++ b/tex/context/base/syst-ext.mkii
@@ -160,14 +160,25 @@
\obeylines%
\dostarttexdefinition}
-\gdef\dostarttexdefinition #1 #2
+\gdef\dostarttexdefinition #1
{\catcode13=\@@ignore%
- \dodostarttexdefinition{#1}{#2}}%
+ \doifinstringelse\letterhash{\detokenize{#1}}\dodostarttexdefinition\nonostarttexdefinition#1
+ }
-\long\gdef\dodostarttexdefinition#1#2#3\stoptexdefinition%
+\long\gdef\dodostarttexdefinition#1 #2
+ {\dododostarttexdefinition{#1}{#2}}
+
+\long\gdef\dododostarttexdefinition#1#2#3\stoptexdefinition%
{\egroup%
\long\setvalue{#1}#2{#3}}
+\long\gdef\nonostarttexdefinition#1
+ {\nononostarttexdefinition{#1}{}}
+
+\long\gdef\nononostarttexdefinition#1#2#3\stoptexdefinition%
+ {\egroup%
+ \long\setvalue{#1}{#3}}
+
\egroup
%D \macros
diff --git a/tex/generic/context/luatex-fonts-merged.lua b/tex/generic/context/luatex-fonts-merged.lua
index 1dc84f257..7ad313dab 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 : 08/09/09 22:59:38
+-- merge date : 08/10/09 15:06:32
do -- begin closure to overcome local limits and interference
@@ -11181,7 +11181,7 @@ function fonts.names.resolve(name,sub)
local d = { }
for k, v in pairs(data.mapping) do
local t = v[1]
- if t == "ttf" or t == "otf" or t == "ttc" or t = "dfont" then
+ if t == "ttf" or t == "otf" or t == "ttc" or t == "dfont" then
d[k] = v
end
end