-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathrpm-specfile.js
77 lines (72 loc) · 2.41 KB
/
rpm-specfile.js
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
/**
* highlight.js RPM spec file syntax highlighting definition
*
* @see https://github.com/highlightjs/highlight.js
*
* @package highlightjs-rpm-specfile
* @author Ryan Lerch <rlerch@redhat.com>, Neal Gompa <ngompa13@gmail.com>
* @since 2019-07-08
* @license magnet:?xt=urn:btih:c80d50af7d3db9be66a4d0a86db0286e4fd33292&dn=bsd-3-clause.txt BSD-3-Clause
*
* Language: rpm-specfile
* Description: RPM Specfile
* Author: Ryan Lerch <rlerch@redhat.com>
* Contributors: Neal Gompa <ngompa13@gmail.com>
* Category: config
* Requires: bash.js
* Website: https://rpm.org/
**/
var module = module ? module : {}; // shim for browser use
function hljsDefineRpmSpecfile(hljs) {
return {
name: "rpm-specfile",
aliases: ['rpm', 'spec', 'rpm-spec', 'specfile'],
contains: [
hljs.COMMENT('%dnl'),
hljs.HASH_COMMENT_MODE,
hljs.QUOTE_STRING_MODE,
{
className: "type",
begin: /^(Name|BuildRequires|BuildConflicts|Version|Release|Epoch|Summary|Group|License|Packager|Vendor|Icon|URL|Distribution|Prefix|Patch[0-9]*|Source[0-9]*|Requires\(?[a-z]*\)?|[a-zA-Z]+Req|Obsoletes|Recommends|Suggests|Supplements|Enhances|Provides|Conflicts|RemovePathPostfixes|Build[a-zA-Z]+|[a-zA-Z]+Arch|Auto[a-zA-Z]+)(:)/,
},
{
className: "keyword",
begin: /(%)(?:package|prep|generate_buildrequires|sourcelist|patchlist|build|description|install|verifyscript|clean|changelog|check|pre[a-z]*|post[a-z]*|trigger[a-z]*|files)/,
},
{
className: "link",
begin: /(%)(ifarch|ifnarch|ifos|ifnos|if|elifarch|elifos|elif|else|endif)/,
},
{
className: "link",
begin: /%\{_/,
end: /}/,
},
{
className: "symbol",
begin: /%\{\?/,
end: /}/,
},
{
className: "link font-weight-bold",
begin: /%\{/,
end: /}/,
},
{
className: "link font-weight-bold",
begin: /%/,
end: /[ \t\n]/
},
{
className: "symbol font-weight-bold",
begin: /^\* (Mon|Tue|Wed|Thu|Fri|Sat|Sun)/,
end: /$/,
},
]
};
}
module.exports = function(hljs) {
hljs.registerLanguage('rpm-specfile', hljsDefineRpmSpecfile);
};
module.exports.definer = hljsDefineRpmSpecfile;
/* @license-end */