summaryrefslogtreecommitdiff
path: root/support/arara/scripts/rules/arara-rule-pdfcrop.yaml
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2021-02-27 03:01:43 +0000
committerNorbert Preining <norbert@preining.info>2021-02-27 03:01:43 +0000
commit4e6fb7c03bc033485887a99d2ffeca70ef8c0644 (patch)
tree5a337396041659a71d6da3f68367402d5c4e7dfe /support/arara/scripts/rules/arara-rule-pdfcrop.yaml
parent8b1159ba65d4003e969141fb034abbdc19e27c4b (diff)
CTAN sync 202102270301
Diffstat (limited to 'support/arara/scripts/rules/arara-rule-pdfcrop.yaml')
-rw-r--r--support/arara/scripts/rules/arara-rule-pdfcrop.yaml132
1 files changed, 132 insertions, 0 deletions
diff --git a/support/arara/scripts/rules/arara-rule-pdfcrop.yaml b/support/arara/scripts/rules/arara-rule-pdfcrop.yaml
new file mode 100644
index 0000000000..8ad93fd513
--- /dev/null
+++ b/support/arara/scripts/rules/arara-rule-pdfcrop.yaml
@@ -0,0 +1,132 @@
+!config
+# Arara, the cool TeX automation tool
+# Copyright (c) 2020, Island of TeX
+# All rights reserved.
+#
+# This rule is part of arara.
+identifier: pdfcrop
+name: PDFCrop
+authors:
+- Island of TeX
+commands:
+- name: The cropping tool
+ command: >
+ @{
+ base = getBasename(reference.getName());
+ input = base.concat('.pdf');
+ return getCommand('pdfcrop', verbose, debug, engine,
+ margins, clip, hires, ini, restricted, papersize,
+ resolution, bbox, uncompress, options, input, output);
+ }
+arguments:
+- identifier: output
+ flag: >
+ @{
+ return isEmpty(parameters.output,
+ getBasename(reference.getName()).
+ concat('-crop.pdf'),
+ parameters.output);
+ }
+ default: ''
+- identifier: verbose
+ flag: >
+ @{
+ return isTrue(parameters.verbose, '--verbose', '--noverbose');
+ }
+- identifier: debug
+ flag: >
+ @{
+ return isTrue(parameters.debug, '--debug', '--nodebug');
+ }
+- identifier: engine
+ flag: >
+ @{
+ engines = [ 'pdftex', 'xetex', 'luatex' ];
+ if (engines.contains(parameters.engine)) {
+ return '--'.concat(parameters.engine);
+ }
+ else {
+ throwError('The provided engine is invalid.');
+ }
+ }
+- identifier: margins
+ flag: >
+ @{
+ if (isList(parameters.margins)) {
+ if (parameters.margins.size() != 4) {
+ throwError('Margins require 4 elements.');
+ }
+ else {
+ ms = [];
+ foreach (m : parameters.margins)
+ ms.add(m.toString());
+ return [ '--margins', String.join(' ', ms) ];
+ }
+ }
+ else {
+ throwError('I was expecting a list.');
+ }
+ }
+- identifier: clip
+ flag: >
+ @{
+ return isTrue(parameters.clip, '--clip', '--noclip');
+ }
+- identifier: hires
+ flag: >
+ @{
+ return isTrue(parameters.hires, '--hires', '--nohires');
+ }
+- identifier: ini
+ flag: >
+ @{
+ return isTrue(parameters.ini, '--ini', '--noini');
+ }
+- identifier: restricted
+ flag: >
+ @{
+ return isTrue(parameters.restricted, '--restricted');
+ }
+- identifier: papersize
+ flag: >
+ @{
+ return [ '--papersize', parameters.papersize ];
+ }
+- identifier: resolution
+ flag: >
+ @{
+ return [ '--resolution', parameters.resolution ];
+ }
+- identifier: bbox
+ flag: >
+ @{
+ if (isList(parameters.bbox)) {
+ if (parameters.bbox.size() != 4) {
+ throwError('Bounding box require 4 elements.');
+ }
+ else {
+ ms = [];
+ foreach (m : parameters.bbox)
+ ms.add(m.toString());
+ return [ '--margins', String.join(' ', ms) ];
+ }
+ }
+ else {
+ throwError('I was expecting a list.');
+ }
+ }
+- identifier: uncompress
+ flag: >
+ @{
+ return isTrue(parameters.uncompress, '--uncompress');
+ }
+- identifier: options
+ flag: >
+ @{
+ if (isList(parameters.options)) {
+ return parameters.options;
+ }
+ else {
+ throwError('I was expecting a list of options.');
+ }
+ }