54 lines
1.2 KiB
JavaScript
54 lines
1.2 KiB
JavaScript
module.exports = function(hljs) {
|
||
var COMMAND1 = {
|
||
className: 'command',
|
||
begin: '\\\\[a-zA-Zа-яА-я]+[\\*]?'
|
||
};
|
||
var COMMAND2 = {
|
||
className: 'command',
|
||
begin: '\\\\[^a-zA-Zа-яА-я0-9]'
|
||
};
|
||
var SPECIAL = {
|
||
className: 'special',
|
||
begin: '[{}\\[\\]\\&#~]',
|
||
relevance: 0
|
||
};
|
||
|
||
return {
|
||
contains: [
|
||
{ // parameter
|
||
begin: '\\\\[a-zA-Zа-яА-я]+[\\*]? *= *-?\\d*\\.?\\d+(pt|pc|mm|cm|in|dd|cc|ex|em)?',
|
||
returnBegin: true,
|
||
contains: [
|
||
COMMAND1, COMMAND2,
|
||
{
|
||
className: 'number',
|
||
begin: ' *=', end: '-?\\d*\\.?\\d+(pt|pc|mm|cm|in|dd|cc|ex|em)?',
|
||
excludeBegin: true
|
||
}
|
||
],
|
||
relevance: 10
|
||
},
|
||
COMMAND1, COMMAND2,
|
||
SPECIAL,
|
||
{
|
||
className: 'formula',
|
||
begin: '\\$\\$', end: '\\$\\$',
|
||
contains: [COMMAND1, COMMAND2, SPECIAL],
|
||
relevance: 0
|
||
},
|
||
{
|
||
className: 'formula',
|
||
begin: '\\$', end: '\\$',
|
||
contains: [COMMAND1, COMMAND2, SPECIAL],
|
||
relevance: 0
|
||
},
|
||
hljs.COMMENT(
|
||
'%',
|
||
'$',
|
||
{
|
||
relevance: 0
|
||
}
|
||
)
|
||
]
|
||
};
|
||
}; |