summaryrefslogtreecommitdiff
path: root/context/data/textadept/context/modules/textadept-context-types.lua
blob: 552aa4e5f2c7a58cbc915597bd25060cb06127ab (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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
local info = {
    version   = 1.002,
    comment   = "filetypes for textadept for context/metafun",
    author    = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
    copyright = "PRAGMA ADE / ConTeXt Development Team",
    license   = "see context related readme files",
}

-- todo: add the same ones as we have in scite

local lexer   = require("scite-context-lexer")
local context = lexer.context
local install = context.install

-- autopdf takes long to stop (weird, not in scite)

-- WIN32 and 'start "" "%e.pdf"' or OSX and 'open "%e.pdf"' or 'xdg-open "%e.pdf"',

local quitter = function(output)
    return find(output,"%? +$") and true or false, "see message above"
end

local listing = {
    command = [[mtxrun --autogenerate --script context --extra=listing --scite --compact "%basename%"]], -- --autopdf
    quitter = quitter,
}

install {
    lexer    = "scite-context-lexer-tex",
    suffixes = {
        "tex",
        "mkii",
        "mkiv", "mkvi", "mkix", "mkxi"
    },
    check    = {
        command = [[mtxrun --autogenerate --script check "%basename%"]],
        quitter = quitter,
    },
    process  = {
        command = [[mtxrun --autogenerate --script context "%basename%"]], --  --autopdf,
        quitter = quitter,
    },
    listing  = listing,
    generate = [[mtxrun --generate]],
    fonts    = [[mtxrun --script fonts --reload --force]],
    clear    = [[mtxrun --script cache --erase]],
    purge    = [[mtxrun --script context --purgeall]],
    preview  = [[]],
    logfile  = [[]],
    arrange  = [[]],
    unicodes = [[]],
    setter   = function(lexer)
        -- whatever
    end,
}

install {
    lexer    = "scite-context-lexer-xml",
    suffixes = {
        "xml", "xsl", "xsd", "fo", "dtd", "xslt",
        "lmx", "exa", "ctx", "export",
        "rlb", "rlg", "rlv", "rng",
        "xfdf",
        "htm", "html", "xhtml",
        "svg",
        "xul"
    },
    check    = [[tidy -quiet -utf8 -xml -errors "%basename%"]],
    process  = {
        command = [[mtxrun --autogenerate --script context "%basename%"]], --  --autopdf]],
        quitter = quitter,
    },
    listing  = listing,
    setter   = function(lexer)
        -- whatever
    end,
}

install {
    lexer    = "scite-context-lexer-mps",
    suffixes = {
        "mp", "mpx"
    },
    listing  = listing,
    setter   = function(lexer)
        -- whatever
    end,
}

install {
    lexer    = "scite-context-lexer-lua",
    suffixes = {
        "lua", "luc",
        "cld", "tuc", "luj", "lum", "tma", "lfg", "luv", "lui"
    },
    check    = [[mtxrun --autogenerate --script "%basename%"]],
    process  = [[mtxrun --autogenerate --script "%basename%"]],
    preview  = [[mtxrun --autogenerate --script "%basename%"]],
    listing  = listing,
    setter   = function(lexer)
        -- whatever
    end,
}

install {
    lexer    = "scite-context-lexer-txt",
    suffixes = {
        "txt"
    },
    listing  = listing,
    setter   = function(lexer)
        -- whatever
    end,
}

install {
    lexer    = "scite-context-lexer-pdf",
    suffixes = {
        "pdf"
    },
    encoding = "7-BIT-ASCII",
    setter   = function(lexer)
        -- whatever
    end,
}

install {
    lexer    = "scite-context-lexer-web",
    suffixes = {
        "w",
        "ww"
    },
    listing  = listing,
    setter   = function(lexer)
        -- whatever
    end,
}

install {
    lexer    = "scite-context-lexer-cpp",
    suffixes = {
        "h", "c",
        "hh", "cc",
        "hpp", "cpp",
        "hxx", "cxx"
    },
    listing  = listing,
    setter   = function(lexer)
        -- whatever
    end,
}

install {
    "scite-context-lexer-bibtex",
    suffixes = {
        "bib"
    },
    listing  = listing,
    setter   = function(lexer)
        -- whatever
    end,
}

install {
    "scite-context-lexer-sql",
    suffixes = {
        "sql"
    },
    listing  = listing,
    setter   = function(lexer)
        -- whatever
    end,
}