From: Luca Toscano Date: Wed, 13 Sep 2017 09:54:37 +0000 (+0000) Subject: docs: allow Directive/ naming in prettify.js/css X-Git-Tag: 2.5.0-alpha~132 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b3945e5e1a1ad04c7859ee58b06923937253f227;p=apache docs: allow Directive/ naming in prettify.js/css Creditis to Humbedooh for all the work. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1808224 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/docs/manual/style/css/prettify.css b/docs/manual/style/css/prettify.css index 012a8e9ff2..841bf0807f 100644 --- a/docs/manual/style/css/prettify.css +++ b/docs/manual/style/css/prettify.css @@ -119,3 +119,7 @@ pre.lang-perl{ .lang-perl .str { color: #009606 } /* string content */ .lang-perl .kwd { color: #00C; font-weight: bold } /* a keyword */ .lang-perl .typ { color: #808 } /* a type name */ + +.hidden { + display: none; +} \ No newline at end of file diff --git a/docs/manual/style/scripts/prettify.js b/docs/manual/style/scripts/prettify.js index 04a2037362..36846168f2 100644 --- a/docs/manual/style/scripts/prettify.js +++ b/docs/manual/style/scripts/prettify.js @@ -350,7 +350,7 @@ var REGEXP_PRECEDER_PATTERN = '(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[ // -> [[1, 12], [14, 14], [16, 17]] ranges.sort(function (a, b) { return (a[0] - b[0]) || (b[1] - a[1]); }); var consolidatedRanges = []; - var lastRange = []; + var lastRange = [0,0]; for (var i = 0; i < ranges.length; ++i) { var range = ranges[i]; if (range[0] <= lastRange[1] + 1) { @@ -917,7 +917,7 @@ var REGEXP_PRECEDER_PATTERN = '(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[ [PR_LITERAL, /^@[a-z_$][a-z_$@0-9]*|\bNULL\b/i, null], [PR_LITERAL, CONFIG_OPTIONS, null], //[PR_STRING, CONFIG_ENVS, null], - [PR_TAG, /^\b(AuthzProviderAlias|AuthnProviderAlias|RequireAny|RequireAll|RequireNone|Directory|DirectoryMatch|Location|LocationMatch|VirtualHost|If|Else|ElseIf|Proxy|LoadBalancer|Files|FilesMatch|Limit|LimitExcept|IfDefine|IfModule|IfVersion|SSLPolicy|ManagedDomain)\b/, null], + [PR_TAG, /^<\/?\b(AuthzProviderAlias|AuthnProviderAlias|RequireAny|RequireAll|RequireNone|Directory|DirectoryMatch|Location|LocationMatch|VirtualHost|If|Else|ElseIf|Proxy|LoadBalancer|Files|FilesMatch|Limit|LimitExcept|IfDefine|IfModule|IfVersion|SSLPolicy|ManagedDomain).*?>/, null], [PR_TYPE, /^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_(t|req|module)\b)/, null], [PR_TAG, /^apr_[a-z_0-9]+|ap_[a-z_0-9]+/i, null], [PR_PLAIN, /^[a-z_$][a-z_$@0-9\-]*/i, null], @@ -1188,7 +1188,10 @@ var REGEXP_PRECEDER_PATTERN = '(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[ textNode.nodeValue = styledText; var document = textNode.ownerDocument; var span = document.createElement('span'); - span.className = decorations[decorationIndex + 1]; + // prettify may break locally and make duplicates. + // These don't have a className, so we'll simply hide them + // by defaulting to 'hidden' class. + span.className = decorations[decorationIndex + 1] || "hidden"; var parentNode = textNode.parentNode; parentNode.replaceChild(span, textNode); span.appendChild(textNode); diff --git a/docs/manual/style/scripts/prettify.min.js b/docs/manual/style/scripts/prettify.min.js index 929ece2038..bb4766d4ff 100644 --- a/docs/manual/style/scripts/prettify.min.js +++ b/docs/manual/style/scripts/prettify.min.js @@ -15,7 +15,7 @@ function caseFoldCharset(charSet){var charsetParts=charSet.substring(1,charSet.l for(var i=inverse?1:0,n=charsetParts.length;i122)){if(!(end<65||start>90)){ranges.push([Math.max(65,start)|32,Math.min(end,90)|32]);} if(!(end<97||start>122)){ranges.push([Math.max(97,start)&~32,Math.min(end,122)&~32]);}}}} -ranges.sort(function(a,b){return(a[0]-b[0])||(b[1]-a[1]);});var consolidatedRanges=[];var lastRange=[];for(var i=0;irange[0]){if(range[1]+1>range[0]){out.push('-');} out.push(encodeEscape(range[1]));}} out.push(']');return out.join('');} @@ -71,7 +71,7 @@ var types=options['types'];if(types){fallthroughStylePatterns.push([PR_TYPE,type if(options['strings']){var strings=(""+options['strings']).replace(/^ | $/g,'').replace(/-/g,'\\-');fallthroughStylePatterns.push([PR_STRING,new RegExp('(?:'+strings.replace(/[\s,]+/g,'|')+')'),,null]);} var keywords=(""+options['keywords']).replace(/^ | $/g,'');if(keywords.length){fallthroughStylePatterns.push([PR_KEYWORD,new RegExp('^(?:'+keywords.replace(/[\s,]+/g,'|')+')\\b'),null]);} shortcutStylePatterns.push([PR_PLAIN,/^\s+/,null,' \r\n\t\xA0']);if(options['httpdComments']){fallthroughStylePatterns.push([PR_PLAIN,/^.*\S.*#/i,null]);} -fallthroughStylePatterns.push([PR_LITERAL,/^@[a-z_$][a-z_$@0-9]*|\bNULL\b/i,null],[PR_LITERAL,CONFIG_OPTIONS,null],[PR_TAG,/^\b(AuthzProviderAlias|AuthnProviderAlias|RequireAny|RequireAll|RequireNone|Directory|DirectoryMatch|Location|LocationMatch|VirtualHost|If|Else|ElseIf|Proxy|LoadBalancer|Files|FilesMatch|Limit|LimitExcept|IfDefine|IfModule|IfVersion|SSLPolicy|ManagedDomain)\b/,null],[PR_TYPE,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_(t|req|module)\b)/,null],[PR_TAG,/^apr_[a-z_0-9]+|ap_[a-z_0-9]+/i,null],[PR_PLAIN,/^[a-z_$][a-z_$@0-9\-]*/i,null],[PR_LITERAL,new RegExp('^(?:' +fallthroughStylePatterns.push([PR_LITERAL,/^@[a-z_$][a-z_$@0-9]*|\bNULL\b/i,null],[PR_LITERAL,CONFIG_OPTIONS,null],[PR_TAG,/^<\/?\b(AuthzProviderAlias|AuthnProviderAlias|RequireAny|RequireAll|RequireNone|Directory|DirectoryMatch|Location|LocationMatch|VirtualHost|If|Else|ElseIf|Proxy|LoadBalancer|Files|FilesMatch|Limit|LimitExcept|IfDefine|IfModule|IfVersion|SSLPolicy|ManagedDomain).*?>/,null],[PR_TYPE,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_(t|req|module)\b)/,null],[PR_TAG,/^apr_[a-z_0-9]+|ap_[a-z_0-9]+/i,null],[PR_PLAIN,/^[a-z_$][a-z_$@0-9\-]*/i,null],[PR_LITERAL,new RegExp('^(?:' +'0x[a-f0-9]+' +'|[a-f0-9:]+:[a-f0-9:]+:[a-f0-9:]+:[a-f0-9:]+:[a-f0-9:]+:[a-f0-9:]+' +'|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)' @@ -100,7 +100,7 @@ decorations[decPos++]=startPos;decorations[decPos++]=startDec;i=end;} nDecorations=decorations.length=decPos;var sourceNode=job.sourceNode;var oldDisplay;if(sourceNode){oldDisplay=sourceNode.style.display;sourceNode.style.display='none';} try{var decoration=null;var X=0;while(spanIndex5000){break;} var spanStart=spans[spanIndex];var spanEnd=spans[spanIndex+2]||sourceLength;var decEnd=decorations[decorationIndex+2]||sourceLength;var end=Math.min(spanEnd,decEnd);var textNode=spans[spanIndex+1];var styledText;if(textNode.nodeType!==1&&(styledText=source.substring(sourceIndex,end))){if(isIE8OrEarlier){styledText=styledText.replace(newlineRe,'\r');} -textNode.nodeValue=styledText;var document=textNode.ownerDocument;var span=document.createElement('span');span.className=decorations[decorationIndex+1];var parentNode=textNode.parentNode;parentNode.replaceChild(span,textNode);span.appendChild(textNode);if(sourceIndex=spanEnd){spanIndex+=2;} if(sourceIndex>=decEnd){decorationIndex+=2;}}}finally{if(sourceNode){sourceNode.style.display=oldDisplay;}}} var langHandlerRegistry={};function registerLangHandler(handler,fileExtensions){for(var i=fileExtensions.length;--i>=0;){var ext=fileExtensions[i];if(!langHandlerRegistry.hasOwnProperty(ext)){langHandlerRegistry[ext]=handler;}else if(win['console']){console['warn']('cannot override language handler %s',ext);}}}