Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F9696147
apache.js
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Subscribers
None
apache.js
View Options
/*
Language: Apache config
Author: Ruslan Keba <rukeba@gmail.com>
Contributors: Ivan Sagalaev <maniac@softwaremaniacs.org>
Website: https://httpd.apache.org
Description: language definition for Apache configuration files (httpd.conf & .htaccess)
Category: common, config
Audit: 2020
*/
/** @type LanguageFn */
function
apache
(
hljs
)
{
const
NUMBER_REF
=
{
className
:
'number'
,
begin
:
/[$%]\d+/
};
const
NUMBER
=
{
className
:
'number'
,
begin
:
/\d+/
};
const
IP_ADDRESS
=
{
className
:
"number"
,
begin
:
/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}(:\d{1,5})?/
};
const
PORT_NUMBER
=
{
className
:
"number"
,
begin
:
/:\d{1,5}/
};
return
{
name
:
'Apache config'
,
aliases
:
[
'apacheconf'
],
case_insensitive
:
true
,
contains
:
[
hljs
.
HASH_COMMENT_MODE
,
{
className
:
'section'
,
begin
:
/<\/?/
,
end
:
/>/
,
contains
:
[
IP_ADDRESS
,
PORT_NUMBER
,
// low relevance prevents us from claming XML/HTML where this rule would
// match strings inside of XML tags
hljs
.
inherit
(
hljs
.
QUOTE_STRING_MODE
,
{
relevance
:
0
})
]
},
{
className
:
'attribute'
,
begin
:
/\w+/
,
relevance
:
0
,
// keywords aren’t needed for highlighting per se, they only boost relevance
// for a very generally defined mode (starts with a word, ends with line-end
keywords
:
{
nomarkup
:
'order deny allow setenv rewriterule rewriteengine rewritecond documentroot '
+
'sethandler errordocument loadmodule options header listen serverroot '
+
'servername'
},
starts
:
{
end
:
/$/
,
relevance
:
0
,
keywords
:
{
literal
:
'on off all deny allow'
},
contains
:
[
{
className
:
'meta'
,
begin
:
/\s\[/
,
end
:
/\]$/
},
{
className
:
'variable'
,
begin
:
/[\$%]\{/
,
end
:
/\}/
,
contains
:
[
'self'
,
NUMBER_REF
]
},
IP_ADDRESS
,
NUMBER
,
hljs
.
QUOTE_STRING_MODE
]
}
}
],
illegal
:
/\S/
};
}
module
.
exports
=
apache
;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Aug 18, 7:07 PM (1 w, 3 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3442771
Attached To
rDWAPPS Web applications
Event Timeline
Log In to Comment