summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2014-05-26 22:08:00 +0200
committerHans Hagen <pragma@wxs.nl>2014-05-26 22:08:00 +0200
commitedf3b6a69ff7b618b51a056d31b71f842c24c198 (patch)
treef368a7c04185f74b9f1a30020a9d0d9a6c839e07
parent044365a4f17208925ebff5f8749c91571ed947ed (diff)
downloadcontext-edf3b6a69ff7b618b51a056d31b71f842c24c198.tar.gz
beta 2014.05.26 22:08
-rw-r--r--tex/context/base/buff-ver.lua8
-rw-r--r--tex/context/base/buff-ver.mkiv12
-rw-r--r--tex/context/base/cont-new.mkiv2
-rw-r--r--tex/context/base/context-version.pdfbin4286 -> 4280 bytes
-rw-r--r--tex/context/base/context.mkiv2
-rw-r--r--tex/context/base/publ-tra.lua153
-rw-r--r--tex/context/base/publ-tra.mkiv38
-rw-r--r--tex/context/base/status-files.pdfbin24603 -> 24630 bytes
-rw-r--r--tex/context/base/status-lua.pdfbin244468 -> 244607 bytes
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua2
10 files changed, 178 insertions, 39 deletions
diff --git a/tex/context/base/buff-ver.lua b/tex/context/base/buff-ver.lua
index 14914d42d..63f5bdfab 100644
--- a/tex/context/base/buff-ver.lua
+++ b/tex/context/base/buff-ver.lua
@@ -43,6 +43,7 @@ local v_auto = variables.auto
local v_yes = variables.yes
local v_last = variables.last
local v_all = variables.all
+local v_absolute = variables.absolute
-- beware, all macros have an argument:
@@ -742,8 +743,9 @@ end
--
-- needed in e.g. tabulate (manuals)
-local compact_all = Cs((P("\\") * ((1-S("\\ "))^1) * (P(" ")/"") * (P(-1) + S("[{")) + 1)^0)
-local compact_last = Cs((P(" ")^1 * P(-1)/"" + 1)^0)
+local compact_all = Cs((P("\\") * ((1-S("\\ "))^1) * (P(" ")/"") * (P(-1) + S("[{")) + 1)^0)
+local compact_absolute = Cs((P("\\") * ((1-S("\\ [{"))^1) * (P(" ")/"" * (S("[{\\"))) + 1) ^0)
+local compact_last = Cs((P(" ")^1 * P(-1)/"" + 1)^0)
function commands.typestring(settings)
local content = settings.data
@@ -751,6 +753,8 @@ function commands.typestring(settings)
local compact = settings.compact
if compact == v_all then
content = lpegmatch(compact_all,content)
+ elseif compact == v_absolute then
+ content = lpegmatch(compact_absolute,content)
elseif compact == v_last then
content = lpegmatch(compact_last,content)
end
diff --git a/tex/context/base/buff-ver.mkiv b/tex/context/base/buff-ver.mkiv
index 8b9bd1764..10002c4a7 100644
--- a/tex/context/base/buff-ver.mkiv
+++ b/tex/context/base/buff-ver.mkiv
@@ -349,6 +349,18 @@
\egroup
\gobbleoneargument} % grab last >
+%D The \type {compact} option can come in handy in the case of inline argument passing
+%D
+%D \starttyping
+%D \definetype[TeXcodeA][option=TEX]
+%D \definetype[TeXcodeB][option=TEX,compact=all]
+%D \definetype[TeXcodeC][option=TEX,compact=absolute]
+%D
+%D \def\argA#1{\TeXcodeA{{#1}}}
+%D \def\argB#1{\TeXcodeB{{#1}}}
+%D \def\argC#1{\TeXcodeC{{#1}}}
+%D \stoptyping
+
%D \macros
%D {obeyhyphens,obeybreakpoints}
%D
diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv
index 17a4cc83d..67526a9aa 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.05.26 14:56}
+\newcontextversion{2014.05.26 22:08}
%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 ade42d03a..548571204 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 aa97b7490..c9efb4b9d 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.05.26 14:56}
+\edef\contextversion{2014.05.26 22:08}
\edef\contextkind {beta}
%D For those who want to use this:
diff --git a/tex/context/base/publ-tra.lua b/tex/context/base/publ-tra.lua
index 8aa179d2d..c82d11950 100644
--- a/tex/context/base/publ-tra.lua
+++ b/tex/context/base/publ-tra.lua
@@ -6,16 +6,22 @@ if not modules then modules = { } end modules ['publ-tra'] = {
license = "see context related readme files"
}
-local sortedhash = table.sortedhash
+local next, type = next, type
+
+local sortedhash, sortedkeys = table.sortedhash, table.sortedkeys
+local settings_to_array = utilities.parsers.settings_to_array
+local formatters = string.formatters
local tracers = { }
publications.tracers = tracers
local datasets = publications.datasets
local context = context
-local NC, NR = context.NC, context.NR
-local bold = context.bold
-local darkgreen, darkred, darkblue = context.darkgreen, context.darkred, context.darkblue
+
+local ctx_NC, ctx_NR, ctx_HL, ctx_FL, ctx_ML, ctx_LL = context.NC, context.NR, context.HL, context.FL, context.ML, context.LL
+local ctx_bold, ctx_rotate = context.bold, context.rotate
+local ctx_darkgreen, ctx_darkred, ctx_darkblue = context.darkgreen, context.darkred, context.darkblue
+local ctx_starttabulate, ctx_stoptabulate = context.starttabulate, context.stoptabulate
-- TEXT hyperlink author number date
@@ -151,28 +157,30 @@ publications.tracers.fields = fields
publications.tracers.categories = categories
publications.tracers.citevariants = citevariants
publications.tracers.listvariants = listvariants
+
-- -- --
function tracers.showdatasetfields(dataset)
local luadata = datasets[dataset].luadata
if next(luadata) then
- context.starttabulate { "|lT|lT|pT|" }
- NC() bold("tag")
- NC() bold("category")
- NC() bold("fields")
- NC() NR() context.FL() -- HL()
+ ctx_starttabulate { "|lT|lT|pT|" }
+ ctx_NC() bold("tag")
+ ctx_NC() bold("category")
+ ctx_NC() bold("fields")
+ ctx_NC() ctx_NR()
+ ctx_FL()
for k, v in sortedhash(luadata) do
- NC() context(k)
- NC() context(v.category)
- NC()
+ ctx_NC() context(k)
+ ctx_NC() context(v.category)
+ ctx_NC()
for k, v in sortedhash(v) do
if k ~= "details" and k ~= "tag" and k ~= "category" then
context("%s ",k)
end
end
- NC() NR()
+ ctx_NC() ctx_NR()
end
- context.stoptabulate()
+ ctx_stoptabulate()
end
end
@@ -183,35 +191,35 @@ function tracers.showdatasetcompleteness(dataset)
local preamble = { "|lBTw(10em)|p|" }
local function required(key,value,indirect)
- NC() darkgreen(key)
- NC() if indirect then
- darkblue(value)
+ ctx_NC() ctx_darkgreen(key)
+ ctx_NC() if indirect then
+ ctx_darkblue(value)
elseif value then
context(value)
else
- darkred("\\tttf [missing]")
+ ctx_darkred("\\tttf [missing]")
end
- NC() NR()
+ ctx_NC() ctx_NR()
end
local function optional(key,value,indirect)
- NC() context(key)
- NC() if indirect then
- darkblue(value)
+ ctx_NC() context(key)
+ ctx_NC() if indirect then
+ ctx_darkblue(value)
elseif value then
context(value)
end
- NC() NR()
+ ctx_NC() ctx_NR()
end
local function identified(tag,crossref)
- NC() context("tag")
- NC() if crossref then
+ ctx_NC() context("tag")
+ ctx_NC() if crossref then
context("\\tttf %s\\hfill\\darkblue => %s",tag,crossref)
else
context("\\tttf %s",tag)
end
- NC() NR()
+ ctx_NC() ctx_NR()
end
local luadata = datasets[dataset].luadata
@@ -221,9 +229,9 @@ function tracers.showdatasetcompleteness(dataset)
local category = entry.category
local fields = categories[category]
if fields then
- context.starttabulate(preamble)
+ ctx_starttabulate(preamble)
identified(tag,entry.crossref)
- context.HL()
+ ctx_HL()
local requiredfields = fields.required
local optionalfields = fields.optional
for i=1,#requiredfields do
@@ -268,7 +276,7 @@ function tracers.showdatasetcompleteness(dataset)
optional(o,entry[o],true)
end
end
- context.stoptabulate()
+ ctx_stoptabulate()
else
-- error
end
@@ -277,5 +285,92 @@ function tracers.showdatasetcompleteness(dataset)
end
+function tracers.showfields(settings)
+ local rotation = settings.rotation
+ 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
+ end
+ end
+ end
+ local s_categories = sortedkeys(categories)
+ local s_fields = sortedkeys(validfields)
+ ctx_starttabulate { "|l" .. string.rep("|c",#s_categories) .. "|" }
+ ctx_FL()
+ ctx_NC()
+ if rotation then
+ rotation = { rotation = rotation }
+ end
+ for i=1,#s_categories do
+ ctx_NC()
+ local txt = formatters["\\bf %s"](s_categories[i])
+ if rotation then
+ ctx_rotate(rotation,txt)
+ else
+ context(txt)
+ end
+ end
+ ctx_NC() ctx_NR()
+ 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
+ context("*")
+ end
+ end
+ ctx_NC() ctx_NR()
+ end
+ ctx_LL()
+ ctx_stoptabulate()
+end
+
+function tracers.addfield(f,c)
+ -- no checking now
+ if type(f) == "string" then
+ f = settings_to_array(f)
+ if #f == 1 then
+ f = f[1]
+ end
+ end
+ if type(c) == "string" then
+ c = settings_to_array(c)
+ end
+ for i=1,#c do
+ local ci = c[i]
+ local category = categories[ci]
+ if category then
+ local optional = category.optional
+ if optional then
+ optional[#optional+1] = f
+ else
+ categories[ci] = { optional = { f } }
+ end
+ else
+ categories[ci] = { optional = { f } }
+ end
+ end
+end
+
+
commands.showbtxdatasetfields = tracers.showdatasetfields
commands.showbtxdatasetcompleteness = tracers.showdatasetcompleteness
+commands.showbtxfields = tracers.showfields
+commands.btxaddfield = tracers.addfield
diff --git a/tex/context/base/publ-tra.mkiv b/tex/context/base/publ-tra.mkiv
index 49fb6d962..0fd3440e0 100644
--- a/tex/context/base/publ-tra.mkiv
+++ b/tex/context/base/publ-tra.mkiv
@@ -21,15 +21,43 @@
\unprotect
\unexpanded\def\showbtxdatasetfields
- {\dosingleempty\publ_dataset_show_fields}
+ {\dosingleempty\publ_show_dataset_fields}
-\def\publ_dataset_show_fields[#1]%
+\def\publ_show_dataset_fields[#1]%
{\ctxcommand{showbtxdatasetfields("\iffirstargument#1\else\currentbtxdataset\fi")}}
\unexpanded\def\showbtxdatasetcompleteness
- {\dosingleempty\publ_dataset_show_completeness}
+ {\dosingleempty\publ_show_dataset_completeness}
-\def\publ_dataset_show_completeness[#1]%
+\def\publ_show_dataset_completeness[#1]%
{\ctxcommand{showbtxdatasetcompleteness("\iffirstargument#1\else\currentbtxdataset\fi")}}
-\protect \endinput
+\unexpanded\def\showbtxfields
+ {\dosingleempty\publ_show_fields}
+
+\def\publ_show_fields[#1]%
+ {\begingroup
+ \getdummyparameters[#1]%
+ \ctxcommand{showbtxfields{ rotation = "\dummyparameter\c!rotation" }}%
+ \endgroup}
+
+\unexpanded\def\btxaddfields
+ {\dodoubleempty\publ_add_fields}
+
+\def\publ_add_fields[#1][#2]%
+ {\ifsecondargument
+ \ctxcommand{btxaddfield("#1","#2")}%
+ \fi}
+
+\protect
+
+\continueifinputfile{publ-tra.mkiv}
+
+\starttext
+
+ \btxaddfields[one,two][extra one, extra two]
+
+ \showbtxfields[rotation=85] \page
+ \showbtxfields[rotation=90] \page
+
+\stoptext
diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf
index fdb2d6fac..9acd47e9a 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 987caebd4..c45ce760f 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 4d20863ac..870091dc6 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 : 05/26/14 14:56:53
+-- merge date : 05/26/14 22:08:18
do -- begin closure to overcome local limits and interference