summaryrefslogtreecommitdiff
path: root/tex/context
diff options
context:
space:
mode:
authorContext Git Mirror Bot <phg42.2a@gmail.com>2014-11-10 11:15:04 +0100
committerContext Git Mirror Bot <phg42.2a@gmail.com>2014-11-10 11:15:04 +0100
commitf853930e63e059af883ee86b9fe5549cfaa75d43 (patch)
tree7d872b6fa23e09b19e4df2966b8c1c218b4a7908 /tex/context
parent19cbb867e30cd14ade5a9057965fdd76314e0cdb (diff)
downloadcontext-f853930e63e059af883ee86b9fe5549cfaa75d43.tar.gz
2014-11-10 10:53:00
Diffstat (limited to 'tex/context')
-rw-r--r--tex/context/base/cont-new.mkiv2
-rw-r--r--tex/context/base/context-version.pdfbin4390 -> 4386 bytes
-rw-r--r--tex/context/base/context.mkiv2
-rw-r--r--tex/context/base/lxml-aux.lua23
-rw-r--r--tex/context/base/lxml-ini.mkiv4
-rw-r--r--tex/context/base/lxml-tex.lua11
-rw-r--r--tex/context/base/math-fbk.lua11
-rw-r--r--tex/context/base/node-ini.lua2
-rw-r--r--tex/context/base/publ-imp-apa.mkvi64
-rw-r--r--tex/context/base/publ-imp-cite.mkvi3
-rw-r--r--tex/context/base/publ-ini.lua25
-rw-r--r--tex/context/base/publ-ini.mkiv44
-rw-r--r--tex/context/base/spac-ver.lua6
-rw-r--r--tex/context/base/status-files.pdfbin24682 -> 24698 bytes
-rw-r--r--tex/context/base/status-lua.pdfbin343700 -> 343723 bytes
15 files changed, 123 insertions, 74 deletions
diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv
index 2abacf632..740d43d23 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.11.09 15:05}
+\newcontextversion{2014.11.10 10:51}
%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 a67ff0afa..bc7049dee 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 5e17054a8..4eb7ec264 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.11.09 15:05}
+\edef\contextversion{2014.11.10 10:51}
\edef\contextkind {beta}
%D For those who want to use this:
diff --git a/tex/context/base/lxml-aux.lua b/tex/context/base/lxml-aux.lua
index a26d7c2ea..96f89d544 100644
--- a/tex/context/base/lxml-aux.lua
+++ b/tex/context/base/lxml-aux.lua
@@ -463,9 +463,16 @@ function xml.inclusions(e,sorted)
end
end
+local stripper = lpeg.patterns.stripper
+local fullstripper = lpeg.patterns.fullstripper
+local collapser = lpeg.patterns.collapser
+
+local lpegmatch = lpeg.match
+
local function stripelement(e,nolines,anywhere)
local edt = e.dt
if edt then
+ local strip = nolines and fullstripper or stripper
if anywhere then
local t, n = { }, 0
for e=1,#edt do
@@ -474,11 +481,7 @@ local function stripelement(e,nolines,anywhere)
n = n + 1
t[n] = str
elseif str ~= "" then
- -- todo: lpeg for each case
- if nolines then
- str = gsub(str,"%s+"," ")
- end
- str = gsub(str,"^%s*(.-)%s*$","%1")
+ str = lpegmatch(strip,str)
if str ~= "" then
n = n + 1
t[n] = str
@@ -497,10 +500,7 @@ local function stripelement(e,nolines,anywhere)
elseif str == "" then
remove(edt,1)
else
- if nolines then
- str = gsub(str,"%s+"," ")
- end
- str = gsub(str,"^%s+","")
+ str = lpegmatch(strip,str)
if str == "" then
remove(edt,1)
else
@@ -517,10 +517,7 @@ local function stripelement(e,nolines,anywhere)
elseif str == "" then
remove(edt)
else
- if nolines then
- str = gsub(str,"%s+"," ")
- end
- str = gsub(str,"%s+$","")
+ str = lpegmatch(strip,str)
if str == "" then
remove(edt)
else
diff --git a/tex/context/base/lxml-ini.mkiv b/tex/context/base/lxml-ini.mkiv
index 017152777..d9258627c 100644
--- a/tex/context/base/lxml-ini.mkiv
+++ b/tex/context/base/lxml-ini.mkiv
@@ -116,8 +116,8 @@
\def\xmldoifnottext #1#2{\ctxlxml{doifnottext (\!!bs#1\!!es,\!!bs#2\!!es)}} % expandable
\def\xmldoifelsetext #1#2{\ctxlxml{doifelsetext(\!!bs#1\!!es,\!!bs#2\!!es)}} % expandable
-%def\xmldoifelseempty #1#2{\ctxlxml{doifelseempty("#1","#2")}} % #2, "*" or "" == self not yet implemented
-%def\xmldoifelseselfempty #1{\ctxlxml{doifelseempty("#1")}}
+\def\xmldoifelseempty #1#2{\ctxlxml{doifelseempty("#1","#2")}} % #2, "*" or "" == self not yet implemented
+\def\xmldoifelseselfempty #1{\ctxlxml{doifelseempty("#1")}}
% \startxmlsetups xml:include
% \xmlinclude{main}{include}{filename|href}
diff --git a/tex/context/base/lxml-tex.lua b/tex/context/base/lxml-tex.lua
index 31381b0ca..974646be7 100644
--- a/tex/context/base/lxml-tex.lua
+++ b/tex/context/base/lxml-tex.lua
@@ -1670,7 +1670,16 @@ function lxml.doifelsetext (id,pattern) doifelse(not empty(getid(id),pattern)) e
-- special case: "*" and "" -> self else lpath lookup
---~ function lxml.doifelseempty(id,pattern) doifelse(isempty(getid(id),pattern ~= "" and pattern ~= nil)) end -- not yet done, pattern
+function lxml.doifelseempty(id,pattern)
+ local e = getid(id)
+ if not pattern or pattern == "" then
+ local dt = e.dt
+ local nt = #dt
+ doifelse((nt == 0) or (nt == 1 and dt[1] == ""))
+ else
+ doifelse(isempty(getid(id),pattern))
+ end
+end
-- status info
diff --git a/tex/context/base/math-fbk.lua b/tex/context/base/math-fbk.lua
index 7c97249d6..71d743731 100644
--- a/tex/context/base/math-fbk.lua
+++ b/tex/context/base/math-fbk.lua
@@ -469,13 +469,20 @@ virtualcharacters[0xFE303] = function(data) return smashed(data,0x0303,0xFE303)
-- another crazy hack .. doesn't work as we define scrscr first .. we now have smaller
-- primes so we have smaller primes for the moment, big ones will become an option
+-- todo: check tounicodes
+
local function smashed(data,unicode,optional)
local oldchar = data.characters[unicode]
if oldchar then
- local height = 1.2 * data.target.parameters.xheight
+ local xheight = data.target.parameters.xheight
+ local height = 1.2 * xheight
+ local shift = oldchar.height - height
+-- if unicode == 0x2032 then
+-- print(string.formatters["%U %0.4p %0.4p %0.4p %0.4p"](unicode,oldchar.height,xheight,data.target.parameters.size,shift))
+-- end
local newchar = {
commands = {
- { "down", oldchar.height - height },
+ { "down", shift },
{ "char", unicode },
},
height = height,
diff --git a/tex/context/base/node-ini.lua b/tex/context/base/node-ini.lua
index a9ef305c0..fb01f2f42 100644
--- a/tex/context/base/node-ini.lua
+++ b/tex/context/base/node-ini.lua
@@ -206,7 +206,7 @@ nodes.whatcodes = whatcodes nodes.whatsitcodes = whatcodes -- more offici
nodes.listcodes = listcodes
nodes.glyphcodes = glyphcodes
nodes.kerncodes = kerncodes
-nodes.penaltycodes = kerncodes
+nodes.penaltycodes = penaltycodes
nodes.mathcodes = mathcodes
nodes.fillcodes = fillcodes
nodes.margincodes = margincodes
diff --git a/tex/context/base/publ-imp-apa.mkvi b/tex/context/base/publ-imp-apa.mkvi
index 1903b319b..ffb9fb1ca 100644
--- a/tex/context/base/publ-imp-apa.mkvi
+++ b/tex/context/base/publ-imp-apa.mkvi
@@ -10,16 +10,8 @@
%C This module is part of the \CONTEXT\ macro||package and is therefore copyrighted
%D by \PRAGMA. See mreadme.pdf for details.
-% Hans: what does the below mean? Just some wrapper (possible tracing and so)
% \loadbtxdefinitionfile[def]
-%D Instead of texdefinitions without arguments, we could have used setups but in my
-%D editor the commands stand out better and it also saves an additional component
-%D in the name (e.g. common:) because commands and setups have a different namespace.
-%D
-%D Sometimes we have verbose injections in an entry and these can be language
-%D dependent, so we use labels.
-
\startbtxrenderingdefinitions[apa]
%D Reference:
@@ -35,12 +27,6 @@
%D }
%D \stopTEX
-% First of all, the APA style defines authoryear bibliography lists.
-
-% does not work here: \setupbtxrendering [standard] [numbering=no,sorttype=authoryear]
-
-% does not work here: \setupbtxcitevariant [alternative=authoryear,sorttype=authoryear]
-
% set all APA compliant values (may be redundant but we do not count on defaults.)
\setupbtxlistvariant
@@ -72,28 +58,29 @@
% like \setupbtxlistvariant above but not exactly...
+% The APA style defines authoryear citations.
+
\setupbtxcitevariant
[\c!alternative=authoryear,
- \c!namesep={,\space},
- \c!lastnamesep={,\nobreakspace\textampersand\space},
+ \c!namesep=\btxlistvariantparameter\c!namesep,
+ \c!lastnamesep=\btxlistvariantparameter\c!lastnamesep,
\c!finalnamesep={\nobreakspace\textampersand\space}, % no comma!
- \c!firstnamesep=\space,
- \c!otherstext={\space\btxlabeltext{\currentbtxspecification:others}},
- \c!juniorsep=\space,
- \c!vonsep=\space,
- \c!initialsep=\space,
- %\c!initialssep=\space,
- %\c!initialsterminator={.},
- \c!surnamesep={,\space},
- \c!surnameinitialsep={,\space},
- \c!surnamefirstnamesep={,\space},
+ \c!firstnamesep=\btxlistvariantparameter\c!firstnamesep,
+ \c!otherstext=\btxlistvariantparameter\c!otherstext,
+ \c!juniorsep=\btxlistvariantparameter\c!juniorsep,
+ \c!vonsep=\btxlistvariantparameter\c!vonsep,
+ \c!initialsep=\btxlistvariantparameter\c!initialsep,
+ %\c!initialssep=\btxlistvariantparameter\c!initialssep,
+ %\c!initialsterminator=\btxlistvariantparameter\c!initialsterminator,
+ \c!surnamesep=\btxlistvariantparameter\c!surnamesep,
+ \c!surnameinitialsep=\btxlistvariantparameter\c!surnameinitialsep,
+ \c!surnamefirstnamesep=\btxlistvariantparameter\c!surnamefirstnamesep,
\c!etallimit=5, % when 2-4, show all first time, etaldisplay subsequently...
\c!etaldisplay=1,
- \c!monthconversion=\v!number,
+ \c!monthconversion=\btxlistvariantparameter\c!monthconversion,
\c!authorconversion=\v!name,
\c!interaction=\v!start,
% \c!setups=btx:cite:initialize,
- \c!alternative=num,
\c!pubsep={,\space},
\c!lastpubsep={\space\btxlabeltext{\currentbtxspecification:and}\space},
\c!finalpubsep={\space\btxlabeltext{\currentbtxspecification:and}\space},
@@ -145,6 +132,9 @@
%D \btxloadjournallist[journals.txt] % the jabref list
%D \stoptyping
+%D Sometimes we have verbose injections in an entry and these can be language
+%D dependent, so we use labels.
+%D
%D Because we want to mix rendering (in the manual) we need a namespace in label
%D texts:
@@ -178,6 +168,8 @@
apa:and=and,
apa:period={. },
apa:Author=Author,
+ apa:Reference={Ref.},
+ apa:References={Refs.},
apa:Advanced={Advanced online publication},
apa:Retrieved={Retrieved from},
apa:others={et al.}]
@@ -209,6 +201,8 @@
apa:and=et,
apa:period={. },
apa:Author=Auteur,
+ apa:Reference={Réf.},
+ apa:References={Réfs.},
apa:Advanced={Publication en ligne anticipée},
apa:Retrieved={Téléchargé de},
apa:others={et al.}]
@@ -240,6 +234,8 @@
apa:and=und,
apa:period={. },
apa:Author=Autor,
+ apa:Reference={Ref.},
+ apa:References={Ref.},
apa:Advanced={Erweiterte Online-Publikation},
apa:Retrieved={heruntergeladen von},
apa:others={et al.}]
@@ -273,10 +269,18 @@
apa:and=e,
apa:period={. },
apa:Author=Autore,
+ apa:Reference={Rif.},
+ apa:References={Rif.},
apa:Advanced={Pre-pubblicazione on line},
apa:Retrieved={Accessible online},
apa:others={et al.}]
+%D Instead of texdefinitions without arguments, we could have used setups but in my
+%D editor (hh, scite) the commands stand out better. It also saves an additional
+%D component in the name (e.g. common:) because commands and setups have a different
+%D namespace, so similar calls don't clash. Performance of definitions is somewhat
+%D better.
+
%D \btxdoif... and \btxflush rely on the definitions in publ-imp-apa.lua:
%D fields that are not listed as required nor optional are IGNORED.
@@ -348,6 +352,7 @@
\stoptexdefinition
\starttexdefinition btx:apa:author-or-title
+ <\btxfieldname{authors},\btxfieldtype{authors}>\space\btxflush{authors}\space
\btxdoifelse {author} {
\btxflushauthor[invertedshort]{author}
} {
@@ -357,7 +362,7 @@
\starttexdefinition btx:apa:editor-or-editors
\btxleftparenthesis
- \btxsingularplural {editor} {
+ \btxsingularorplural {editor} {
\btxlabeltext{apa:Editor}
} {
\btxlabeltext{apa:Editors}
@@ -366,6 +371,7 @@
\stoptexdefinition
\starttexdefinition btx:apa:author-or-editor-or-publisher-or- #title #publisher
+ <\btxfieldname{authors},\btxfieldtype{authors}>\space\btxflush{authors}\space
\btxdoifelse {author} {
\btxflushauthor[invertedshort]{author}
} {
diff --git a/tex/context/base/publ-imp-cite.mkvi b/tex/context/base/publ-imp-cite.mkvi
index f43f677e9..b49e8339d 100644
--- a/tex/context/base/publ-imp-cite.mkvi
+++ b/tex/context/base/publ-imp-cite.mkvi
@@ -246,6 +246,9 @@
\startsetups \s!btx:\s!cite:num
\fastsetup{\s!btx:\s!cite:render:range}
\stopsetups
+\startsetups \s!btx:\s!cite:textnum
+ \fastsetup{\s!btx:\s!cite:render:range}
+\stopsetups
\startsetups \s!btx:\s!cite:title
\fastsetup{\s!btx:\s!cite:render:normal}
\stopsetups
diff --git a/tex/context/base/publ-ini.lua b/tex/context/base/publ-ini.lua
index ea2bf4519..784813330 100644
--- a/tex/context/base/publ-ini.lua
+++ b/tex/context/base/publ-ini.lua
@@ -163,14 +163,14 @@ end
local specifications = publications.specifications
local currentspecification = specifications[false]
-local currentspecificationfields = currentspecification.fields
+----- currentspecificationfields = currentspecification.fields
local currentspecificationcategories = currentspecification.categories
local ignoredfields = { }
local function setspecification(name)
currentspecification = specifications[name]
- currentspecificationfields = currentspecification.fields
+ -- currentspecificationfields = currentspecification.fields
currentspecificationcategories = currentspecification.categories
if trace then
report("setting specification %a",type(name) == "string" and name or "anything")
@@ -991,6 +991,19 @@ do
if kind then
return what and kind or field
end
+ local sets = catspec.sets
+ if sets then
+ local set = sets[field]
+ if set then
+ for i=1,#set do
+ local field = set[i]
+ local kind = fields[field]
+ if kind then
+ return what and kind or field
+ end
+ end
+ end
+ end
end
end
end
@@ -998,11 +1011,15 @@ do
end
function commands.btxfieldname(name,tag,field)
- return context(get(name,tag,field))
+ local found = get(name,tag,field)
+ -- print(name,tag,field,found)
+ context(found)
end
function commands.btxfieldtype(name,tag,field)
- return context(get(name,tag,field,true))
+ local found = get(name,tag,field,true)
+ -- print(name,tag,field,found)
+ context(found)
end
function commands.btxflush(name,tag,field)
diff --git a/tex/context/base/publ-ini.mkiv b/tex/context/base/publ-ini.mkiv
index 4c209f6cd..552b322f8 100644
--- a/tex/context/base/publ-ini.mkiv
+++ b/tex/context/base/publ-ini.mkiv
@@ -1418,26 +1418,26 @@
\setupbtxcitevariant
[\c!specification=\btxparameter\c!specification,
- \c!namesep={,\space},
- \c!lastnamesep={,\space\btxlabeltext{\currentbtxspecification:and}\space},
- \c!finalnamesep={,\space\btxlabeltext{\currentbtxspecification:and}\space},
- \c!firstnamesep=\space,
- \c!otherstext={\space\btxlabeltext{\currentbtxspecification:others}},
- \c!juniorsep=\space,
- \c!vonsep=\space,
- \c!initialsep=\space,
- %\c!initialssep=\space,
- %\c!initialsterminator={.},
- \c!surnamesep={,\space},
- \c!surnameinitialsep={,\space},
- \c!surnamefirstnamesep={,\space},
- \c!etallimit=5, % when 2-4, show all first time, etaldisplay subsequently...
- \c!etaldisplay=1,
- \c!monthconversion=\v!number,
+ \c!alternative=num,
+ \c!namesep=\btxlistvariantparameter\c!namesep,
+ \c!lastnamesep=\btxlistvariantparameter\c!lastnamesep,
+ \c!finalnamesep=\btxlistvariantparameter\c!finalnamesep,
+ \c!firstnamesep=\btxlistvariantparameter\c!firstnamesep,
+ \c!otherstext=\btxlistvariantparameter\c!otherstext,
+ \c!juniorsep=\btxlistvariantparameter\c!juniorsep,
+ \c!vonsep=\btxlistvariantparameter\c!vonsep,
+ \c!initialsep=\btxlistvariantparameter\c!initialsep,
+ %\c!initialssep=\btxlistvariantparameter\c!initialssep,
+ %\c!initialsterminator=\btxlistvariantparameter\c!initialsterminator,
+ \c!surnamesep=\btxlistvariantparameter\c!surnamesep,
+ \c!surnameinitialsep=\btxlistvariantparameter\c!surnameinitialsep,
+ \c!surnamefirstnamesep=\btxlistvariantparameter\c!surnamefirstnamesep,
+ \c!etallimit=\btxlistvariantparameter\c!etallimit,
+ \c!etaldisplay=\btxlistvariantparameter\c!etaldisplay,
+ \c!monthconversion=\btxlistvariantparameter\c!monthconversion,
\c!authorconversion=\v!name,
\c!interaction=\v!start,
% \c!setups=btx:cite:initialize,
- \c!alternative=num,
\c!pubsep={,\space},
\c!lastpubsep={\space\btxlabeltext{\currentbtxspecification:and}\space},
\c!finalpubsep={\space\btxlabeltext{\currentbtxspecification:and}\space},
@@ -1568,6 +1568,16 @@
\c!lastpubsep={,},
\c!finalpubsep={,}]
+\definebtxcitevariant
+ [textnum]
+ [num]
+ [\c!left={Ref.\nbsp}, % {Refs.\nbsp}, if multiple?
+ %yuck! ={\btxlabeltext{\currentbtxspecification:Reference\btxsingularplural{num}{}{s}}\nbsp}
+ \c!right=,
+ \c!pubsep={,},
+ \c!lastpubsep={\space\btxlabeltext{\currentbtxspecification:and}\space},
+ \c!finalpubsep={\space\btxlabeltext{\currentbtxspecification:and}\space}]
+
% Do we want these in the format? Loading them delayed is somewhat messy.
\loadbtxdefinitionfile[commands]
diff --git a/tex/context/base/spac-ver.lua b/tex/context/base/spac-ver.lua
index b21f90beb..ce51a05e8 100644
--- a/tex/context/base/spac-ver.lua
+++ b/tex/context/base/spac-ver.lua
@@ -1098,7 +1098,9 @@ end
-- This will be replaces after 0.79 when we have a more robust look-back and
-- can look at the bigger picture.
--- todo: look back and when a special is there before a list is seen penaltym keep ut
+-- todo: look back and when a special is there before a list is seen penalty keep ut
+
+-- we now look back a lot, way too often
local function collapser(head,where,what,trace,snap,a_snapmethod) -- maybe also pass tail
if trace then
@@ -1194,11 +1196,9 @@ local function collapser(head,where,what,trace,snap,a_snapmethod) -- maybe also
while current do
local id = getid(current)
if id == hlist_code or id == vlist_code then
-
-- if nobreakfound == nil then
-- nobreakfound = false
-- end
-
-- needs checking, why so many calls
if snap then
local list = getlist(current)
diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf
index 2db224df5..f3032a786 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 70984a4ea..dd9b8eddd 100644
--- a/tex/context/base/status-lua.pdf
+++ b/tex/context/base/status-lua.pdf
Binary files differ