PageRenderTime 23ms CodeModel.GetById 11ms app.highlight 7ms RepoModel.GetById 2ms app.codeStats 0ms

/samples/scalate-presentation/src/highlight/languages/tex.js

http://github.com/scalate/scalate
JavaScript | 58 lines | 52 code | 1 blank | 5 comment | 0 complexity | 40840620c977a0f148fc6a05b05eb0b5 MD5 | raw file
 1/*
 2Language: TeX
 3Author: Vladimir Moskva <vladmos@gmail.com>
 4Website: http://fulc.ru/
 5*/
 6
 7hljs.LANGUAGES.tex = {
 8  defaultMode: {
 9    contains: ['parameter', 'command', 'special', 'formula', 'comment']
10  },
11  modes: [
12    {
13      className: 'parameter',
14      begin: '\\\\[a-zA-Zа-яА-я]+[\\*]? *= *-?\\d*\\.?\\d+(pt|pc|mm|cm|in|dd|cc|ex|em)?', end: '^',
15      returnBegin: true,
16      contains: ['command', 'number'],
17      noMarkup: true,
18      relevance: 10
19    },
20    {
21      className: 'command',
22      begin: '\\\\[a-zA-Zа-яА-я]+[\\*]?', end: '^',
23      relevance: 10
24    },
25    {
26      className: 'command',
27      begin: '\\\\[^a-zA-Zа-яА-я0-9]', end: '^',
28      relevance: 0
29    },
30    {
31      className: 'comment',
32      begin: '%', end: '$',
33      relevance: 0
34    },
35    {
36      className: 'special',
37      begin: '[{}\\[\\]\\&#~]', end: '^',
38      relevance: 0
39    },
40    {
41      className: 'formula',
42      begin: '\\$\\$', end: '\\$\\$',
43      contains: ['command', 'special'],
44      relevance: 0
45    },
46    {
47      className: 'formula',
48      begin: '\\$', end: '\\$',
49      contains: ['command', 'special'],
50      relevance: 0
51    },
52    {
53      className: 'number',
54      begin: ' *=', end: '-?\\d*\\.?\\d+(pt|pc|mm|cm|in|dd|cc|ex|em)?',
55      excludeBegin: true
56    }
57  ]
58};