summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorContext Git Mirror Bot <phg42.2a@gmail.com>2014-11-04 11:15:04 +0100
committerContext Git Mirror Bot <phg42.2a@gmail.com>2014-11-04 11:15:04 +0100
commit8d590f58ca0d10d33517e0f42283b128c5a450d4 (patch)
tree8feb502c4538dbef6409867d4c2d4bb09ece5bf3
parenteeb6935cd762417068287ca41920469a329dfe2a (diff)
downloadcontext-8d590f58ca0d10d33517e0f42283b128c5a450d4.tar.gz
2014-11-04 11:04:00
-rw-r--r--tex/context/base/cont-new.mkiv2
-rw-r--r--tex/context/base/context-version.pdfbin4383 -> 4382 bytes
-rw-r--r--tex/context/base/context.mkiv2
-rw-r--r--tex/context/base/mult-def.mkiv7
-rw-r--r--tex/context/base/publ-dat.lua37
-rw-r--r--tex/context/base/publ-imp-apa.mkvi2
-rw-r--r--tex/context/base/publ-imp-aps.mkvi2
-rw-r--r--tex/context/base/publ-imp-cite.mkvi2
-rw-r--r--tex/context/base/publ-imp-list.mkvi2
-rw-r--r--tex/context/base/publ-imp-page.mkvi58
-rw-r--r--tex/context/base/publ-ini.lua127
-rw-r--r--tex/context/base/publ-ini.mkiv61
-rw-r--r--tex/context/base/status-files.pdfbin24710 -> 24679 bytes
-rw-r--r--tex/context/base/status-lua.pdfbin333931 -> 334509 bytes
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua2
15 files changed, 257 insertions, 47 deletions
diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv
index d9ffe0bbd..c959e6242 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.04 00:45}
+\newcontextversion{2014.11.04 11:02}
%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 6b9e4cdb6..abe538702 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 da312231f..d1bea46bb 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.04 00:45}
+\edef\contextversion{2014.11.04 11:02}
\edef\contextkind {beta}
%D For those who want to use this:
diff --git a/tex/context/base/mult-def.mkiv b/tex/context/base/mult-def.mkiv
index 3d86df7a7..5bccd8cca 100644
--- a/tex/context/base/mult-def.mkiv
+++ b/tex/context/base/mult-def.mkiv
@@ -79,6 +79,13 @@
\def\c!field {field}
\def\c!ignore {ignore}
+\def\c!pageleft {pageleft}
+\def\c!pageright {pageright}
+\def\c!pagesep {pagesep}
+\def\c!lastpagesep {lastpagesep}
+\def\c!finalpagesep {finalpagesep}
+\def\c!pageconnector {pageconnector}
+
\def\c!referencemethod {referencemethod} % forward both
\def\v!dataset {dataset}
diff --git a/tex/context/base/publ-dat.lua b/tex/context/base/publ-dat.lua
index dbd48f7f8..e5a956553 100644
--- a/tex/context/base/publ-dat.lua
+++ b/tex/context/base/publ-dat.lua
@@ -124,25 +124,29 @@ local extrafields = {
crossref = "implicit",
}
+local unknowncategory = function(t,k)
+ local v = {
+ required = { },
+ optional = { },
+ }
+ t[k] = v
+ return v
+end
+
+local unknownfield = function(t,k)
+ local v = setmetatableindex(function(t,k) local v = "optional" t[k] = v return v end)
+ t[k] = v
+ return v
+end
+
local default = {
name = name,
version = "1.00",
comment = "unknown specification.",
author = "anonymous",
copyright = "no one",
- categories = setmetatableindex(function(t,k)
- local v = {
- required = { },
- optional = { },
- }
- t[k] = v
- return v
- end),
- fields = setmetatableindex(function(t,k)
- local v = setmetatableindex(function(t,k) local v = "optional" t[k] = v return v end)
- t[k] = v
- return v
- end),
+ categories = setmetatableindex(unknowncategory),
+ fields = setmetatableindex(unknownfield),
}
local types = { "optional", "required", "virtual" }
@@ -164,13 +168,18 @@ local specifications = setmetatableindex(function(t,name)
end
-- goodie for alan ...
local categories = specification.categories
+ if not categories then
+ categories = { }
+ specification.categories = categories
+ end
for k, v in next, categories do
if type(v) == "string" then
categories[k] = categories[v]
end
end
+ setmetatableindex(categories,unknowncategory)
--
- local fields = { }
+ local fields = setmetatableindex(unknownfield)
specification.fields = fields
for category, data in next, categories do
local list = setmetatableindex({},extrafields)
diff --git a/tex/context/base/publ-imp-apa.mkvi b/tex/context/base/publ-imp-apa.mkvi
index 27ebbfa29..8fb350741 100644
--- a/tex/context/base/publ-imp-apa.mkvi
+++ b/tex/context/base/publ-imp-apa.mkvi
@@ -3,7 +3,7 @@
%D version=2013.12.12, % based on bibl-apa.tex and later xml variant
%D title=APA bibliography style,
%D subtitle=Publications,
-%D author=Hans Hagen,
+%D author=Alan Braslau and Hans Hagen,
%D date=\currentdate,
%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
%C
diff --git a/tex/context/base/publ-imp-aps.mkvi b/tex/context/base/publ-imp-aps.mkvi
index 49f5eaf73..84e0c8fcc 100644
--- a/tex/context/base/publ-imp-aps.mkvi
+++ b/tex/context/base/publ-imp-aps.mkvi
@@ -3,7 +3,7 @@
%D version=2014.05.25,
%D title=APA bibliography style,
%D subtitle=Publications,
-%D author=Hans Hagen,
+%D author=Alan Braslau and Hans Hagen,
%D date=\currentdate,
%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
%C
diff --git a/tex/context/base/publ-imp-cite.mkvi b/tex/context/base/publ-imp-cite.mkvi
index f6ce77e9c..7d0eecc63 100644
--- a/tex/context/base/publ-imp-cite.mkvi
+++ b/tex/context/base/publ-imp-cite.mkvi
@@ -3,7 +3,7 @@
%D version=2013.12.24,
%D title=\CONTEXT\ Publication Support,
%D subtitle=Citations,
-%D author=Hans Hagen,
+%D author=Alan Braslau and Hans Hagen,
%D date=\currentdate,
%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
%C
diff --git a/tex/context/base/publ-imp-list.mkvi b/tex/context/base/publ-imp-list.mkvi
index 5f56f653a..52e5694e2 100644
--- a/tex/context/base/publ-imp-list.mkvi
+++ b/tex/context/base/publ-imp-list.mkvi
@@ -3,7 +3,7 @@
%D version=2014.06.16,
%D title=\CONTEXT\ Publication Support,
%D subtitle=Lists,
-%D author=Hans Hagen,
+%D author=Alan Braslau and Hans Hagen,
%D date=\currentdate,
%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
%C
diff --git a/tex/context/base/publ-imp-page.mkvi b/tex/context/base/publ-imp-page.mkvi
new file mode 100644
index 000000000..e4eaacb92
--- /dev/null
+++ b/tex/context/base/publ-imp-page.mkvi
@@ -0,0 +1,58 @@
+%D \module
+%D [ file=publ-imp-page,
+%D version=2014.11.05,
+%D title=\CONTEXT\ Publication Support,
+%D subtitle=Page numbers,
+%D author=Alan Braslau and Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\unprotect
+
+\setupbtxlist
+ [\c!pageleft={\space (p.\nobreakspace},
+ \c!pageright={)},
+ \c!pagesep={,\space},
+ \c!lastpagesep={\space and\space},
+ \c!finalpagesep={,\space and\space},
+ \c!pageconnector=\endash]
+
+\setupbtxrendering
+ [\c!pagestate=\v!stop]
+
+\startsetups \s!btx:\s!list:\s!page:concat
+ \ifcase\currentbtxoverflow
+ \ifcase\currentbtxconcat
+ \or % first
+ \or % second
+ \btxlistparameter\c!pagesep
+ \or % second of two
+ \btxlistparameter\c!lastpagesep
+ \or % last
+ \btxlistparameter\c!finalpagesep
+ \fi
+ \fi
+\stopsetups
+
+\startsetups \s!btx:\s!list:\s!page:normal
+ \fastsetup{\s!btx:\s!list:\s!page:concat}
+ \goto {
+ \currentbtxfirstpage
+ } [
+ internal(\currentbtxfirstinternal)
+ ]
+ \ifx\currentbtxlastpage\empty \else
+ \btxlistparameter\c!pageconnector
+ \goto {
+ \currentbtxlastpage
+ } [
+ internal(\currentbtxlastinternal)
+ ]
+ \fi
+\stopsetups
+
+\protect
diff --git a/tex/context/base/publ-ini.lua b/tex/context/base/publ-ini.lua
index 313d4d727..3f17dbcf0 100644
--- a/tex/context/base/publ-ini.lua
+++ b/tex/context/base/publ-ini.lua
@@ -121,6 +121,7 @@ local ctx_btxsetlanguage = context.btxsetlanguage
local ctx_btxsetcombis = context.btxsetcombis
local ctx_btxsetcategory = context.btxsetcategory
local ctx_btxcitesetup = context.btxcitesetup
+local ctx_btxpagesetup = context.btxpagesetup
local ctx_btxsetfirst = context.btxsetfirst
local ctx_btxsetsecond = context.btxsetsecond
local ctx_btxsetthird = context.btxsetthird
@@ -134,6 +135,10 @@ local ctx_btxsetbacktrace = context.btxsetbacktrace
local ctx_btxsetcount = context.btxsetcount
local ctx_btxsetconcat = context.btxsetconcat
local ctx_btxsetoveflow = context.btxsetoverflow
+local ctx_btxsetfirstpage = context.btxsetfirstpage
+local ctx_btxsetlastpage = context.btxsetlastpage
+local ctx_btxsetfirstinternal = context.btxsetfirstinternal
+local ctx_btxsetlastinternal = context.btxsetlastinternal
local ctx_btxstartcite = context.btxstartcite
local ctx_btxstopcite = context.btxstopcite
local ctx_btxstartciteauthor = context.btxstartciteauthor
@@ -1150,6 +1155,20 @@ local function validkeyword(dataset,tag,keyword)
end
end
+local function registerpage(pages,tag,result,listindex)
+ local p = pages[tag]
+ local r = result[listindex].references
+ if p then
+ local last = p[#p][2]
+ local real = last.realpage
+ if real ~= r.realpage then
+ p[#p+1] = { listindex, r }
+ end
+ else
+ pages[tag] = { { listindex, r } }
+ end
+end
+
local methods = { }
lists.methods = methods
@@ -1196,6 +1215,7 @@ methods[v_local] = function(dataset,rendering,keyword)
local alldone = repeated and { } or r_alldone
local doglobal = rendering.method == v_global
local traced = { } -- todo: only if interactive (backlinks) or when tracing
+ local pages = { }
for listindex=1,#result do
local r = result[listindex]
local u = r.userdata
@@ -1223,6 +1243,7 @@ methods[v_local] = function(dataset,rendering,keyword)
list[#list+1] = { tag, listindex, 0, u, u.btxint }
end
end
+ registerpage(pages,tag,result,listindex)
end
end
if traced then
@@ -1232,6 +1253,9 @@ methods[v_local] = function(dataset,rendering,keyword)
end
end
lists.result = result
+ structures.lists.result = result
+ rendering.pages = pages -- or list.pages
+ -- inspect(pages)
end
methods[v_global] = methods[v_local]
@@ -1344,7 +1368,6 @@ local function byspec(dataset,list,method) -- todo: yearsuffix
return result
end
-
lists.sorters = {
[v_short] = function(dataset,rendering,list)
local shorts = rendering.shorts
@@ -1440,31 +1463,33 @@ function lists.prepareentries(dataset)
local li = list[i]
local tag = li[1]
local entry = luadata[tag]
- if entry and (forceall or repeated or not used[tag]) then
- newlist[#newlist+1] = li
- -- already here:
- if not repeated then
- used[tag] = true -- beware we keep the old state (one can always use criterium=all)
- end
- local detail = details[tag]
- if detail then
- local referencenumber = detail.referencenumber
- if not referencenumber then
- lastreferencenumber = lastreferencenumber + 1
- referencenumber = lastreferencenumber
- detail.referencenumber = lastreferencenumber
+ if entry then
+ if forceall or repeated or not used[tag] then
+ newlist[#newlist+1] = li
+ -- already here:
+ if not repeated then
+ used[tag] = true -- beware we keep the old state (one can always use criterium=all)
+ end
+ local detail = details[tag]
+ if detail then
+ local referencenumber = detail.referencenumber
+ if not referencenumber then
+ lastreferencenumber = lastreferencenumber + 1
+ referencenumber = lastreferencenumber
+ detail.referencenumber = lastreferencenumber
+ end
+ li[3] = referencenumber
+ else
+ report("missing details for tag %a in dataset %a (enhanced: %s)",tag,dataset,current.enhanced and "yes" or "no")
+ -- weird, this shouldn't happen .. all have a detail
+ lastreferencenumber = lastreferencenumber + 1
+ details[tag] = { referencenumber = lastreferencenumber }
+ li[3] = lastreferencenumber
end
- li[3] = referencenumber
- else
- report("missing details for tag %a in dataset %a (enhanced: %s)",tag,dataset,current.enhanced and "yes" or "no")
- -- weird, this shouldn't happen .. all have a detail
- lastreferencenumber = lastreferencenumber + 1
- details[tag] = { referencenumber = lastreferencenumber }
- li[3] = lastreferencenumber
end
end
end
- rendering.list = type(sorter) == "function" and sorter(dataset,rendering,newlist,sorttype) or newlist
+ rendering.list = type(sorter) == "function" and sorter(dataset,rendering,newlist,sorttype) or newlist
end
function lists.fetchentries(dataset)
@@ -1482,6 +1507,64 @@ end
-- setspecification
+function commands.btxflushpages(dataset,tag)
+ -- todo: interaction
+ local rendering = renderings[dataset]
+ local pages = rendering.pages[tag]
+ if not pages then
+ return
+ end
+ local nofpages = #pages
+ if nofpages == 0 then
+ return
+ end
+ local first_p = nil
+ local first_r = nil
+ local last_p = nil
+ local last_r = nil
+ local ranges = { }
+ local nofdone = 0
+ local function flush()
+ if last_r and first_r ~= last_r then
+ ranges[#ranges+1] = { first_p, last_p }
+ else
+ ranges[#ranges+1] = { first_p }
+ end
+ end
+ for i=1,nofpages do
+ local next_p = pages[i]
+ local next_r = next_p[2].realpage
+ if not first_r then
+ first_p = next_p
+ first_r = next_r
+ elseif last_r + 1 == next_r then
+ -- continue
+ elseif first_r then
+ flush()
+ first_p = next_p
+ first_r = next_r
+ end
+ last_p = next_p
+ last_r = next_r
+ end
+ if first_r then
+ flush()
+ end
+ local nofranges = #ranges
+ for i=1,nofranges do
+ local r = ranges[i]
+ ctx_btxsetconcat(concatstate(i,nofranges))
+ local first, last = r[1], r[2]
+ ctx_btxsetfirstinternal(first[2].internal)
+ ctx_btxsetfirstpage(first[1])
+ if last then
+ ctx_btxsetlastinternal(last[2].internal)
+ ctx_btxsetlastpage(last[1])
+ end
+ ctx_btxpagesetup()
+ end
+end
+
function lists.flushentries(dataset,textmode)
local rendering = renderings[dataset]
local list = rendering.list
diff --git a/tex/context/base/publ-ini.mkiv b/tex/context/base/publ-ini.mkiv
index d6c34bfe2..b8cd50036 100644
--- a/tex/context/base/publ-ini.mkiv
+++ b/tex/context/base/publ-ini.mkiv
@@ -589,6 +589,56 @@
\fi
\to \everydefinebtxrendering
+\newconditional\c_btx_list_texts
+
+\appendtoks
+ \doifelse{\btxrenderingparameter\c!textstate}\v!start
+ \settrue\setfalse\c_btx_list_texts
+\to \everysetupbtxlistplacement
+
+% page stuff (for thomas)
+
+\let\currentbtxfirstpage \empty \unexpanded\def\btxsetfirstpage #1{\def\currentbtxfirstpage{\btx_page_number{#1}}}
+\let\currentbtxlastpage \empty \unexpanded\def\btxsetlastpage #1{\def\currentbtxlastpage {\btx_page_number{#1}}}
+\let\currentbtxfirstinternal\empty \unexpanded\def\btxsetfirstinternal {\def\currentbtxfirstinternal}
+\let\currentbtxlastinternal \empty \unexpanded\def\btxsetlastinternal {\def\currentbtxlastinternal}
+
+\unexpanded\def\btx_page_number#1%
+ {\def\currentlistindex{#1}%
+ \structurelistpagenumber}
+
+\unexpanded\def\btxpagereset
+ {\let \currentbtxfirstpage \empty
+ \let \currentbtxlastpage \empty
+ \let \currentbtxfirstinternal\empty
+ \let \currentbtxlastinternal \empty
+ \setconstant\currentbtxoverflow \zerocount
+ \setconstant\currentbtxconcat \zerocount
+ \setconstant\currentbtxcount \zerocount}
+
+\newconditional\c_btx_list_pages
+
+\appendtoks
+ \doifelse{\btxrenderingparameter\c!pagestate}\v!start
+ \settrue\setfalse\c_btx_list_pages
+\to \everysetupbtxlistplacement
+
+\unexpanded\def\btx_entry_inject_pages
+ {\dontleavehmode
+ \begingroup
+ \let\currentlist\s!btx
+ \btxpagereset
+ \btxlistparameter\c!pageleft
+ \ctxcommand{btxflushpages("\currentbtxdataset","\currentbtxtag")}%
+ \btxlistparameter\c!pageright
+ \endgroup}
+
+\unexpanded\def\btxpagesetup
+ {\fastsetup{\s!btx:\s!list:\s!page:normal}%
+ \btxpagereset}
+
+% end of page stuff
+
\unexpanded\def\btx_entry_inject
{\begingroup
\edef\currentbtxcategory{\btxfield{category}}%
@@ -599,18 +649,20 @@
\btx_entry_inject_nop
\endgroup}
-\def\btx_entry_inject_yes
- {\edef\p_textstate{\btxrenderingparameter\c!textstate}%
- \ifx\p_textstate\v!start
+\unexpanded\def\btx_entry_inject_yes
+ {\ifconditional\c_btx_list_texts
\currentbtxbefore
\fi
\fastsetup\currentbtxsetup
\removeunwantedspaces
+ \ifconditional\c_btx_list_pages
+ \btx_entry_inject_pages
+ \fi
\ifx\currentbtxcombis\empty \else
\btxrenderingparameter\c!separator
\processcommacommand[\currentbtxcombis]\btx_entry_inject_combi
\fi
- \ifx\p_textstate\v!start
+ \ifconditional\c_btx_list_texts
\currentbtxafter
\fi}
@@ -1579,6 +1631,7 @@
\loadbtxdefinitionfile[cite]
\loadbtxdefinitionfile[list]
+\loadbtxdefinitionfile[page]
\loadbtxdefinitionfile[author]
\setupbtx
diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf
index 2d8f0568d..7446a21af 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 f918ba5c4..bdc9baeb7 100644
--- a/tex/context/base/status-lua.pdf
+++ b/tex/context/base/status-lua.pdf
Binary files differ
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index e3f3f2394..84483c2d8 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 : 11/04/14 00:45:31
+-- merge date : 11/04/14 11:02:25
do -- begin closure to overcome local limits and interference