summaryrefslogtreecommitdiff
path: root/tex/context/base/publ-reg.lua
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/publ-reg.lua')
-rw-r--r--tex/context/base/publ-reg.lua31
1 files changed, 24 insertions, 7 deletions
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