diff options
Diffstat (limited to 'Master/texmf-dist/scripts/arara/rules/arara-rule-detex.yaml')
-rw-r--r-- | Master/texmf-dist/scripts/arara/rules/arara-rule-detex.yaml | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/Master/texmf-dist/scripts/arara/rules/arara-rule-detex.yaml b/Master/texmf-dist/scripts/arara/rules/arara-rule-detex.yaml new file mode 100644 index 00000000000..94fa359f833 --- /dev/null +++ b/Master/texmf-dist/scripts/arara/rules/arara-rule-detex.yaml @@ -0,0 +1,81 @@ +!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.getName()); + if (output.isEmpty()) { + return c; + } + else { + p = unsafelyExecuteSystemCommand(c); + if (p.first == 0) { + return writeToFile(toFile(output[0]), 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; + } |