summaryrefslogtreecommitdiff
path: root/tex/context/base/publ-tra.lua
blob: 90bae67e932ea7ca770aed0254e03c2a45a8c8c2 (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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
if not modules then modules = { } end modules ['publ-tra'] = {
    version   = 1.001,
    comment   = "this module part of publication support",
    author    = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
    copyright = "PRAGMA ADE / ConTeXt Development Team",
    license   = "see context related readme files"
}

local sortedhash = table.sortedhash

local tracers        = { }
publications.tracers = tracers

local context = context
local NC, NR, bold = context.NC, context.NR, context.bold

publications.tracers.fields = table.sorted {
    "abstract",
    "address",
    "annotate",
    "author",
    "booktitle",
    "chapter",
    "comment",
    "country",
    "doi",
    "edition",
    "editor",
    "eprint",
    "howpublished",
    "institution",
    "isbn",
    "issn",
    "journal",
    "key",
    "keyword",
    "keywords",
    "language",
    "lastchecked",
    "month",
    "names",
    "note",
    "notes",
    "number",
    "organization",
    "pages",
    "publisher",
    "school",
    "series",
    "size",
    "title",
    "type",
    "url",
    "volume",
    "year",
    "nationality",
    "assignee",
    "bibnumber",
    "day",
    "dayfiled",
    "monthfiled",
    "yearfiled",
    "revision",
}

publications.tracers.citevariants = table.sorted {
    "author",
    "authoryear",
    "authoryears",
    "authornum",
    "year",
    "short",
    "serial",
    "key",
    "doi",
    "url",
    "type",
    "page",
    "none",
    "num",
}

publications.tracers.listvariants = table.sorted {
    "author",
    "editor",
    "artauthor",
}

publications.tracers.categories = table.sorted {
    "article",
    "book",
    "booklet",
    "conference",
    "inbook",
    "incollection",
    "inproceedings",
    "manual",
    "mastersthesis",
    "misc",
    "phdthesis",
    "proceedings",
    "techreport",
    "unpublished",
}

function tracers.showdatasetfields(name)
    if name and name ~= "" then
        local luadata = publications.datasets[name].luadata
        if next(luadata) then
            context.starttabulate { "|lT|lT|pT|" }
                NC() bold("tag")
                NC() bold("category")
                NC() bold("fields")
                NC() NR() context.FL() -- HL()
                for k, v in sortedhash(luadata) do
                    NC() context(k)
                    NC() context(v.category)
                    NC()
                    for k, v in sortedhash(v) do
                        if k ~= "details" and k ~= "tag" and k ~= "category" then
                            context("%s ",k)
                        end
                    end
                    NC() NR()
                end
            context.stoptabulate()
        end
    end
end

commands.showbtxdatasetfields = tracers.showdatasetfields