]> luflow.net public git repositories - flow-web.git/blob - static/highlight/es/languages/apache.js
Initial commit.
[flow-web.git] / static / highlight / es / languages / apache.js
1 /*! `apache` grammar compiled for Highlight.js 11.11.1 */
2 var hljsGrammar = (function () {
3 'use strict';
4
5 /*
6 Language: Apache config
7 Author: Ruslan Keba <rukeba@gmail.com>
8 Contributors: Ivan Sagalaev <maniac@softwaremaniacs.org>
9 Website: https://httpd.apache.org
10 Description: language definition for Apache configuration files (httpd.conf & .htaccess)
11 Category: config, web
12 Audit: 2020
13 */
14
15 /** @type LanguageFn */
16 function apache(hljs) {
17 const NUMBER_REF = {
18 className: 'number',
19 begin: /[$%]\d+/
20 };
21 const NUMBER = {
22 className: 'number',
23 begin: /\b\d+/
24 };
25 const IP_ADDRESS = {
26 className: "number",
27 begin: /\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}(:\d{1,5})?/
28 };
29 const PORT_NUMBER = {
30 className: "number",
31 begin: /:\d{1,5}/
32 };
33 return {
34 name: 'Apache config',
35 aliases: [ 'apacheconf' ],
36 case_insensitive: true,
37 contains: [
38 hljs.HASH_COMMENT_MODE,
39 {
40 className: 'section',
41 begin: /<\/?/,
42 end: />/,
43 contains: [
44 IP_ADDRESS,
45 PORT_NUMBER,
46 // low relevance prevents us from claming XML/HTML where this rule would
47 // match strings inside of XML tags
48 hljs.inherit(hljs.QUOTE_STRING_MODE, { relevance: 0 })
49 ]
50 },
51 {
52 className: 'attribute',
53 begin: /\w+/,
54 relevance: 0,
55 // keywords aren’t needed for highlighting per se, they only boost relevance
56 // for a very generally defined mode (starts with a word, ends with line-end
57 keywords: { _: [
58 "order",
59 "deny",
60 "allow",
61 "setenv",
62 "rewriterule",
63 "rewriteengine",
64 "rewritecond",
65 "documentroot",
66 "sethandler",
67 "errordocument",
68 "loadmodule",
69 "options",
70 "header",
71 "listen",
72 "serverroot",
73 "servername"
74 ] },
75 starts: {
76 end: /$/,
77 relevance: 0,
78 keywords: { literal: 'on off all deny allow' },
79 contains: [
80 {
81 scope: "punctuation",
82 match: /\\\n/
83 },
84 {
85 className: 'meta',
86 begin: /\s\[/,
87 end: /\]$/
88 },
89 {
90 className: 'variable',
91 begin: /[\$%]\{/,
92 end: /\}/,
93 contains: [
94 'self',
95 NUMBER_REF
96 ]
97 },
98 IP_ADDRESS,
99 NUMBER,
100 hljs.QUOTE_STRING_MODE
101 ]
102 }
103 }
104 ],
105 illegal: /\S/
106 };
107 }
108
109 return apache;
110
111 })();
112 ;
113 export default hljsGrammar;