summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorContext Git Mirror Bot <phg42.2a@gmail.com>2014-10-29 01:15:04 +0100
committerContext Git Mirror Bot <phg42.2a@gmail.com>2014-10-29 01:15:04 +0100
commite4d37ac8b9848292f1af2de118258a093b104cc8 (patch)
tree7bdde43a37d63010b7956c628ca2f8406ed3d4f3
parent9dc96ff2030bae02f3116509a752d7949fd8b5c3 (diff)
downloadcontext-e4d37ac8b9848292f1af2de118258a093b104cc8.tar.gz
2014-10-29 00:20:00
-rw-r--r--tex/context/base/back-exp.lua42
-rw-r--r--tex/context/base/cont-new.mkiv2
-rw-r--r--tex/context/base/context-version.pdfbin4405 -> 4383 bytes
-rw-r--r--tex/context/base/context.mkiv2
-rw-r--r--tex/context/base/publ-dat.lua81
-rw-r--r--tex/context/base/publ-reg.lua31
-rw-r--r--tex/context/base/publ-tra.lua58
-rw-r--r--tex/context/base/status-files.pdfbin24707 -> 24687 bytes
-rw-r--r--tex/context/base/status-lua.pdfbin333730 -> 333711 bytes
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua2
10 files changed, 145 insertions, 73 deletions
diff --git a/tex/context/base/back-exp.lua b/tex/context/base/back-exp.lua
index ca5cd5889..76b95e388 100644
--- a/tex/context/base/back-exp.lua
+++ b/tex/context/base/back-exp.lua
@@ -195,6 +195,8 @@ local p_attribute = lpeg.replacer(attribentities)
local p_stripper = lpeg.patterns.stripper
local p_escaped = lpeg.patterns.xml.escaped
+local f_id = formatters["%s-%s"]
+
local alignmapping = {
flushright = "right",
middle = "center",
@@ -418,9 +420,9 @@ local usedimages = { }
do
local imagetemplate = [[
-%element%[id="%detail%"], div.%element%[id="%detail%"] {
+%element%[id="%id%"], div.%element%[id="%id%"] {
display : block ;
- background-image : url(%name%) ;
+ background-image : url(%url%) ;
background-size : 100%% auto ;
background-repeat : no-repeat ;
width : %width% ;
@@ -444,21 +446,18 @@ local imagetemplate = [[
for element, details in sortedhash(usedimages) do
for detail, data in sortedhash(details) do
local name = data.name
- local full = url.addscheme(substitute(name))
- result[#result+1] = replacetemplate(imagetemplate,{
+ local spec = {
element = element,
- detail = detail,
- name = full,
- width = data.width,
- height = data.height,
- })
- collected[detail] = {
- name = full,
+ id = data.id,
+ name = name,
+ url = url.addscheme(substitute(name)),
width = data.width,
height = data.height,
- page = data.page,
used = data.used,
+ page = data.page,
}
+ result[#result+1] = replacetemplate(imagetemplate,spec)
+ collected[detail] = spec
end
end
return concat(result,"\n\n")
@@ -718,10 +717,14 @@ do
usedimages.image = image
function structurestags.setfigure(name,used,page,width,height)
- image[locatedtag("image")] = {
+ local fulltag = locatedtag("image")
+ local spec = specifications[fulltag]
+ local page = tonumber(page)
+ image[fulltag] = {
+ id = f_id(spec.tagname,spec.tagindex),
name = name,
used = used,
- page = page,
+ page = page and page > 1 and page or nil,
width = todimen(width, "cm","%0.3Fcm"),
height = todimen(height,"cm","%0.3Fcm"),
}
@@ -731,11 +734,8 @@ do
local data = image[fulltag]
if data then
setattribute(di,"name",data.name)
- local page = tonumber(data.page)
- if page and page > 1 then
- setattribute(di,"page",page)
- end
- setattribute(di,"id",fulltag)
+ setattribute(di,"page",data.page)
+ setattribute(di,"id",data.id)
setattribute(di,"width",data.width)
setattribute(di,"height",data.height)
end
@@ -3058,7 +3058,9 @@ local htmltemplate = [[
result = { tg }
end
for k, v in next, at do
- result[#result+1] = k .. "-" .. v
+ if not private[k] then
+ result[#result+1] = k .. "-" .. v
+ end
end
return concat(result, " ")
end
diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv
index 7c79c017b..4b417bda2 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.10.27 15:16}
+\newcontextversion{2014.10.29 00:18}
%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 4abb589f6..dec3b2f57 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 22ce6c50e..26a00b8a5 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.10.27 15:16}
+\edef\contextversion{2014.10.29 00:18}
\edef\contextkind {beta}
%D For those who want to use this:
diff --git a/tex/context/base/publ-dat.lua b/tex/context/base/publ-dat.lua
index a9007fa9c..67ab81e9f 100644
--- a/tex/context/base/publ-dat.lua
+++ b/tex/context/base/publ-dat.lua
@@ -42,8 +42,11 @@ local P, R, S, V, C, Cc, Cs, Ct, Carg, Cmt = lpeg.P, lpeg.R, lpeg.S, lpeg.V, lpe
local p_whitespace = lpegpatterns.whitespace
-local trace = false trackers.register("publications", function(v) trace = v end)
+local trace = false trackers.register("publications", function(v) trace = v end)
+local trace_duplicates = true trackers.register("publications.duplicates", function(v) trace = v end)
+
local report = logs.reporter("publications")
+local report_duplicates = logs.reporter("publications","duplicates")
publications = publications or { }
local publications = publications
@@ -96,6 +99,9 @@ local extrafields = {
category = "implicit",
tag = "implicit",
key = "implicit",
+ keywords = "implicit",
+ language = "implicit",
+ crossref = "implicit",
}
local default = {
@@ -318,40 +324,63 @@ publications.getindex = getindex
-- todo: categories : metatable that lowers and also counts
-- todo: fields : metatable that lowers
+local tags = table.setmetatableindex("table")
+
local function do_definition(category,tag,tab,dataset)
publicationsstats.nofdefinitions = publicationsstats.nofdefinitions + 1
local fields = dataset.fields
local luadata = dataset.luadata
- local found = luadata[tag]
- local index = getindex(dataset,luadata,tag)
- local entries = {
- category = lower(category),
- tag = tag,
- index = index,
- }
- for i=1,#tab,2 do
- local original = tab[i]
- local normalized = fields[original]
- if not normalized then
- normalized = lower(original) -- we assume ascii fields
- fields[original] = normalized
- end
- local value = tab[i+1]
- value = textoutf(value)
- if lpegmatch(filter_1,value) then
- value = lpegmatch(filter_2,value,1,dataset.commands) -- we need to start at 1 for { }
+ if luadata[tag] then
+ local t = tags[tag]
+ local d = dataset.name
+ local n = (t[n] or 0) + 1
+ t[d] = n
+ if trace_duplicates then
+ local p = { }
+ for k, v in sortedhash(t) do
+ p[#p+1] = formatters["%s:%s"](k,v)
+ end
+ report_duplicates("tag %a is present multiple times: % t",tag,p)
end
- if normalized == "crossref" then
- local parent = luadata[value]
- if parent then
- setmetatableindex(entries,parent)
+ else
+ local found = luadata[tag]
+ local index = getindex(dataset,luadata,tag)
+ local entries = {
+ category = lower(category),
+ tag = tag,
+ index = index,
+ }
+ for i=1,#tab,2 do
+ local original = tab[i]
+ local normalized = fields[original]
+ if not normalized then
+ normalized = lower(original) -- we assume ascii fields
+ fields[original] = normalized
+ end
+ -- if entries[normalized] then
+ if rawget(entries,normalized) then
+ if trace_duplicates then
+ report_duplicates("redundant field %a is ignored for tag %a in dataset %a",normalized,tag,dataset.name)
+ end
else
- -- warning
+ local value = tab[i+1]
+ value = textoutf(value)
+ if lpegmatch(filter_1,value) then
+ value = lpegmatch(filter_2,value,1,dataset.commands) -- we need to start at 1 for { }
+ end
+ if normalized == "crossref" then
+ local parent = luadata[value]
+ if parent then
+ setmetatableindex(entries,parent)
+ else
+ -- warning
+ end
+ end
+ entries[normalized] = value
end
end
- entries[normalized] = value
+ luadata[tag] = entries
end
- luadata[tag] = entries
end
local function resolve(s,dataset)
diff --git a/tex/context/base/publ-reg.lua b/tex/context/base/publ-reg.lua
index 6b9cc9234..ee2bd6f47 100644
--- a/tex/context/base/publ-reg.lua
+++ b/tex/context/base/publ-reg.lua
@@ -8,6 +8,7 @@ if not modules then modules = { } end modules ['publ-reg'] = {
local formatters = string.formatters
local sortedhash = table.sortedhash
+local lpegmatch = lpeg.match
local context = context
local commands = commands
@@ -103,16 +104,17 @@ end
local ctx_dosetfastregisterentry = context.dosetfastregisterentry -- register entry key
-local f_field = formatters[ [[\dobtxindexedfield{%s}{%s}{%s}{%s}{%s}]] ]
-local f_author = formatters[ [[\dobtxindexedauthor{%s}{%s}{%s}{%s}{%s}]] ]
+local f_field = formatters[ [[\dobtxindexedfield{%s}{%s}{%s}{%s}{%s}]] ]
+local f_author = formatters[ [[\dobtxindexedauthor{%s}{%s}{%s}{%s}{%s}]] ]
-local writer = publications.serializeauthor
+local p_keywords = lpeg.tsplitat(lpeg.patterns.whitespace^0 * lpeg.P(";") * lpeg.patterns.whitespace^0)
+local writer = publications.serializeauthor
function flushers.default(register,dataset,tag,field,alternative,current,entry,detail)
- local value = detail[field] or entry[field]
- if value then
- local e = f_field(dataset,tag,field,alternative,value)
- ctx_dosetfastregisterentry(register,e,value) -- last value can be ""
+ local k = detail[field] or entry[field]
+ if k then
+ local e = f_field(dataset,tag,field,alternative,k)
+ ctx_dosetfastregisterentry(register,e,k)
end
end
@@ -129,3 +131,18 @@ function flushers.author(register,dataset,tag,field,alternative,current,entry,de
end
end
end
+
+function flushers.keywords(register,dataset,tag,field,alternative,current,entry,detail)
+ if entry then
+ -- we don't split keywords in details (yet) ... could be an alternative some day
+ local keywords = entry[field]
+ if keywords then
+ keywords = lpegmatch(p_keywords,keywords)
+ for i=1,#keywords do
+ local k = keywords[i]
+ local e = f_field(dataset,tag,field,alternative,k)
+ ctx_dosetfastregisterentry(register,e,k)
+ end
+ end
+ end
+end
diff --git a/tex/context/base/publ-tra.lua b/tex/context/base/publ-tra.lua
index 7dc5d5703..cd4ebca1a 100644
--- a/tex/context/base/publ-tra.lua
+++ b/tex/context/base/publ-tra.lua
@@ -23,12 +23,20 @@ local ctx_bold, ctx_rotate, ctx_llap = context.bold, context.rotate, context.lla
local ctx_darkgreen, ctx_darkred, ctx_darkblue = context.darkgreen, context.darkred, context.darkblue
local ctx_starttabulate, ctx_stoptabulate = context.starttabulate, context.stoptabulate
-local private = {
+local privates = {
category = true,
tag = true,
index = true,
}
+local specials = {
+ key = true,
+ crossref = true,
+ keywords = true,
+ language = true,
+ comment = true,
+}
+
function tracers.showdatasetfields(settings)
local dataset = settings.dataset
local current = datasets[dataset]
@@ -51,7 +59,11 @@ function tracers.showdatasetfields(settings)
ctx_NC() context(category)
ctx_NC()
for k, v in sortedhash(v) do
- if not private[k] then
+ if privates[k] then
+ -- skip
+ elseif specials[k] then
+ ctx_darkblue(k)
+ else
local f = fields[k]
if f == "required" then
ctx_darkgreen(k)
@@ -106,6 +118,17 @@ function tracers.showdatasetcompleteness(settings)
foundfields[key] = nil
end
+ local function optional(foundfields,key,value,indirect)
+ ctx_NC() context(key)
+ ctx_NC() if indirect then
+ ctx_darkblue(lpegmatch(texescape,value))
+ elseif value then
+ context(lpegmatch(texescape,value))
+ end
+ ctx_NC() ctx_NR()
+ foundfields[key] = nil
+ end
+
local function identified(tag,category,crossref)
ctx_NC() context(category)
ctx_NC() if crossref then
@@ -116,6 +139,12 @@ function tracers.showdatasetcompleteness(settings)
ctx_NC() ctx_NR()
end
+ local function special(key,value)
+ ctx_NC() ctx_darkblue(key)
+ ctx_NC() context(lpegmatch(texescape,value))
+ ctx_NC() ctx_NR()
+ end
+
local function extra(key,value)
ctx_NC() ctx_llap("+") context(key)
ctx_NC() context(lpegmatch(texescape,value))
@@ -186,7 +215,11 @@ function tracers.showdatasetcompleteness(settings)
end
end
for k, v in sortedhash(foundfields) do
- if not private[k] then
+ if privates[k] then
+ -- skip
+ elseif specials[k] then
+ special(k,entry[k])
+ else
extra(k,entry[k])
end
end
@@ -202,22 +235,11 @@ function tracers.showfields(settings)
local fielddata = kind and specifications[kind] or specifications.apa
local categories = fielddata.categories
local fieldspecs = fielddata.fields
- local swapped = { }
local validfields = { }
for category, fields in next, categories do
- local categoryfields = { }
for name, list in next, fields do
for i=1,#list do
- local field = list[i]
- if type(field) == "table" then
- field = table.concat(field," + ")
- end
- validfields[field] = true
- if swapped[field] then
- swapped[field][category] = true
- else
- swapped[field] = { [category] = true }
- end
+ validfields[list[i]] = true
end
end
end
@@ -242,12 +264,14 @@ function tracers.showfields(settings)
ctx_FL()
for i=1,#s_fields do
local field = s_fields[i]
- local fields = swapped[field]
ctx_NC()
ctx_bold(field)
for j=1,#s_categories do
ctx_NC()
- if fields[s_categories[j]] then
+ local kind = fieldspecs[s_categories[j]][field]
+ if kind == "required" then
+ ctx_darkgreen("*")
+ elseif kind == "optional" then
context("*")
end
end
diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf
index 21f151a50..634787db2 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 9298c71a6..3ad31abd0 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 43734d206..891650e5c 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 : 10/27/14 15:16:33
+-- merge date : 10/29/14 00:18:00
do -- begin closure to overcome local limits and interference