mirror of
https://github.com/discourse/discourse.git
synced 2024-12-11 22:04:03 +08:00
14 lines
932 B
JavaScript
14 lines
932 B
JavaScript
hljs.registerLanguage("accesslog",(()=>{"use strict";function e(e){
|
|
return e?"string"==typeof e?e:e.source:null}function n(...n){
|
|
return n.map((n=>e(n))).join("")}function a(...n){
|
|
return"("+n.map((n=>e(n))).join("|")+")"}return e=>{
|
|
const l=["GET","POST","HEAD","PUT","DELETE","CONNECT","OPTIONS","PATCH","TRACE"]
|
|
;return{name:"Apache Access Log",contains:[{className:"number",
|
|
begin:/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}(:\d{1,5})?\b/,relevance:5},{
|
|
className:"number",begin:/\b\d+\b/,relevance:0},{className:"string",
|
|
begin:n(/"/,a(...l)),end:/"/,keywords:l,illegal:/\n/,relevance:5,contains:[{
|
|
begin:/HTTP\/[12]\.\d'/,relevance:5}]},{className:"string",
|
|
begin:/\[\d[^\]\n]{8,}\]/,illegal:/\n/,relevance:1},{className:"string",
|
|
begin:/\[/,end:/\]/,illegal:/\n/,relevance:0},{className:"string",
|
|
begin:/"Mozilla\/\d\.\d \(/,end:/"/,illegal:/\n/,relevance:3},{
|
|
className:"string",begin:/"/,end:/"/,illegal:/\n/,relevance:0}]}}})()); |