summaryrefslogtreecommitdiff
path: root/support/arara/scripts/rules/arara-rule-indent.yaml
blob: accfa3b2d779c16ddc7f5814345aab3189c51189 (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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
!config
# Arara, the cool TeX automation tool
# Copyright (c) 2021, Island of TeX
# All rights reserved.
#
# This rule is part of arara.
identifier: indent
name: Indent
authors:
- Chris Hughes
- Island of TeX
commands:
- name: The latexindent.pl script
  command: >
    @{
        return getCommand('latexindent', silent, trace, screenlog, lines,
               settings, cruft, overwrite, output, reference.getName(),
               modifylinebreaks, check, replacement, options, logfile);
    }
arguments:
- identifier: silent
  flag: >
    @{
        isTrue(parameters.silent, '-s')
    }
- identifier: overwrite
  flag: >
    @{
        isTrue(parameters.overwrite, '-w')
    }
- identifier: trace
  flag: >
    @{
      if ([ 'default', 'complete' ].contains(parameters.trace)) {
          return isTrue(parameters.trace == 'default', '-t', '-tt');
      }
      else {
          throwError('You provided an invalid value for trace.');
      }
    }
- identifier: screenlog
  flag: >
    @{
        isTrue(parameters.screenlog, '-sl')
    }
- identifier: modifylinebreaks
  flag: >
    @{
        isTrue(parameters.modifylinebreaks, '-m')
    }
- identifier: settings
  flag: >
    @{
      check = parameters.containsKey('where');
      location = check ? parameters.where : '';
      if ([ 'local', 'onlydefault' ].contains(parameters.settings)) {
          return isTrue(parameters.settings == 'local', isTrue(check,
                 '-l='.concat(location), '-l'), '-d');
      }
      else {
          throwError('You provided an invalid value for settings.');
      }
    }
- identifier: cruft
  flag: >
    @{
        '-c='.concat(parameters.cruft)
    }
- identifier: logfile
  flag: >
    @{
        [ '-g', parameters.logfile ]
    }
- identifier: output
  flag: >
    @{
        [ '-o', parameters.output ]
    }
- identifier: lines
  flag: >
    @{
      [ '--lines', parameters.lines ]
    }
- identifier: where
  flag: >
    @{
      check = parameters.containsKey('settings');
      setting = check ? parameters.settings : '';
      if (setting != 'local') {
          throwError('This key requires a local setting.');
      }
    }
- identifier: replacement
  flag: >
    @{
      opts = [ 'full' : '-r', 'noverb' : '-rv', 'noindent' : '-rr' ];
      if (opts.keySet().contains(parameters.replacement)) {
          return opts[parameters.replacement];
      }
      else {
          throwError('You provided an invalid value for replacement.');
      }
    }
- identifier: check
  flag: >
    @{
      opts = [ 'standard' : '--check', 'verbose' : '--checkv' ];
      if (opts.keySet().contains(parameters.check)) {
          return opts[parameters.check];
      }
      else {
          throwError('You provided an invalid value for check.');
      }
    }
- identifier: options
  flag: >
    @{
        if (isList(parameters.options)) {
            return parameters.options;
        }
        else {
            throwError('I was expecting a list of options.');
        }
    }