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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
|
!config
# Arara, the cool TeX automation tool
# Copyright (c) 2021, Island of TeX
# All rights reserved.
#
# This rule is part of arara.
identifier: bib2gls
name: Bib2Gls
authors:
- Island of TeX
commands:
- name: The Bib2Gls software
command: >
@{
if (!clean.isEmpty())
{
prefix = [];
if (isUnix()) {
prefix = [ 'rm', '-f', '-v' ];
}
else {
prefix = [ 'cmd', '/c', 'del' ];
}
base = getBasename(reference);
removals = [];
lines = readFromFile(base.concat('.').concat('aux'));
java.util.regex.Pattern resourcePattern =
java.util.regex.Pattern.compile(
"\\\\glsxtr@resource\\{.*\\}\\{([^\\}]+)\\}");
if (!trans.isEmpty())
{
if (trans[0] == getOriginalFile())
{
throwError('I cannot remove the main file reference.');
}
removals.add(getCommand(prefix, trans));
}
else
{
removals.add(getCommand(prefix, base.concat('.glg')));
}
foreach (line: lines)
{
matcher = resourcePattern.matcher(line);
if (matcher.matches())
{
removals.add(getCommand(prefix, matcher.group(1).concat('.glstex')));
}
}
return removals;
}
else
{
return getCommand('bib2gls', dir, trans, group, interpret,
breakspace, trimfields, recordcount, recordcountunit,
cite, verbose, merge, locale, uniscript, packages,
ignore, custom, mapformats, options,
getBasename(reference.getName()));
}
}
arguments:
- identifier: dir
flag: >
@{
return ['--dir', parameters.dir]
}
- identifier: trans
flag: >
@{
if ([ 'tex', 'ltx', 'cls', 'sty', 'bib',
'dtx', 'ins', 'def', 'ldf' ].contains(parameters.trans)) {
throwError('Forbidden transcript extension');
}
return ['--log-file', getBasename(reference.getName())+"."+parameters.trans]
}
- identifier: locale
flag: >
@{
return ['--locale', parameters.locale]
}
- identifier: group
flag: >
@{
isTrue(parameters.group, '--group', '--no-group')
}
- identifier: interpret
flag: >
@{
isTrue(parameters.interpret, '--interpret', '--no-interpret')
}
- identifier: breakspace
flag: >
@{
isTrue(parameters.breakspace, '--break-space', '--no-break-space')
}
- identifier: trimfields
flag: >
@{
isTrue(parameters.trimfields, '--trim-fields', '--no-trim-fields')
}
- identifier: recordcount
flag: >
@{
isTrue(parameters.recordcount, '--record-count', '--no-record-count')
}
- identifier: recordcountunit
flag: >
@{
isTrue(parameters.recordcountunit, '--record-count-unit',
'--no-record-count-unit')
}
- identifier: cite
flag: >
@{
isTrue(parameters.cite, '--cite-as-record', '--no-cite-as-record')
}
- identifier: verbose
flag: >
@{
isTrue(parameters.verbose, '--verbose', '--no-verbose')
}
- identifier: merge
flag: >
@{
isTrue(parameters.merge, '--merge-wrglossary-records',
'--no-merge-wrglossary-records')
}
- identifier: uniscript
flag: >
@{
isTrue(parameters.uniscript, '--support-unicode-script',
'--no-support-unicode-script')
}
- identifier: packages
flag: >
@{
if (isList(parameters.packages)) {
elements = [];
foreach (element : parameters.packages) {
elements.add('--packages');
elements.add(element);
}
return elements;
}
else {
throwError('I was expecting a list of package names.');
}
}
- identifier: ignore
flag: >
@{
if (isList(parameters.ignore)) {
elements = [];
foreach (element : parameters.ignore) {
elements.add('--ignore-packages');
elements.add(element);
}
return elements;
}
else {
throwError('I was expecting a list of package names.');
}
}
- identifier: custom
flag: >
@{
if (isList(parameters.custom)) {
elements = [];
foreach (element : parameters.custom) {
elements.add('--custom-packages');
elements.add(element);
}
return elements;
}
else {
throwError('I was expecting a list of package names.');
}
}
- identifier: mapformats
flag: >
@{
if (isList(parameters.mapformats)) {
elements = [];
foreach (element : parameters.mapformats) {
if (isList(element) && element.size() == 2) {
elements.add('--map-format');
elements.add(element.get(0) + ':' + element.get(1));
}
else {
throwError('I was expecting a map ' +
'format list [<key>, <value>] ');
}
}
return elements;
}
else {
throwError('I was expecting mapformats: [ [<key>, <value>], ' +
'..., [<key>, <value>] ].');
}
}
- identifier: options
flag: >
@{
if (isList(parameters.options)) {
return parameters.options;
}
else {
throwError('I was expecting a list of options.');
}
}
- identifier: clean
flag: >
@{
return isTrue(parameters.clean, 'true', '');
}
|