summaryrefslogtreecommitdiff
path: root/support/arara/scripts/rules/detex.yaml
diff options
context:
space:
mode:
Diffstat (limited to 'support/arara/scripts/rules/detex.yaml')
-rw-r--r--support/arara/scripts/rules/detex.yaml82
1 files changed, 82 insertions, 0 deletions
diff --git a/support/arara/scripts/rules/detex.yaml b/support/arara/scripts/rules/detex.yaml
new file mode 100644
index 0000000000..d90d779d6a
--- /dev/null
+++ b/support/arara/scripts/rules/detex.yaml
@@ -0,0 +1,82 @@
+!config
+# Arara, the cool TeX automation tool
+# Copyright (c) 2020, Island of TeX
+# All rights reserved.
+#
+# This rule is part of arara.
+identifier: detex
+name: DeTeX
+authors:
+- Island of TeX
+commands:
+- name: The DeTeX program
+ command: >
+ @{
+ c = getCommand('detex', references, mode, follow, math, spaces,
+ words, environments, reference);
+ if (isEmpty(output)) {
+ return c;
+ }
+ else {
+ p = unsafelyExecuteSystemCommand(c);
+ if (p.first == 0) {
+ return writeToFile(toFile(output), p.second, false);
+ }
+ else {
+ return false;
+ }
+ }
+ }
+arguments:
+- identifier: references
+ flag: >
+ @{
+ return isTrue(parameters.references, '-c');
+ }
+- identifier: mode
+ flag: >
+ @{
+ modes = [ 'latex' : '-l', 'tex' : '-t' ];
+ if (modes.keySet().contains(parameters.mode)) {
+ return modes.get(parameters.mode);
+ }
+ else {
+ throwError('I was expecting either the TeX or LaTeX mode.');
+ }
+ }
+- identifier: follow
+ flag: >
+ @{
+ return isFalse(parameters.follow, '-n');
+ }
+- identifier: math
+ flag: >
+ @{
+ return isFalse(parameters.math, '-r');
+ }
+- identifier: spaces
+ flag: >
+ @{
+ return isTrue(parameters.spaces, '-s');
+ }
+- identifier: words
+ flag: >
+ @{
+ return isTrue(parameters.words, '-w');
+ }
+- identifier: environments
+ flag: >
+ @{
+ if (!isList(parameters.environments)) {
+ throwError('I was expecting a list of environments.');
+ }
+ else {
+ return [ '-e', String.join(',', parameters.environments) ];
+ }
+ }
+- identifier: output
+ flag: >
+ @{
+ return parameters.output;
+ }
+