summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/scripts/arara/rules/indent.yaml
blob: 8390aa672e81fcefcab72e19bdb51e7a4ebeedbe (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
!config
# Arara, the cool TeX automation tool
# Copyright (c) 2018, Paulo Roberto Massa Cereda 
# All rights reserved.
#
# This rule is part of arara.
identifier: indent
name: Indent
authors:
- Chris Hughes
- Paulo Cereda
commands:
- name: The latexindent.pl script
  command: >
    @{
        return getCommand('latexindent', silent, trace, ttrace, screenlog,
               settings, cruft, overwrite, output, file, modifylinebreaks,
               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: where
  flag: >
    @{
      check = parameters.containsKey('settings');
      setting = check ? parameters.settings : '';
      if (setting != 'local') {
          throwError('This key requires a local setting.');
      }
    }
- identifier: options
  flag: >
    @{
        if (isList(parameters.options)) {
            return parameters.options;
        }
        else {
            throwError('I was expecting a list of options.');
        }
    }