strc-mat.lua /size: 1442 b    last modification: 2020-07-01 14:35
1if not modules then modules = { } end modules ['strc-mat'] = {
2    version   = 1.001,
3    comment   = "companion to strc-mat.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
9----- copytable  = table.copy
10
11local structures = structures
12
13local lists      = structures.lists
14local sections   = structures.sections
15local floats     = structures.floats
16local helpers    = structures.helpers
17local formulas   = structures.formulas -- not used but reserved
18
19----- context    = context
20----- simplify   = helpers.simplify
21
22-- maybe we want to do clever things with formulas, the store might go away
23
24-- local formuladata = { }
25--
26-- function formulas.store(data)
27--     formuladata[#formuladata+1] = data
28--     context(#formuladata)
29-- end
30--
31-- function formulas.current()
32--     return formuladata[#formuladata]
33-- end
34
35-- function formulas.simplify(entry)
36--     return simplify(copytable(entry or formuladata[#formuladata]))
37-- end
38
39function helpers.formulanumber(data,spec)
40    if data then
41        local formulanumber = data.formulanumber
42        if formulanumber then
43            sections.number(data,spec,"formulanumber","formulanumber",'number')
44        end
45    end
46end
47
48function lists.formulanumber(name,n,spec)
49    local result = lists.result
50    if result then
51        helpers.formulanumber(result[n])
52    end
53end
54