summaryrefslogtreecommitdiff
path: root/tex
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2014-09-03 17:37:00 +0200
committerHans Hagen <pragma@wxs.nl>2014-09-03 17:37:00 +0200
commit19f0402bf96ee3aa359cd7361d2683b5ce05fdeb (patch)
treed5db57a51789365bbdc69815df5015b4891f9efb /tex
parent54b35840ce8f91454174a2d63042d776222a378b (diff)
downloadcontext-19f0402bf96ee3aa359cd7361d2683b5ce05fdeb.tar.gz
beta 2014.09.03 17:37
Diffstat (limited to 'tex')
-rw-r--r--tex/context/base/back-pdf.lua8
-rw-r--r--tex/context/base/cont-new.mkiv2
-rw-r--r--tex/context/base/context-version.pdfbin4433 -> 4432 bytes
-rw-r--r--tex/context/base/context.mkiv2
-rw-r--r--tex/context/base/data-res.lua3
-rw-r--r--tex/context/base/grph-inc.lua47
-rw-r--r--tex/context/base/grph-inc.mkiv2
-rw-r--r--tex/context/base/l-url.lua65
-rw-r--r--tex/context/base/page-imp.mkiv6
-rw-r--r--tex/context/base/page-lin.mkvi3
-rw-r--r--tex/context/base/status-files.pdfbin24983 -> 24991 bytes
-rw-r--r--tex/context/base/status-lua.pdfbin327145 -> 327147 bytes
-rw-r--r--tex/context/base/strc-ref.mkvi25
-rw-r--r--tex/context/base/strc-rsc.lua32
-rw-r--r--tex/context/base/util-str.lua3
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua4
16 files changed, 151 insertions, 51 deletions
diff --git a/tex/context/base/back-pdf.lua b/tex/context/base/back-pdf.lua
index ce42c9124..f7f995f39 100644
--- a/tex/context/base/back-pdf.lua
+++ b/tex/context/base/back-pdf.lua
@@ -52,7 +52,7 @@ function commands.pdfstartrotation(a)
local s, c = sind(a), cosd(a)
context(pdfsave())
context(pdfsetmatrix(c,s,-s,c))
- insert(stack,restore and { c, -s, s, c } or false)
+ insert(stack,restore and { c, -s, s, c } or true)
end
end
@@ -68,7 +68,7 @@ function commands.pdfstartscaling(sx,sy)
end
context(pdfsave())
context(pdfsetmatrix(sx,0,0,sy))
- insert(stack,restore and { 1/sx, 0, 0, 1/sy } or false)
+ insert(stack,restore and { 1/sx, 0, 0, 1/sy } or true)
end
end
@@ -78,13 +78,15 @@ function commands.pdfstartmatrix(sx,rx,ry,sy) -- tx, ty
else
context(pdfsave())
context(pdfsetmatrix(sx,rx,ry,sy))
- insert(stack,store and { -sx, -rx, -ry, -sy } or false)
+ insert(stack,store and { -sx, -rx, -ry, -sy } or true)
end
end
local function pdfstopsomething()
local top = remove(stack)
if top == false then
+ -- not wrapped
+ elseif top == true then
context(pdfrestore())
elseif top then
context(pdfsetmatrix(unpack(top)))
diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv
index dd04289e9..189bbf25f 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.08.29 20:57}
+\newcontextversion{2014.09.03 17:37}
%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 54792ec8f..0d9a5e990 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 8ff3a4b55..e7915b7d8 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.08.29 20:57}
+\edef\contextversion{2014.09.03 17:37}
\edef\contextkind {beta}
%D For those who want to use this:
diff --git a/tex/context/base/data-res.lua b/tex/context/base/data-res.lua
index b3ec90898..3dd16c23b 100644
--- a/tex/context/base/data-res.lua
+++ b/tex/context/base/data-res.lua
@@ -1368,6 +1368,9 @@ end
-- always analyze .. todo: use url split
collect_instance_files = function(filename,askedformat,allresults) -- uses nested
+ if not filename or filename == "" then
+ return { }
+ end
askedformat = askedformat or ""
filename = collapsepath(filename,".")
diff --git a/tex/context/base/grph-inc.lua b/tex/context/base/grph-inc.lua
index d42d8b225..7fa80aa6e 100644
--- a/tex/context/base/grph-inc.lua
+++ b/tex/context/base/grph-inc.lua
@@ -47,7 +47,7 @@ local formatters = string.formatters
local longtostring = string.longtostring
local expandfilename = dir.expandname
-local P, R, S, Cc, lpegmatch = lpeg.P, lpeg.R, lpeg.S, lpeg.Cc, lpeg.match
+local P, R, S, Cc, C, Cs, Ct, lpegmatch = lpeg.P, lpeg.R, lpeg.S, lpeg.Cc, lpeg.C, lpeg.Cs, lpeg.Ct, lpeg.match
local settings_to_array = utilities.parsers.settings_to_array
local settings_to_hash = utilities.parsers.settings_to_hash
@@ -754,7 +754,7 @@ local internalschemes = {
local function locate(request) -- name, format, cache
-- not resolvers.cleanpath(request.name) as it fails on a!b.pdf and b~c.pdf
-- todo: more restricted cleanpath
- local askedname = request.name
+ local askedname = request.name or ""
local askedhash = f_hash_part(askedname,request.conversion or "default",request.resolution or "default")
local foundname = figures_found[askedhash]
if foundname then
@@ -1429,14 +1429,53 @@ local epstopdf = {
programs.epstopdf = epstopdf
programs.gs = epstopdf
+local cleanups = { }
+local cleaners = { }
+
+local whitespace = lpeg.patterns.whitespace
+local quadruple = Ct((whitespace^0 * lpeg.patterns.number/tonumber * whitespace^0)^4)
+local betterbox = P("%%BoundingBox:") * quadruple
+ * P("%%HiResBoundingBox:") * quadruple
+ * P("%AI3_Cropmarks:") * quadruple
+ * P("%%CropBox:") * quadruple
+ / function(b,h,m,c)
+ return formatters["%%%%BoundingBox: %i %i %i %i\n%%%%HighResBoundingBox: %F %F %F %F\n%%%%CropBox: %F %F %F %F\n"](
+ m[1],m[2],m[3],m[4],
+ m[1],m[2],m[3],m[4],
+ m[1],m[2],m[3],m[4]
+ )
+ end
+local nocrap = P("%") / "" * (
+ (P("AI9_PrivateDataBegin") * P(1)^0) / "%%%%EOF"
+ + (P("%EOF") * whitespace^0 * P("%AI9_PrintingDataEnd") * P(1)^0) / "%%%%EOF"
+ + (P("AI7_Thumbnail") * (1-P("%%EndData"))^0 * P("%%EndData")) / ""
+ )
+local whatever = nocrap + P(1)
+local pattern = Cs((betterbox * whatever^1 + whatever)^1)
+
+directives.register("graphics.conversion.eps.cleanup.ai",function(v) cleanups.ai = v end)
+
+cleaners.ai = function(name)
+ local tmpname = name .. ".tmp"
+ io.savedata(tmpname,lpegmatch(pattern,io.loaddata(name)))
+ return tmpname
+end
+
function epsconverter.pdf(oldname,newname,resolution) -- the resolution interface might change
local epstopdf = programs.epstopdf -- can be changed
- local presets = epstopdf.resolutions[resolution or ""] or epstopdf.resolutions.high
+ local presets = epstopdf.resolutions[resolution or "high"] or epstopdf.resolutions.high
+ local tmpname = oldname
+ if cleanups.ai then
+ tmpname = cleaners.ai(oldname)
+ end
runprogram(epstopdf.command, epstopdf.argument, {
newname = newname,
- oldname = oldname,
+ oldname = tmpname,
presets = presets,
} )
+ if tmpname ~= oldname then
+ os.remove(tmpname)
+ end
end
epsconverter.default = epsconverter.pdf
diff --git a/tex/context/base/grph-inc.mkiv b/tex/context/base/grph-inc.mkiv
index fd6004427..9774320d6 100644
--- a/tex/context/base/grph-inc.mkiv
+++ b/tex/context/base/grph-inc.mkiv
@@ -11,6 +11,8 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
+% \enabledirectives[graphics.conversion.eps.cleanup.ai]
+
% todo: messages
\writestatus{loading}{ConTeXt Graphic Macros / Figure Inclusion}
diff --git a/tex/context/base/l-url.lua b/tex/context/base/l-url.lua
index 7bb731254..8e96b4525 100644
--- a/tex/context/base/l-url.lua
+++ b/tex/context/base/l-url.lua
@@ -145,19 +145,25 @@ local splitquery = Cf ( Ct("") * P { "sequence",
-- hasher
local function hashed(str) -- not yet ok (/test?test)
- if str == "" then
+ if not str or str == "" then
return {
scheme = "invalid",
original = str,
}
end
- local s = split(str)
- local rawscheme = s[1]
- local rawquery = s[4]
- local somescheme = rawscheme ~= ""
- local somequery = rawquery ~= ""
+ local detailed = split(str)
+ local rawscheme = ""
+ local rawquery = ""
+ local somescheme = false
+ local somequery = false
+ if detailed then
+ rawscheme = detailed[1]
+ rawquery = detailed[4]
+ somescheme = rawscheme ~= ""
+ somequery = rawquery ~= ""
+ end
if not somescheme and not somequery then
- s = {
+ return {
scheme = "file",
authority = "",
path = str,
@@ -167,30 +173,33 @@ local function hashed(str) -- not yet ok (/test?test)
noscheme = true,
filename = str,
}
- else -- not always a filename but handy anyway
- local authority, path, filename = s[2], s[3]
- if authority == "" then
- filename = path
- elseif path == "" then
- filename = ""
- else
- filename = authority .. "/" .. path
- end
- s = {
- scheme = rawscheme,
- authority = authority,
- path = path,
- query = lpegmatch(unescaper,rawquery), -- unescaped, but possible conflict with & and =
- queries = lpegmatch(splitquery,rawquery), -- split first and then unescaped
- fragment = s[5],
- original = str,
- noscheme = false,
- filename = filename,
- }
end
- return s
+ -- not always a filename but handy anyway
+ local authority = detailed[2]
+ local path = detailed[3]
+ local filename = nil
+ if authority == "" then
+ filename = path
+ elseif path == "" then
+ filename = ""
+ else
+ filename = authority .. "/" .. path
+ end
+ return {
+ scheme = rawscheme,
+ authority = authority,
+ path = path,
+ query = lpegmatch(unescaper,rawquery), -- unescaped, but possible conflict with & and =
+ queries = lpegmatch(splitquery,rawquery), -- split first and then unescaped
+ fragment = detailed[5],
+ original = str,
+ noscheme = false,
+ filename = filename,
+ }
end
+-- inspect(hashed())
+-- inspect(hashed(""))
-- inspect(hashed("template:///test"))
-- inspect(hashed("template:///test++.whatever"))
-- inspect(hashed("template:///test%2B%2B.whatever"))
diff --git a/tex/context/base/page-imp.mkiv b/tex/context/base/page-imp.mkiv
index 230ede570..e3668a6cd 100644
--- a/tex/context/base/page-imp.mkiv
+++ b/tex/context/base/page-imp.mkiv
@@ -355,7 +355,7 @@
{\dosetuparrangement{2}{2}{4}{3}{3}%
\pusharrangedpageSIXTEENTWO\poparrangedpagesAtoD\relax}
-\installpagearrangement 2*2*4 % onother one of Willy Egger
+\installpagearrangement 2*2*4 % another one of Willy Egger
{\dosetuparrangement{2}{1}{8}{3}{2}%
\pusharrangedpageSIXTEENFOUR\poparrangedpagesAtoH\relax}
@@ -748,7 +748,7 @@
\poparrangedpages
\fi}
-%D Might be used if a printer is printing from a rol or creating mini-books from A4:
+%D Might be used if a printer is printing from a roll or creating mini-books from A4:
%D This section has 16 pages. The folding scheme is first a Z-fold and at the end
%D a final fold in the spine.
%D Coding: [2*8*Z]
@@ -1045,7 +1045,7 @@
%D There should be arrangements for sections made of heavy and thick paper. i.e. the heavier the paper
%D the fewer pages per section:
-%D Section with 8 pages put on to sheets of paper. Each sheet carries recto 2 and verso 2 pages.
+%D Section with 8 pages put on two sheets of paper. Each sheet carries recto 2 and verso 2 pages.
%D Coding: [2*2*2]
\installpagearrangement 2*2*2
diff --git a/tex/context/base/page-lin.mkvi b/tex/context/base/page-lin.mkvi
index e3b628487..c55a1228b 100644
--- a/tex/context/base/page-lin.mkvi
+++ b/tex/context/base/page-lin.mkvi
@@ -103,8 +103,9 @@
{\dontleavehmode\begingroup
\global\advance\c_page_lines_reference\plusone
\attribute\linereferenceattribute\c_page_lines_reference
- #3%
+ #3% todo: #3{#1} as there is no need to pass #1 as part of #3
% for the moment we use a simple system i.e. no prefixes etc .. todo: store as number
+ \c_strc_references_bind_state\zerocount % we don't want the prewordbreak and manage it here
\normalexpanded{\strc_references_set_named_reference{line}{#2}{conversion=\linenumberingparameter\c!conversion}{\the\c_page_lines_reference}}% kind labels userdata text
\endgroup}
diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf
index 97e928c35..2cdcb5a33 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 d12a331e7..c6b2b1a71 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-ref.mkvi b/tex/context/base/strc-ref.mkvi
index 3702531cf..65634b2e6 100644
--- a/tex/context/base/strc-ref.mkvi
+++ b/tex/context/base/strc-ref.mkvi
@@ -150,6 +150,25 @@
\def\dofinishsomereference#kind{\executeifdefined{dofinish#{kind}reference}\gobbletwoarguments}
+% This is somewhat tricky: we want to keep the reference with the following word but
+% that word should also hyphenate. We need to find a better way.
+
+% 0 = nothing
+% 1 = bind to following word
+
+\setnewconstant\c_strc_references_bind_state\plusone
+
+\def\strc_references_inject_before
+ {}
+
+\def\strc_references_inject_after
+ {\ifcase\c_strc_references_bind_state
+ % nothing
+ \or
+ \prewordbreak % to be tested: \removeunwantedspaces\permithyphenation
+ \fi}
+
+
\unexpanded\def\strc_references_set_named_reference
{\ifreferencing
\expandafter\strc_references_set_named_reference_indeed
@@ -231,10 +250,11 @@
\xdef\currentdestinationattribute{\number\lastdestinationattribute}%
% will become an option:
\ifnum\lastdestinationattribute>\zerocount
+ \strc_references_inject_before % new
\dontleavehmode\hbox attr \destinationattribute\lastdestinationattribute\bgroup
\strc_references_flush_destination_nodes
\egroup
- \prewordbreak % new
+ \strc_references_inject_after % new
\fi}
\def\strc_references_set_page_only_destination_attribute#labels% could in fact be fully expandable
@@ -302,10 +322,11 @@
\xdef\currentdestinationattribute{\number\lastdestinationattribute}%
% will become an option:
\ifnum\lastdestinationattribute>\zerocount
+ \strc_references_inject_before % new
\dontleavehmode\hbox attr \destinationattribute\lastdestinationattribute\bgroup
\strc_references_flush_destination_nodes
\egroup
- \prewordbreak % new
+ \strc_references_inject_after % new
\fi}
\unexpanded\def\strc_references_direct_full
diff --git a/tex/context/base/strc-rsc.lua b/tex/context/base/strc-rsc.lua
index e2105a4ef..cc670400f 100644
--- a/tex/context/base/strc-rsc.lua
+++ b/tex/context/base/strc-rsc.lua
@@ -12,7 +12,8 @@ if not modules then modules = { } end modules ['strc-rsc'] = {
-- The scanner accepts nested outer, but we don't care too much, maybe
-- some day we will have both but currently the innermost wins.
-local lpegmatch, lpegP, lpegS, lpegCs, lpegCt, lpegCf, lpegCc, lpegC, lpegCg = lpeg.match, lpeg.P, lpeg.S, lpeg.Cs, lpeg.Ct, lpeg.Cf, lpeg.Cc, lpeg.C, lpeg.Cg
+local lpegmatch, lpegpatterns = lpeg.match, lpeg.patterns
+local lpegP, lpegS, lpegCs, lpegCt, lpegCf, lpegCc, lpegC, lpegCg = lpeg.P, lpeg.S, lpeg.Cs, lpeg.Ct, lpeg.Cf, lpeg.Cc, lpeg.C, lpeg.Cg
local find = string.find
local spaces = lpegP(" ")^0
@@ -34,18 +35,28 @@ local backslash = lpegP("\\")
local endofall = spaces * lpegP(-1)
-local o_token = 1 - rparent - rbrace - lparent - lbrace -- can be made more efficient
-local a_token = 1 - rbrace
+----- o_token = 1 - rparent - rbrace - lparent - lbrace -- can be made more efficient
+----- a_token = 1 - rbrace
local s_token = 1 - lparent - lbrace
local i_token = 1 - lparent - lbrace - endofall
local f_token = 1 - lparent - lbrace - dcolon
local c_token = 1 - lparent - lbrace - tcolon
+-- experimental
+
+local o_token = lpegpatterns.nestedparents
+ + (1 - rparent - lbrace)
+local a_token = lpegpatterns.nestedbraces
+ + (1 - rbrace)
+local q_token = lpegpatterns.unsingle
+ + lpegpatterns.undouble
+
local hastexcode = lpegCg(lpegCc("has_tex") * lpegCc(true)) -- cannot be made to work
local component = lpegCg(lpegCc("component") * lpegCs(c_token^1))
local outer = lpegCg(lpegCc("outer") * lpegCs(f_token^1))
-local operation = lpegCg(lpegCc("operation") * lpegCs(o_token^1))
-local arguments = lpegCg(lpegCc("arguments") * lpegCs(a_token^0))
+----- operation = lpegCg(lpegCc("operation") * lpegCs(o_token^1))
+local operation = lpegCg(lpegCc("operation") * lpegCs(q_token + o_token^1))
+local arguments = lpegCg(lpegCc("arguments") * lpegCs(q_token + a_token^0))
local special = lpegCg(lpegCc("special") * lpegCs(s_token^1))
local inner = lpegCg(lpegCc("inner") * lpegCs(i_token^1))
@@ -152,3 +163,14 @@ references.splitcomponent = splitcomponent
-- inspect(splitreference([[outer::special()]]))
-- inspect(splitreference([[outer::inner{argument}]]))
-- inspect(splitreference([[special(outer::operation)]]))
+
+-- inspect(splitreference([[special(operation)]]))
+-- inspect(splitreference([[special(operation(whatever))]]))
+-- inspect(splitreference([[special(operation{argument,argument{whatever}})]]))
+-- inspect(splitreference([[special(operation{argument{whatever}})]]))
+
+-- inspect(splitreference([[special("operation(")]]))
+-- inspect(splitreference([[special("operation(whatever")]]))
+-- inspect(splitreference([[special(operation{"argument,argument{whatever"})]]))
+-- inspect(splitreference([[special(operation{"argument{whatever"})]]))
+
diff --git a/tex/context/base/util-str.lua b/tex/context/base/util-str.lua
index 2739a20c4..fd6fc4d91 100644
--- a/tex/context/base/util-str.lua
+++ b/tex/context/base/util-str.lua
@@ -842,7 +842,7 @@ local builder = Cs { "start",
+ V("m") + V("M") -- new
+ V("z") -- new
--
- + V("*") -- ignores probably messed up %
+ -- + V("?") -- ignores probably messed up %
)
+ V("*")
)
@@ -897,6 +897,7 @@ local builder = Cs { "start",
["A"] = (prefix_any * P("A")) / format_A, -- %A => "..." (forces tostring)
--
["*"] = Cs(((1-P("%"))^1 + P("%%")/"%%")^1) / format_rest, -- rest (including %%)
+ ["?"] = Cs(((1-P("%"))^1 )^1) / format_rest, -- rest (including %%)
--
["!"] = Carg(2) * prefix_any * P("!") * C((1-P("!"))^1) * P("!") / format_extension,
}
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index 77aab3049..d947aa686 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 : 08/29/14 20:57:48
+-- merge date : 09/03/14 17:37:43
do -- begin closure to overcome local limits and interference
@@ -3173,7 +3173,6 @@ local builder=Cs { "start",
+V("j")+V("J")
+V("m")+V("M")
+V("z")
-+V("*")
)+V("*")
)*(P(-1)+Carg(1))
)^0,
@@ -3217,6 +3216,7 @@ local builder=Cs { "start",
["a"]=(prefix_any*P("a"))/format_a,
["A"]=(prefix_any*P("A"))/format_A,
["*"]=Cs(((1-P("%"))^1+P("%%")/"%%")^1)/format_rest,
+ ["?"]=Cs(((1-P("%"))^1 )^1)/format_rest,
["!"]=Carg(2)*prefix_any*P("!")*C((1-P("!"))^1)*P("!")/format_extension,
}
local direct=Cs (