summaryrefslogtreecommitdiff
path: root/tex/context/base/node-par.lua
blob: 7dd95ea5daa7d684e90288ff3436105da8e5b296 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
if not modules then modules = { } end modules ['node-par'] = {
    version   = 1.001,
    comment   = "companion to node-par.lua",
    author    = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
    copyright = "PRAGMA ADE / ConTeXt Development Team",
    license   = "see context related readme files"
}

parbuilders              = parbuilders or { }
parbuilders.constructors = parbuilders.constructors or { }
parbuilders.names        = parbuilders.names or { }
parbuilders.attribute    = attributes.numbers['parbuilder'] or 999

input.storage.register(false, "parbuilders.names", parbuilders.names, "parbuilders.names")

-- store parbuilders.names

function parbuilders.register(name,attribute)
    parbuilders.names[attribute] = name
end

function parbuilders.main(head,interupted_by_display)
    local attribute = node.has_attribute(head,parbuilders.attribute)
    if attribute then
        local constructor = parbuilders.names[attribute]
        if constructor then
            return parbuilders.constructors[constructor](head,interupted_by_display)
        end
    end
    return false
end

-- just for testing

function parbuilders.constructors.default(head,ibd)
    return false
end

-- also for testing (no surrounding spacing done)

function parbuilders.constructors.oneline(head,ibd)
    return node.hpack(head)
end