diff options
author | Hans Hagen <pragma@wxs.nl> | 2017-10-29 16:50:11 +0100 |
---|---|---|
committer | Context Git Mirror Bot <phg42.2a@gmail.com> | 2017-10-29 16:50:11 +0100 |
commit | 7fc4b935d045c84e89459e726ff54ae331e4c574 (patch) | |
tree | 0a4587b2e4f72ccb5feff81c348c5138f4ece7e7 /tex/context/base/mkiv/publ-ini.lua | |
parent | d91c37679b13162a4ead85abbe564090b2e1b51c (diff) | |
download | context-7fc4b935d045c84e89459e726ff54ae331e4c574.tar.gz |
2017-10-29 15:50:00
Diffstat (limited to 'tex/context/base/mkiv/publ-ini.lua')
-rw-r--r-- | tex/context/base/mkiv/publ-ini.lua | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/tex/context/base/mkiv/publ-ini.lua b/tex/context/base/mkiv/publ-ini.lua index 07160ec57..ed3050f35 100644 --- a/tex/context/base/mkiv/publ-ini.lua +++ b/tex/context/base/mkiv/publ-ini.lua @@ -2361,10 +2361,26 @@ do local citevariants = { } publications.citevariants = citevariants + local function btxvalidcitevariant(dataset,variant) + local citevariant = rawget(citevariants,variant) + if citevariant then + return variant, citevariant + end + local variant = specifications[dataset].types[variant] + if variant then + citevariant = rawget(citevariants,variant) + end + if citevariant then + return variant, citevariant + end + return "default", citevariants.default + end + local function btxhandlecite(specification) local dataset = specification.dataset or v_default local reference = specification.reference local variant = specification.variant + -- if not variant or variant == "" then variant = "default" end @@ -2403,7 +2419,10 @@ do -- ctx_btxsetdataset(dataset) -- - citevariants[variant](specification) -- we always fall back on default + local variant, citevariant = btxvalidcitevariant(dataset,variant) + specification.variant = variant -- the used one + -- + citevariant(specification) -- we always fall back on default end local function btxhandlenocite(specification) @@ -2745,11 +2764,15 @@ do local function simplegetter(first,last,field,specification) local value = first[field] if value then - ctx_btxsetfirst(value) - if last then - ctx_btxsetsecond(last[field]) + if type(value) == "string" then + ctx_btxsetfirst(value) + if last then + ctx_btxsetsecond(last[field]) + end + return true + else + report("missing data type definition for %a",field) end - return true end end |