diff options
author | Hans Hagen <pragma@wxs.nl> | 2014-05-23 23:24:00 +0200 |
---|---|---|
committer | Hans Hagen <pragma@wxs.nl> | 2014-05-23 23:24:00 +0200 |
commit | 95bcbd0f5d063383b13e749e10faa8683f48584d (patch) | |
tree | 32f17ef8223d743aad2f02cbcf309bf22c754828 | |
parent | e46e1337de173b3639e84d55095fe9463ceec73d (diff) | |
download | context-95bcbd0f5d063383b13e749e10faa8683f48584d.tar.gz |
beta 2014.05.23 23:24
37 files changed, 253 insertions, 234 deletions
diff --git a/doc/context/manuals/allkind/mkiv-publications.pdf b/doc/context/manuals/allkind/mkiv-publications.pdf Binary files differindex 2aadba29d..5ef0aa564 100644 --- a/doc/context/manuals/allkind/mkiv-publications.pdf +++ b/doc/context/manuals/allkind/mkiv-publications.pdf diff --git a/doc/context/manuals/allkind/mkiv-publications.tex b/doc/context/manuals/allkind/mkiv-publications.tex index c5bdab14a..72cc22762 100644 --- a/doc/context/manuals/allkind/mkiv-publications.tex +++ b/doc/context/manuals/allkind/mkiv-publications.tex @@ -6,6 +6,11 @@ % \btxfield{manipulator_a->manipulator_b->fieldname} +% {\setupbtxcitevariant[author][authorconversion=normal] normal : \cite[author][match(author:tufte)]}\par +% {\setupbtxcitevariant[author][authorconversion=normalshort] normalshort : \cite[author][match(author:tufte)]}\par +% {\setupbtxcitevariant[author][authorconversion=inverted] inverted : \cite[author][match(author:tufte)]}\par +% {\setupbtxcitevariant[author][authorconversion=invertedshort] invertedshort : \cite[author][match(author:tufte)]}\par + % engine=luajittex % criterium: all + sorttype=cite => citex before rest @@ -458,7 +463,6 @@ can be much larger than needed for a document. The same is true for the fields that make up an entry. Here is the list of fields that are currently handled, but of course there can be additional ones: - \startalignment[flushleft,verytolerant,nothyphenated] \startluacode local fields = publications.tracers.fields @@ -490,7 +494,7 @@ ask for a complete list: This gives: -\getbuffer +\blank \getbuffer \blank The rendering itself is somewhat complex to set up because we have not only many different standards but also many fields that can be set up. This means that @@ -579,15 +583,37 @@ more efficient, although in practice efficiency is not so important here. There are three commands to flush data: -\starttabulate[|||] % Funny usage here! Could not tabulate work without - % even specifying the number of columns? +\starttabulate[|l|l|] \NC \type {\btxfield} \NC fetch a explicit field (e.g. \type {year}) \NC \NR \NC \type {\btxdetail} \NC fetch a derived field (e.g. \type {short}) \NC \NR \NC \type {\btxflush} \NC fetch a derived or explicit field \NC \NR \stoptabulate Normally you can use \type {\btxfield} or \type {\btxflush} as derived fields -just like analyzed author fields are flushed in a special way. +just like analyzed author fields are flushed in a special way. There is +experimental support for so called manipulators. You can for instance say this: + +\starttyping +\btxflush{lowercase->title} +\stoptyping + +A sequence of manipulators is applied to fetched field, where a sequence is one +or more manipulators: + +\starttyping +\btxflush{stripperiod->uppercase->title} +\stoptyping + +Some actions are recognized (built-in) but you can also use actions from other +namespaces, like in: + +\starttyping +\btxflush{converters.Word -> title} +\stoptyping + +Watch how we can use spaces around the \type {->} which is nicer for wrapped +around usage. Eventually, we might put some more function in the default +namespace. You can improve readability by using setups, for instance: diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index af32e8f35..799d14cb6 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.21 22:04} +\newcontextversion{2014.05.23 23:24} %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 Binary files differindex cf428c00e..e6179748e 100644 --- a/tex/context/base/context-version.pdf +++ b/tex/context/base/context-version.pdf diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index 9774f645f..10228ee73 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.21 22:04} +\edef\contextversion{2014.05.23 23:24} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/mult-aux.mkiv b/tex/context/base/mult-aux.mkiv index bfac58261..427be69ce 100644 --- a/tex/context/base/mult-aux.mkiv +++ b/tex/context/base/mult-aux.mkiv @@ -1102,8 +1102,8 @@ \expandafter\noexpand\csname saved_setup_current#2\endcsname \expandafter\noexpand\csname nested_setup_current#2\endcsname}} -% okay, we can also get rid of the #9, but thiS code looks pretty bad, while the previous is -% still okay given that we can also use #6 as setup1 (so in fact we can save some cs again and +% okay, we can also get rid of the #9, but this code looks pretty bad, while the previous is +% still okay given that we can also use #6 as setup (so in fact we can save some cs again and % only use one extra) % % \global\advance\commalevel \plusone diff --git a/tex/context/base/mult-de.mkii b/tex/context/base/mult-de.mkii index 9e7ecd930..6c5633010 100644 --- a/tex/context/base/mult-de.mkii +++ b/tex/context/base/mult-de.mkii @@ -753,6 +753,7 @@ \setinterfaceconstant{indenting}{einziehen} \setinterfaceconstant{indentnext}{ziehefolgendeein} \setinterfaceconstant{indicator}{indikator} +\setinterfaceconstant{initialsep}{initialsep} \setinterfaceconstant{inner}{innen} \setinterfaceconstant{innermargin}{innermargin} \setinterfaceconstant{inputfile}{inputfile} diff --git a/tex/context/base/mult-def.lua b/tex/context/base/mult-def.lua index bd8b36185..4d923f5c1 100644 --- a/tex/context/base/mult-def.lua +++ b/tex/context/base/mult-def.lua @@ -6625,6 +6625,9 @@ return { ["surnamesep"]={ ["en"]="surnamesep", }, + ["initialsep"]={ + ["en"]="initialsep", + }, ["surnameinitialsep"]={ ["en"]="surnameinitialsep", }, diff --git a/tex/context/base/mult-en.mkii b/tex/context/base/mult-en.mkii index bf72af384..188c85ab4 100644 --- a/tex/context/base/mult-en.mkii +++ b/tex/context/base/mult-en.mkii @@ -753,6 +753,7 @@ \setinterfaceconstant{indenting}{indenting} \setinterfaceconstant{indentnext}{indentnext} \setinterfaceconstant{indicator}{indicator} +\setinterfaceconstant{initialsep}{initialsep} \setinterfaceconstant{inner}{inner} \setinterfaceconstant{innermargin}{innermargin} \setinterfaceconstant{inputfile}{inputfile} diff --git a/tex/context/base/mult-fr.mkii b/tex/context/base/mult-fr.mkii index e1129848f..735682a60 100644 --- a/tex/context/base/mult-fr.mkii +++ b/tex/context/base/mult-fr.mkii @@ -753,6 +753,7 @@ \setinterfaceconstant{indenting}{composeenalinea} \setinterfaceconstant{indentnext}{indentesuivant} \setinterfaceconstant{indicator}{indicateur} +\setinterfaceconstant{initialsep}{initialsep} \setinterfaceconstant{inner}{interieur} \setinterfaceconstant{innermargin}{margeinterieure} \setinterfaceconstant{inputfile}{fichierentree} diff --git a/tex/context/base/mult-it.mkii b/tex/context/base/mult-it.mkii index 5646a212e..a96b1b180 100644 --- a/tex/context/base/mult-it.mkii +++ b/tex/context/base/mult-it.mkii @@ -753,6 +753,7 @@ \setinterfaceconstant{indenting}{rientro} \setinterfaceconstant{indentnext}{rientrasuccessivo} \setinterfaceconstant{indicator}{indicatore} +\setinterfaceconstant{initialsep}{initialsep} \setinterfaceconstant{inner}{interno} \setinterfaceconstant{innermargin}{margineinterno} \setinterfaceconstant{inputfile}{inputfile} diff --git a/tex/context/base/mult-nl.mkii b/tex/context/base/mult-nl.mkii index aa376c39a..66cfbc83a 100644 --- a/tex/context/base/mult-nl.mkii +++ b/tex/context/base/mult-nl.mkii @@ -753,6 +753,7 @@ \setinterfaceconstant{indenting}{inspringen} \setinterfaceconstant{indentnext}{springvolgendein} \setinterfaceconstant{indicator}{aanduiding} +\setinterfaceconstant{initialsep}{initialsep} \setinterfaceconstant{inner}{binnen} \setinterfaceconstant{innermargin}{binnenmarge} \setinterfaceconstant{inputfile}{inputfile} diff --git a/tex/context/base/mult-pe.mkii b/tex/context/base/mult-pe.mkii index 16871bb62..a81d9d024 100644 --- a/tex/context/base/mult-pe.mkii +++ b/tex/context/base/mult-pe.mkii @@ -753,6 +753,7 @@ \setinterfaceconstant{indenting}{تورفتگی} \setinterfaceconstant{indentnext}{متنتورفته} \setinterfaceconstant{indicator}{اندیکاتور} +\setinterfaceconstant{initialsep}{initialsep} \setinterfaceconstant{inner}{داخلی} \setinterfaceconstant{innermargin}{حاشیهداخلی} \setinterfaceconstant{inputfile}{پروندهورودی} diff --git a/tex/context/base/mult-ro.mkii b/tex/context/base/mult-ro.mkii index d01822944..b6a070c59 100644 --- a/tex/context/base/mult-ro.mkii +++ b/tex/context/base/mult-ro.mkii @@ -753,6 +753,7 @@ \setinterfaceconstant{indenting}{aliniat} \setinterfaceconstant{indentnext}{aliniaturmator} \setinterfaceconstant{indicator}{indicator} +\setinterfaceconstant{initialsep}{initialsep} \setinterfaceconstant{inner}{intern} \setinterfaceconstant{innermargin}{innermargin} \setinterfaceconstant{inputfile}{inputfile} diff --git a/tex/context/base/pack-com.mkiv b/tex/context/base/pack-com.mkiv index 4ca77af1c..72bb906d9 100644 --- a/tex/context/base/pack-com.mkiv +++ b/tex/context/base/pack-com.mkiv @@ -324,7 +324,10 @@ \def\pack_combinations_caption_second {\ifx\nexttoken\egroup % the caption is empty + \else\ifx\nexttoken\stopcaption + % the caption is empty (new per 2014-05-24) \else + % todo: \p_pack_combinations_alternative\v!none: no style, strut etc \hsize\wd\b_pack_combinations_content \ifx\p_align\empty\else\setupalign[\p_align]\fi \usecombinationstyleandcolor\c!style\c!color @@ -332,7 +335,7 @@ \aftergroup\endstrut \aftergroup\egroup \begstrut - \fi} + \fi\fi} \def\pack_combinations_pickup_package_pair % we need to store the caption row {\vbox diff --git a/tex/context/base/publ-aut.lua b/tex/context/base/publ-aut.lua index ba492a93b..c549b2d16 100644 --- a/tex/context/base/publ-aut.lua +++ b/tex/context/base/publ-aut.lua @@ -19,6 +19,8 @@ local concat = table.concat local lpeg = lpeg local utfchar = utf.char +local P, C, V, Cs, Ct, lpegmatch, lpegpatterns = lpeg.P, lpeg.C, lpeg.V, lpeg.Cs, lpeg.Ct, lpeg.match, lpeg.patterns + local publications = publications or { } local datasets = publications.datasets or { } @@ -27,8 +29,6 @@ publications.datasets = datasets publications.authors = publications.authors or { } local authors = publications.authors -local P, C, V, Cs, Ct, lpegmatch, lpegpatterns = lpeg.P, lpeg.C, lpeg.V, lpeg.Cs, lpeg.Ct, lpeg.match, lpeg.patterns - -- local function makesplitter(separator) -- return Ct { "start", -- start = (Cs((V("outer") + (1-separator))^1) + separator^1)^1, @@ -230,6 +230,7 @@ local settings = { } -- local defaultsettings = { -- firstnamesep = " ", +-- initialsep = " ", -- vonsep = " ", -- surnamesep = " ", -- juniorsep = " ", @@ -254,6 +255,7 @@ local defaultsettings = { juniorjuniorsep = [[\btxlistvariantparameter{juniorjuniorsep}]], surnamefirstnamesep = [[\btxlistvariantparameter{surnamefirstnamesep}]], surnameinitialsep = [[\btxlistvariantparameter{surnameinitialsep}]], + initialsep = [[\btxlistvariantparameter{initialsep}]], namesep = [[\btxlistvariantparameter{namesep}]], lastnamesep = [[\btxlistvariantparameter{lastnamesep}]], finalnamesep = [[\btxlistvariantparameter{finalnamesep}]], @@ -300,7 +302,7 @@ function authors.normalshort(author,settings) local initials, vons, surnames, juniors = author.initials, author.vons, author.surnames, author.juniors local result, settings = { }, settings or defaultsettings if initials and #initials > 0 then - result[#result+1] = concat(initials," ") + result[#result+1] = concat(the_initials(initials)," ") result[#result+1] = settings.initialsep or defaultsettings.initialsep end if vons and #vons > 0 then @@ -371,6 +373,8 @@ function authors.invertedshort(author,settings) return concat(result) end +authors.short = authors.normalshort + local lastconcatsize = 1 local function concatnames(t,settings) @@ -426,29 +430,6 @@ function commands.btxauthor(...) context(authors.concat(...)) end -function authors.short(author,year) - -- todo --- local result = { } --- if author then --- local authors = splitauthors(author) --- for a=1,#authors do --- local aa = authors[a] --- local initials = aa.initials --- for i=1,#initials do --- result[#result+1] = initials[i] --- end --- local surnames = aa.surnames --- for s=1,#surnames do --- result[#result+1] = utfchar(lpegmatch(firstcharacter,surnames[s])) --- end --- end --- end --- if year then --- result[#result+1] = year --- end --- return concat(result) -end - -- We can consider creating a hashtable key -> entry but I wonder if -- pays off. diff --git a/tex/context/base/publ-fnd.lua b/tex/context/base/publ-fnd.lua index 383bcac73..7dd4fd74c 100644 --- a/tex/context/base/publ-fnd.lua +++ b/tex/context/base/publ-fnd.lua @@ -14,16 +14,16 @@ local concat = table.concat local formatters = string.formatters local lowercase = characters.lower -local colon = P(":") -local dash = P("-") -local lparent = P("(") -local rparent = P(")") -local space = lpeg.patterns.whitespace -local valid = 1 - colon - space - lparent - rparent ------ key = C(valid^1) -local key = C(R("az","AZ")^1) -local word = Cs(lpeg.patterns.unquoted + valid^1) -local number = C(valid^1) +local colon = P(":") +local dash = P("-") +local lparent = P("(") +local rparent = P(")") +local space = lpeg.patterns.whitespace +local valid = 1 - colon - space - lparent - rparent +----- key = C(valid^1) +local key = C(R("az","AZ")^1) +local word = Cs(lpeg.patterns.unquoted + valid^1) +local number = C(valid^1) ----- f_string_key = formatters[" local s_%s = entry[%q]"] local f_string_key = formatters[" local s_%s = entry[%q] if s_%s then s_%s = lower(s_%s) end "] @@ -135,7 +135,6 @@ function publications.search(dataset,expression) end end - -- local dataset = publications.new() -- publications.load(dataset,"t:/manuals/hybrid/tugboat.bib") -- diff --git a/tex/context/base/publ-ini.lua b/tex/context/base/publ-ini.lua index 102b22104..a73450ab3 100644 --- a/tex/context/base/publ-ini.lua +++ b/tex/context/base/publ-ini.lua @@ -8,41 +8,6 @@ if not modules then modules = { } end modules ['publ-ini'] = { -- we could store the destinations in the user list entries --- will move: - -local lpegmatch = lpeg.match -local P, R, C, Ct, Cs = lpeg.P, lpeg.R, lpeg.C, lpeg.Ct, lpeg.Cs - -local lpegmatch = lpeg.match -local pattern = Cs((1 - P(1) * P(-1))^0 * (P(".")/"" + P(1))) - -local manipulators = { - stripperiod = function(str) return lpegmatch(pattern,str) end, - uppercase = characters.upper, - lowercase = characters.lower, -} - -local manipulation = C((1-P("->"))^1) * P("->") * C(P(1)^0) - -local pattern = manipulation / function(operation,str) - local manipulator = manipulators[operation] - return manipulator and manipulator(str) or str -end - -local function manipulated(str) - return lpegmatch(pattern,str) or str -end - -utilities.parsers.manipulation = manipulation -utilities.parsers.manipulators = manipulators -utilities.parsers.manipulated = manipulated - -function commands.manipulated(str) - context(manipulated(str)) -end - --- use: for rest in gmatch(reference,"[^, ]+") do - local next, rawget, type, tostring, tonumber = next, rawget, type, tostring, tonumber local match, gmatch, format, gsub = string.match, string.gmatch, string.format, string.gsub local concat, sort, tohash = table.concat, table.sort, table.tohash @@ -53,7 +18,7 @@ local settings_to_array, settings_to_set = utilities.parsers.settings_to_array, local sortedkeys, sortedhash = table.sortedkeys, table.sortedhash local setmetatableindex = table.setmetatableindex local lpegmatch = lpeg.match -local P, C, Ct = lpeg.P, lpeg.C, lpeg.Ct +local P, C, Ct, R = lpeg.P, lpeg.C, lpeg.Ct, lpeg.R local report = logs.reporter("publications") local report_cite = logs.reporter("publications","cite") @@ -100,7 +65,8 @@ local sortcomparer = sorters.comparers.basic -- (a,b) local sortstripper = sorters.strip local sortsplitter = sorters.splitters.utf -local settings_to_array = utilities.parsers.settings_to_array +local splitmanipulation = typesetters.manipulators.splitspecification +local applymanipulation = typesetters.manipulators.applyspecification local context = context @@ -196,10 +162,8 @@ local function serialize(t) local s = sortedkeys(entry) for i=1,#s do local k = s[i] - -- if k ~= "details" then - m = m + 1 - r[m] = f_key_string(k,entry[k]) - -- end + m = m + 1 + r[m] = f_key_string(k,entry[k]) end m = m + 1 r[m] = " }," @@ -248,7 +212,6 @@ end local function initializer() statistics.starttiming(publications) -collected = publications.collected or collected -- for the moment as we load runtime for name, state in next, collected do local dataset = datasets[name] local datasources = state.datasources @@ -309,8 +272,7 @@ setmetatableindex(usedentries,function(t,k) if u then u[#u+1] = entry else - u = { entry } - s[tag] = u + s[tag] = { entry } end else usedentries[set] = { [tag] = { entry } } @@ -318,93 +280,38 @@ setmetatableindex(usedentries,function(t,k) end end end +-- table.save("temp.lua",usedentries) end return usedentries[k] end end) --- local subsets = nil --- local block = tex.count.btxblock --- local collected = references.collected --- local prefix = nil -- todo: dataset ? --- if prefix and prefix ~= "" then --- subsets = { collected[prefix] or collected[""] } --- else --- local components = references.productdata.components --- local subset = collected[""] --- if subset then --- subsets = { subset } --- else --- subsets = { } --- end --- for i=1,#components do --- local subset = collected[components[i]] --- if subset then --- subsets[#subsets+1] = subset --- end --- end --- end --- if #subsets == 0 then --- subsets = { collected[""] } --- end --- local list = type(reference) == "string" and settings_to_array(reference) or reference --- local todo = table.tohash(list) --- if #subsets > 0 then --- local result, nofresult, done = { }, 0, { } --- for i=1,#subsets do --- local subset = subsets[i] --- for i=1,#list do --- local rest = list[i] --- local blk, tag, found = block, nil, nil --- if block then --- tag = f_destination(dataset,blk,rest) --- found = subset[tag] --- if not found then --- for i=block-1,1,-1 do --- tag = f_destination(dataset,i,rest) --- found = subset[tag] --- if found then --- blk = i --- break --- end --- end --- end --- end --- if not found then --- blk = "*" --- tag = f_destination(dataset,blk,rest) --- found = subset[tag] --- end --- if found then --- local entries = found.entries --- if entries then --- local current = tonumber(entries.text) -- todo: no ranges when no tonumber --- if current and not done[current] then --- nofresult = nofresult + 1 --- result[nofresult] = { blk, rest, current, found.references.internal } --- done[current] = true --- end --- end --- end --- end --- end +-- match: +-- +-- [current|previous|following] section +-- [current|previous|following] block +-- [current|previous|following] component +-- +-- by prefix +-- by dataset local reported = { } local finder = publications.finder local function findallused(dataset,reference,block,section) -local finder = publications.finder - local find = finder and finder(reference) - local tags = not find and settings_to_array(reference) - local todo = { } - local okay = { } -- only if mark - local set = usedentries[dataset] - local valid = datasets[dataset].luadata + local finder = publications.finder -- for the moment, not yes in all betas + local find = finder and finder(reference) + local tags = not find and settings_to_array(reference) + local todo = { } + local okay = { } -- only if mark + local set = usedentries[dataset] + local valid = datasets[dataset].luadata if set then local function register(tag) local entry = set[tag] if entry then - -- only once in a list + -- only once in a list but at some point we can have more (if we + -- decide to duplicate) if #entry == 1 then entry = entry[1] else @@ -643,48 +550,14 @@ function commands.setbtxentry(name,tag) end end --- rendering of fields (maybe multiple manipulators) - --- local manipulation = utilities.parsers.manipulation --- local manipulators = utilities.parsers.manipulators --- --- local function checked(field) --- local m, f = lpegmatch(manipulation,field) --- if m then --- return manipulators[m], f or field --- else --- return nil, field --- end --- end - -local manipulation = Ct((C((1-P("->"))^1) * P("->"))^1) * C(P(1)^0) -local manipulators = utilities.parsers.manipulators - -local function checked(field) - local m, f = lpegmatch(manipulation,field) - if m then - return m, f or field - else - return nil, field - end -end - -local function manipulated(actions,str) - for i=1,#actions do - local action = manipulators[actions[i]] - if action then - str = action(str) or str - end - end - return str -end +-- rendering of fields function commands.btxflush(name,tag,field) local dataset = rawget(datasets,name) if dataset then local fields = dataset.luadata[tag] if fields then - local manipulator, field = checked(field) + local manipulator, field = splitmanipulation(field) local value = fields[field] if type(value) == "string" then local suffixes = dataset.suffixes[tag] @@ -694,7 +567,7 @@ function commands.btxflush(name,tag,field) value = value .. converters.characters(suffix) end end - context(manipulator and manipulated(manipulator,value) or value) + context(manipulator and applymanipulation(manipulator,value) or value) return end local details = dataset.details[tag] @@ -708,7 +581,7 @@ function commands.btxflush(name,tag,field) value = value .. converters.characters(suffix) end end - context(manipulator and manipulated(manipulator,value) or value) + context(manipulator and applymanipulation(manipulator,value) or value) return end end @@ -726,7 +599,7 @@ function commands.btxdetail(name,tag,field) if dataset then local details = dataset.details[tag] if details then - local manipulator, field = checked(field) + local manipulator, field = splitmanipulation(field) local value = details[field] if type(value) == "string" then local suffixes = dataset.suffixes[tag] @@ -736,7 +609,7 @@ function commands.btxdetail(name,tag,field) value = value .. converters.characters(suffix) end end - context(manipulator and manipulated(manipulator,value) or value) + context(manipulator and applymanipulation(manipulator,value) or value) else report("unknown detail %a of tag %a in dataset %a",field,tag,name) end @@ -753,7 +626,7 @@ function commands.btxfield(name,tag,field) if dataset then local fields = dataset.luadata[tag] if fields then - local manipulator, field = checked(field) + local manipulator, field = splitmanipulation(field) local value = fields[field] if type(value) == "string" then local suffixes = dataset.suffixes[tag] @@ -763,7 +636,7 @@ function commands.btxfield(name,tag,field) value = value .. converters.characters(suffix) end end - context(manipulator and manipulated(manipulator,value) or value) + context(manipulator and applymanipulation(manipulator,value) or value) else report("unknown field %a of tag %a in dataset %a",field,tag,name) end diff --git a/tex/context/base/publ-ini.mkiv b/tex/context/base/publ-ini.mkiv index fb0d00d03..b175b614d 100644 --- a/tex/context/base/publ-ini.mkiv +++ b/tex/context/base/publ-ini.mkiv @@ -590,7 +590,7 @@ \unexpanded\def\currentbtxciteauthor % always author {\ctxcommand{btxauthor("\currentbtxdataset","\currentbtxtag","author",{ - combiner = "\btxcitevariantparameter\c!author", + combiner = "\btxcitevariantparameter\c!authorconversion", etallimit = \number\btxcitevariantparameter\c!etallimit, etaldisplay = \number\btxcitevariantparameter\c!etaldisplay, })}} @@ -827,7 +827,7 @@ \unexpanded\def\publ_cite_no[#1]% {\iftrialtypesetting \else - \ctxcommand{btxhandlecite{% + \ctxcommand{btxhandlenocite{% dataset = "\currentbtxdataset",% reference = "#1",% markentry = \iftrialtypesetting false\else true\fi,% @@ -936,6 +936,7 @@ [\c!interaction=\v!start, \c!setups=btx:cite:\btxcitevariantparameter\c!alternative, \c!alternative=num, + \c!authorconversion=\v!normal, \c!andtext={ and }, \c!otherstext={ et al.}, \c!pubsep={, }, @@ -948,6 +949,8 @@ \c!middle=, \c!right=] +% \c!authorconversion=\v!normal + \definebtxcitevariant [author] [%c!sorttype=, @@ -1066,6 +1069,7 @@ \c!firstnamesep={ }, \c!juniorsep={ }, \c!vonsep={ }, + \c!initialsep={ }, \c!surnamesep={, }, \c!surnameinitialsep={, }, \c!surnamefirstnamesep={, }, @@ -1088,9 +1092,9 @@ [author] \setupbtxcitevariant - [\c!author =\btxlistvariantparameter\c!author, - \c!etallimit =\btxlistvariantparameter\c!etallimit, - \c!etaldisplay =\btxlistvariantparameter\c!etaldisplay] + [\c!authorconversion=\btxlistvariantparameter\c!authorconversion, + \c!etallimit =\btxlistvariantparameter\c!etallimit, + \c!etaldisplay =\btxlistvariantparameter\c!etaldisplay] % Do we want these in the format? Loading them delayed is somewhat messy. diff --git a/tex/context/base/publ-tra.lua b/tex/context/base/publ-tra.lua index 98c81d800..8aa179d2d 100644 --- a/tex/context/base/publ-tra.lua +++ b/tex/context/base/publ-tra.lua @@ -17,6 +17,8 @@ local NC, NR = context.NC, context.NR local bold = context.bold local darkgreen, darkred, darkblue = context.darkgreen, context.darkred, context.darkblue +-- TEXT hyperlink author number date + local fields = table.sorted { "abstract", "address", @@ -89,23 +91,6 @@ local listvariants = table.sorted { "artauthor", } --- local categories = table.sorted { --- "article", --- "book", --- "booklet", --- "conference", --- "inbook", --- "incollection", --- "inproceedings", --- "manual", --- "mastersthesis", --- "misc", --- "phdthesis", --- "proceedings", --- "techreport", --- "unpublished", --- } - local categories = { article = { required = { "author", "title", "journal", "year" }, diff --git a/tex/context/base/publ-usr.lua b/tex/context/base/publ-usr.lua index 6bb93ebee..e2100a289 100644 --- a/tex/context/base/publ-usr.lua +++ b/tex/context/base/publ-usr.lua @@ -6,6 +6,9 @@ if not modules then modules = { } end modules ['publ-usr'] = { license = "see context related readme files" } +local P, Cs, R, Cc, Carg = lpeg.P, lpeg.Cs, lpeg.R, lpeg.Cc, lpeg.Carg + +local settings_to_hash = utilities.parsers.settings_to_hash -- local chardata = characters.data -- local str = [[ @@ -30,8 +33,6 @@ local remapped = { arttitle = "title", } -local P, Cs, R, Cc, Carg = lpeg.P, lpeg.Cs, lpeg.R, lpeg.Cc, lpeg.Carg - local function register(target,key,a,b,c,d,e) key = remapped[key] or key if b and d and e then @@ -78,7 +79,7 @@ local value = optional^-1 * mandate^-1 * optional^-1 * mandate^-2 local pattern = ((Carg(1) * key * value) / register + P(1))^0 function publications.addtexentry(dataset,settings,content) - settings = utilities.parsers.settings_to_hash(settings) + settings = settings_to_hash(settings) local data = { tag = settings.tag or settings.k or "no tag", category = settings.category or settings.t or "article", diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf Binary files differindex 24b732427..2c166a863 100644 --- a/tex/context/base/status-files.pdf +++ b/tex/context/base/status-files.pdf diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf Binary files differindex f6ca96bc3..edb25cc89 100644 --- a/tex/context/base/status-lua.pdf +++ b/tex/context/base/status-lua.pdf diff --git a/tex/context/base/status-mkiv.lua b/tex/context/base/status-mkiv.lua index 07e912a88..05bfd7c93 100644 --- a/tex/context/base/status-mkiv.lua +++ b/tex/context/base/status-mkiv.lua @@ -4907,6 +4907,11 @@ return { }, { category = "lua", + filename = "typo-man", + status = "todo", + }, + { + category = "lua", filename = "typo-prc", status = "todo", }, @@ -5088,6 +5093,12 @@ return { }, { category = "lua", + filename = "publ-fnd", + loading = "publ-ini.mkiv", + status = "pending", + }, + { + category = "lua", filename = "publ-tra", loading = "publ-ini.mkiv", status = "pending", diff --git a/tex/context/base/typo-man.lua b/tex/context/base/typo-man.lua new file mode 100644 index 000000000..9b3c8b92b --- /dev/null +++ b/tex/context/base/typo-man.lua @@ -0,0 +1,111 @@ +if not modules then modules = { } end modules ['typo-man'] = { + version = 1.001, + comment = "companion to typo-prc.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +if not characters then + -- for testing stand-alone + require("char-def") + require("char-ini") +end + +local lpegmatch = lpeg.match +local P, R, C, Ct, Cs, Carg = lpeg.P, lpeg.R, lpeg.C, lpeg.Ct, lpeg.Cs, lpeg.Carg +local global = global or _G + +local methods = { + uppercase = characters.upper, + lowercase = characters.lower, +} + +local function nothing(s) return s end -- we already have that one somewhere + +-- table.setmetatableindex(methods,function(t,k) +-- t[k] = nothing +-- return nothing +-- end) + +local splitter = lpeg.tsplitat(".") + +table.setmetatableindex(methods,function(t,k) + local s = lpegmatch(splitter,k) + local v = global + for i=1,#s do + v = v[s[i]] + if not v then + break + end + end + if not v or v == global then + v = nothing + end + t[k] = v + return v +end) + +local whitespace = lpeg.patterns.whitespace^0 +local separator = whitespace * P("->") * whitespace +local pair = C((1-separator)^1) * separator * C(P(1)^0) +local list = Ct((C((1-separator)^1) * separator)^1) * C(P(1)^0) + +local pattern = Carg(1) * pair / function(methods,operation,str) + return methods[operation](str) or str +end + +local function apply(str,m) + return lpegmatch(pattern,str,1,m or methods) or str +end + +local function splitspecification(field,m) + local m, f = lpegmatch(list,field,1,m or methods) + if m then + return m, f or field + else + return nil, field + end +end + +local function applyspecification(actions,str) + if actions then + for i=1,#actions do + local action = methods[actions[i]] + if action then + str = action(str) or str + end + end + end + return str +end + +if not typesetters then typesetters = { } end + +typesetters.manipulators = { + methods = methods, + apply = apply, + patterns = { + pair = pair, + list = list, + }, + splitspecification = splitspecification, + applyspecification = applyspecification, +} + +local pattern = Cs((1 - P(1) * P(-1))^0 * (P(".")/"" + P(1))) + +methods.stripperiod = function(str) return lpegmatch(pattern,str) end + +-- print(apply("hans")) +-- print(apply("uppercase->hans")) +-- print(apply("string.reverse -> hans")) +-- print(apply("uppercase->hans",{ uppercase = string.reverse } )) + +-- print(applyspecification(splitspecification("hans"))) +-- print(applyspecification(splitspecification("lowercase->uppercase->hans"))) +-- print(applyspecification(splitspecification("uppercase->stripperiod->hans."))) + +function commands.manipulated(str) + context(apply(str)) +end diff --git a/tex/context/base/typo-prc.mkvi b/tex/context/base/typo-prc.mkvi index de221f241..74f02212b 100644 --- a/tex/context/base/typo-prc.mkvi +++ b/tex/context/base/typo-prc.mkvi @@ -13,7 +13,11 @@ \writestatus{loading}{ConTeXt Typesetting Macros / Processors} +%D For the moment manipulators are loaded here too, as they're in the same +%D category as processors. This might change. (They are used in publications.) + \registerctxluafile{typo-prc}{1.001} +\registerctxluafile{typo-man}{1.001} \unprotect diff --git a/tex/context/base/x-ct.lua b/tex/context/base/x-ct.lua index 2dee985c3..9c647e8e7 100644 --- a/tex/context/base/x-ct.lua +++ b/tex/context/base/x-ct.lua @@ -122,6 +122,8 @@ function moduledata.ct.tabulate(root,namespace) end +-- todo: use content and caption + function moduledata.ct.combination(root,namespace) if not root then diff --git a/tex/context/base/x-mathml.mkiv b/tex/context/base/x-mathml.mkiv index 5520dbbe6..badccbc4d 100644 --- a/tex/context/base/x-mathml.mkiv +++ b/tex/context/base/x-mathml.mkiv @@ -16,7 +16,8 @@ % This module is under construction and will be cleaned up. We use a funny mix of % xml, tex and lua. I could rewrite the lot but it also shows how context evolves. % -% I might en dup with a lua-only implementation some day. +% I might end up with a lua-only implementation some day. I must find a good reason +% to spend time on it. In fact, it might even be more messy. % % no m:text strip (needs checking, maybe nbsp is mandate % @@ -1709,7 +1710,7 @@ \stopxmlsetups \startxmlsetups mml:annotation - \xmldoifelse {#1} {.[oneof(@encoding,'TeX','tex','TEX','ConTeXt','context','CONTEXT','ctx')]} { + \xmldoifelse {#1} {.[oneof(@encoding,'TeX','tex','application/x-tex','TEX','ConTeXt','context','CONTEXT','ctx')]} { \xmlflushcontext{#1} } { \xmldoifelse {#1} {.[oneof(@encoding,'calcmath','cm')]} { diff --git a/tex/context/interface/keys-cs.xml b/tex/context/interface/keys-cs.xml index 7053ceed7..cdfdf016f 100644 --- a/tex/context/interface/keys-cs.xml +++ b/tex/context/interface/keys-cs.xml @@ -759,6 +759,7 @@ <cd:constant name='indenting' value='odsazovani'/> <cd:constant name='indentnext' value='odsadpristi'/> <cd:constant name='indicator' value='indikator'/> + <cd:constant name='initialsep' value='initialsep'/> <cd:constant name='inner' value='vnitrni'/> <cd:constant name='innermargin' value='innermargin'/> <cd:constant name='inputfile' value='inputfile'/> diff --git a/tex/context/interface/keys-de.xml b/tex/context/interface/keys-de.xml index 7164db6e3..ea4067288 100644 --- a/tex/context/interface/keys-de.xml +++ b/tex/context/interface/keys-de.xml @@ -759,6 +759,7 @@ <cd:constant name='indenting' value='einziehen'/> <cd:constant name='indentnext' value='ziehefolgendeein'/> <cd:constant name='indicator' value='indikator'/> + <cd:constant name='initialsep' value='initialsep'/> <cd:constant name='inner' value='innen'/> <cd:constant name='innermargin' value='innermargin'/> <cd:constant name='inputfile' value='inputfile'/> diff --git a/tex/context/interface/keys-en.xml b/tex/context/interface/keys-en.xml index 354b86d65..736198166 100644 --- a/tex/context/interface/keys-en.xml +++ b/tex/context/interface/keys-en.xml @@ -759,6 +759,7 @@ <cd:constant name='indenting' value='indenting'/> <cd:constant name='indentnext' value='indentnext'/> <cd:constant name='indicator' value='indicator'/> + <cd:constant name='initialsep' value='initialsep'/> <cd:constant name='inner' value='inner'/> <cd:constant name='innermargin' value='innermargin'/> <cd:constant name='inputfile' value='inputfile'/> diff --git a/tex/context/interface/keys-fr.xml b/tex/context/interface/keys-fr.xml index 0e4f9e516..314e1b87f 100644 --- a/tex/context/interface/keys-fr.xml +++ b/tex/context/interface/keys-fr.xml @@ -759,6 +759,7 @@ <cd:constant name='indenting' value='composeenalinea'/> <cd:constant name='indentnext' value='indentesuivant'/> <cd:constant name='indicator' value='indicateur'/> + <cd:constant name='initialsep' value='initialsep'/> <cd:constant name='inner' value='interieur'/> <cd:constant name='innermargin' value='margeinterieure'/> <cd:constant name='inputfile' value='fichierentree'/> diff --git a/tex/context/interface/keys-it.xml b/tex/context/interface/keys-it.xml index afc33eb22..9af423467 100644 --- a/tex/context/interface/keys-it.xml +++ b/tex/context/interface/keys-it.xml @@ -759,6 +759,7 @@ <cd:constant name='indenting' value='rientro'/> <cd:constant name='indentnext' value='rientrasuccessivo'/> <cd:constant name='indicator' value='indicatore'/> + <cd:constant name='initialsep' value='initialsep'/> <cd:constant name='inner' value='interno'/> <cd:constant name='innermargin' value='margineinterno'/> <cd:constant name='inputfile' value='inputfile'/> diff --git a/tex/context/interface/keys-nl.xml b/tex/context/interface/keys-nl.xml index 9abfe5d7a..efe7814ed 100644 --- a/tex/context/interface/keys-nl.xml +++ b/tex/context/interface/keys-nl.xml @@ -759,6 +759,7 @@ <cd:constant name='indenting' value='inspringen'/> <cd:constant name='indentnext' value='springvolgendein'/> <cd:constant name='indicator' value='aanduiding'/> + <cd:constant name='initialsep' value='initialsep'/> <cd:constant name='inner' value='binnen'/> <cd:constant name='innermargin' value='binnenmarge'/> <cd:constant name='inputfile' value='inputfile'/> diff --git a/tex/context/interface/keys-pe.xml b/tex/context/interface/keys-pe.xml index 517c41ed0..5eeaedcfe 100644 --- a/tex/context/interface/keys-pe.xml +++ b/tex/context/interface/keys-pe.xml @@ -759,6 +759,7 @@ <cd:constant name='indenting' value='تورفتگی'/> <cd:constant name='indentnext' value='متنتورفته'/> <cd:constant name='indicator' value='اندیکاتور'/> + <cd:constant name='initialsep' value='initialsep'/> <cd:constant name='inner' value='داخلی'/> <cd:constant name='innermargin' value='حاشیهداخلی'/> <cd:constant name='inputfile' value='پروندهورودی'/> diff --git a/tex/context/interface/keys-ro.xml b/tex/context/interface/keys-ro.xml index b7f5b2e19..5f707884f 100644 --- a/tex/context/interface/keys-ro.xml +++ b/tex/context/interface/keys-ro.xml @@ -759,6 +759,7 @@ <cd:constant name='indenting' value='aliniat'/> <cd:constant name='indentnext' value='aliniaturmator'/> <cd:constant name='indicator' value='indicator'/> + <cd:constant name='initialsep' value='initialsep'/> <cd:constant name='inner' value='intern'/> <cd:constant name='innermargin' value='innermargin'/> <cd:constant name='inputfile' value='inputfile'/> diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index a0122fbe9..4c1063bbb 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/21/14 22:04:03 +-- merge date : 05/23/14 23:24:48 do -- begin closure to overcome local limits and interference |