summaryrefslogtreecommitdiff
path: root/support/arara/scripts/rules/arara-rule-sage.yaml
blob: 3d1d4d97e92ad482d6bfaadf3ec48fc88a43a815 (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
!config
# Arara, the cool TeX automation tool
# Copyright (c) 2021, Island of TeX
# All rights reserved.
#
# This rule is part of arara.
identifier: sage
name: Sage
authors:
- Island of TeX
commands:
- name: The command line tool
  command: >
    @{
        base = getBasename(reference.getName());
        e = isList(extension) ? extension[0] : extension;
        input = base.concat('.').concat(e);
        return getCommand(program, command, dotsage,
                          options, input);
    }
arguments:
- identifier: program
  flag: >
    @{
        return parameters.program;
    }
  default: 'sage'
- identifier: extension
  flag: >
    @{
        exts = [ 'sage', 'py', 'spyx' ];
        if (exts.contains(parameters.extension)) {
            return parameters.extension;
        }
        else {
            throwError('The provided extension is invalid.');
        }
    }
  default: 'sage'
- identifier: command
  flag: >
    @{
        return [ '-c', parameters.command ];
    }
- identifier: dotsage
  flag: >
    @{
        return isFalse(parameters.dotsage, '--nodotsage');
    }
- identifier: options
  flag: >
    @{
        if (isList(parameters.options)) {
            return parameters.options;
        }
        else {
            throwError('I was expecting a list of options.');
        }
    }