diff options
Diffstat (limited to 'Master/texmf-dist/tex/context/base/publ-dat.lua')
-rw-r--r-- | Master/texmf-dist/tex/context/base/publ-dat.lua | 46 |
1 files changed, 43 insertions, 3 deletions
diff --git a/Master/texmf-dist/tex/context/base/publ-dat.lua b/Master/texmf-dist/tex/context/base/publ-dat.lua index b463064ca53..5e255029a48 100644 --- a/Master/texmf-dist/tex/context/base/publ-dat.lua +++ b/Master/texmf-dist/tex/context/base/publ-dat.lua @@ -24,8 +24,9 @@ end local chardata = characters.data local lowercase = characters.lower -local lower, gsub, concat = string.lower, string.gsub, table.concat -local next, type = next, type +local lower, gsub, find = string.lower, string.gsub, string.find +local concat = table.concat +local next, type, rawget = next, type, rawget local utfchar = utf.char local lpegmatch, lpegpatterns = lpeg.match, lpeg.patterns local textoutf = characters and characters.tex.toutf @@ -73,6 +74,42 @@ local defaultshortcuts = { dec = "12", } +local l_splitter = lpeg.tsplitat("+") +local d_splitter = lpeg.splitat ("+") + +function publications.parenttag(dataset,tag) + if find(tag,"%+") then + local tags = lpegmatch(l_splitter,tag) + local parent = tags[1] + local luadata = datasets[dataset].luadata + local first = luadata[parent] + if first then + local combined = first.combined + if not combined then + combined = { } + first.combined = combined + end + -- add new ones but only once + for i=2,#tags do + local tag = tags[i] + for j=1,#combined do + if combined[j] == tag then + tag = false + end + end + if tag then + local entry = luadata[tag] + if entry then + combined[#combined+1] = tag + end + end + end + return parent + end + end + return tag +end + function publications.new(name) publicationsstats.nofdatasets = publicationsstats.nofdatasets + 1 local dataset = { @@ -95,6 +132,9 @@ function publications.new(name) userdata = false, }, } + -- we delay details till we need it (maybe we just delay the + -- individual fields but that is tricky as there can be some + -- depedencies) setmetatableindex(dataset,function(t,k) -- will become a plugin if k == "details" and publications.enhance then @@ -150,7 +190,7 @@ local filter_2 = Cs( ) -- Currently we expand shortcuts and for large ones (like the acknowledgements --- in tugboat.bib this is not that efficient. However, eventually strings get +-- in tugboat.bib) this is not that efficient. However, eventually strings get -- hashed again. local function do_shortcut(key,value,dataset) |