summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/scripts/arara/rules/detex.yaml
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2020-04-10 22:00:34 +0000
committerKarl Berry <karl@freefriends.org>2020-04-10 22:00:34 +0000
commit993a56dc5ce732dfd560a3d411d970709e732080 (patch)
tree0be74e078fbfb126531e9983b39e07be3100635c /Master/texmf-dist/scripts/arara/rules/detex.yaml
parent9ebef863fbd274ccc04480e1f12b7ce385c739c8 (diff)
arara
git-svn-id: svn://tug.org/texlive/trunk@54640 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/scripts/arara/rules/detex.yaml')
-rw-r--r--Master/texmf-dist/scripts/arara/rules/detex.yaml82
1 files changed, 82 insertions, 0 deletions
diff --git a/Master/texmf-dist/scripts/arara/rules/detex.yaml b/Master/texmf-dist/scripts/arara/rules/detex.yaml
new file mode 100644
index 00000000000..d90d779d6a9
--- /dev/null
+++ b/Master/texmf-dist/scripts/arara/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;
+ }
+