blob: 25bfe9f5018805b0bb451cb428d657770a7f3905 (
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
|
!config
# Arara, the cool TeX automation tool
# Copyright (c) 2022, Island of TeX
# All rights reserved.
#
# This rule is part of arara.
identifier: knitr
name: knitr
authors:
- Adam Liter
- Island of TeX
commands:
- name: knitr
command: >
@{
elements = [];
if (!tangle.isEmpty()) elements.add('tangle = ' + tangle[0]);
if (!quiet.isEmpty()) elements.add('quiet = ' + quiet[0]);
out = output.isEmpty() ? 'NULL' : '"' + output[0] + '"';
elements.add('envir = ' + envir[0]);
elements.add('encoding = ' + encoding[0]);
return getCommand('Rscript', '-e',
'library(knitr); knit("' + reference.getName() + '", ' +
'output = ' + out + ', ' + String.join(', ', elements) + ')');
}
arguments:
- identifier: output
flag: >
@{
return parameters.output;
}
- identifier: tangle
flag: >
@{
if(isTrue(parameters.tangle) && !parameters.containsKey('output')) {
throwError('If you want to tangle the document, specify an output file.');
}
else {
isTrue(parameters.tangle, 'TRUE', 'FALSE')
}
}
- identifier: quiet
flag: >
@{
isTrue(parameters.quiet, 'TRUE', 'FALSE')
}
- identifier: envir
flag: >
@{
return parameters.envir;
}
default: 'parent.frame()'
- identifier: encoding
flag: >
@{
return parameters.encoding;
}
default: 'getOption("encoding")'
|