grph-epd.lua /size: 1778 b    last modification: 2021-10-28 13:50
1if not modules then modules = { } end modules ['grph-epd'] = {
2    version   = 1.001,
3    comment   = "companion to grph-epd.mkiv",
4    author    = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
5    copyright = "PRAGMA ADE / ConTeXt Development Team",
6    license   = "see context related readme files"
7}
8
9local variables = interfaces.variables
10local settings_to_hash = utilities.parsers.settings_to_hash
11local codeinjections = backends.pdf.codeinjections
12
13local trace  = false  trackers.register("figures.merging", function(v) trace = v end)
14
15local report = logs.reporter("backend","merging")
16
17local function mergegoodies(optionlist)
18    local options = settings_to_hash(optionlist)
19    local yes     = options[variables.yes]
20    local all     = options[variables.all]
21    if next(options) then
22        report("% t",table.sortedkeys(options))
23    end
24    if all or yes or options[variables.reference] then
25        codeinjections.mergereferences()
26    end
27    if all or options[variables.comment] then
28        codeinjections.mergecomments()
29    end
30    if all or yes or options[variables.bookmark] then
31        codeinjections.mergebookmarks()
32    end
33    if all or options[variables.field] then
34        codeinjections.mergefields()
35    end
36    if all or options[variables.layer] then
37        codeinjections.mergeviewerlayers()
38    end
39    codeinjections.flushmergelayer()
40end
41
42function figures.mergegoodies(optionlist)
43    -- todo: we can use runlocal instead
44    context.stepwise(function()
45        -- we use stepwise because we might need to define symbols
46        -- for stamps that have no default appearance
47        mergegoodies(optionlist)
48    end)
49end
50
51interfaces.implement {
52    name      = "figure_mergegoodies",
53    actions   = figures.mergegoodies,
54    arguments = "string"
55}
56