diff options
author | Hans Hagen <pragma@wxs.nl> | 2018-07-25 20:24:04 +0200 |
---|---|---|
committer | Context Git Mirror Bot <phg@phi-gamma.net> | 2018-07-25 20:24:04 +0200 |
commit | 669436bb34437aee17f1823836cbbb16c570a505 (patch) | |
tree | 3d8c61e22805ff719007c10a44a8de0417211b00 /tex/context/base/mkiv/back-exp.lua | |
parent | deab0bfe7f4be57121779e93bf291e518fda7cf3 (diff) | |
download | context-669436bb34437aee17f1823836cbbb16c570a505.tar.gz |
2018-07-25 19:49:00
Diffstat (limited to 'tex/context/base/mkiv/back-exp.lua')
-rw-r--r-- | tex/context/base/mkiv/back-exp.lua | 61 |
1 files changed, 59 insertions, 2 deletions
diff --git a/tex/context/base/mkiv/back-exp.lua b/tex/context/base/mkiv/back-exp.lua index 41e3cbbf8..28929bc57 100644 --- a/tex/context/base/mkiv/back-exp.lua +++ b/tex/context/base/mkiv/back-exp.lua @@ -2050,6 +2050,41 @@ do end +do + + local usedpublications = { } + local tagsindatasets = setmetatableindex("table") + local serialize = false + + function structurestags.setpublication(dataset,tag,rendering) + usedpublications[locatedtag("publication")] = { + dataset = dataset, + tag = tag, + rendering = rendering + } + tagsindatasets[dataset][tag] = true + if not serialize then + structures.tags.registerextradata("btx",function() + local t = { "<btxdata>"} + for dataset, used in sortedhash(tagsindatasets) do + t[#t+1] = publications.converttoxml(dataset,true,false,true,false,true) + end + t[#t+1] = "</btxdata>" + return concat(t,"\n") + end) + end + end + + function extras.publication(di,element,n,fulltag) + local hash = usedpublications[fulltag] + if hash then + setattribute(di,"dataset",hash.dataset) + setattribute(di,"tag",hash.tag) + end + end + +end + -- flusher do @@ -3840,6 +3875,22 @@ local htmltemplate = [[ local result = allcontent(tree,embedmath) -- embedfile is for testing + -- ugly but so be it: + + local extradata = structures.tags.getextradata() + if extradata then + local t = { "" } + t[#t+1] = "<extradata>" + for name, action in sortedhash(extradata) do + t[#t+1] = action() + end + t[#t+1] = "</extradata>" + t[#t+1] = "</document>" + result = gsub(result,"</document>",concat(t,"\n")) + end + + -- done with ugly + if onlyxml then os.remove(defaultfilename) @@ -3959,8 +4010,8 @@ local htmltemplate = [[ -- looking at identity is somewhat redundant as we also inherit from interaction -- at the tex end - local identity = interactions.general.getidentity() - local metadata = structures.tags.getmetadata() + local identity = interactions.general.getidentity() + local metadata = structures.tags.getmetadata() local specification = { name = usedname, @@ -4196,3 +4247,9 @@ implement { actions = structurestags.setlist, arguments = "integer" } + +implement { + name = "settagpublication", + actions = structurestags.setpublication, + arguments = "2 strings" +} |