diff options
author | Daniel Gruno <humbedooh@apache.org> | 2012-05-01 09:19:25 +0200 |
---|---|---|
committer | Daniel Gruno <humbedooh@apache.org> | 2012-05-01 09:19:25 +0200 |
commit | 0eff5187c48e3be675094a151ff1e9661346ed31 (patch) | |
tree | 9c1f572b7eb01962060d70032e1eb58339e9bb1f /docs/manual/style | |
parent | If a filename without slashes is specified for LoadFile or (diff) | |
download | apache2-0eff5187c48e3be675094a151ff1e9661346ed31.tar.xz apache2-0eff5187c48e3be675094a151ff1e9661346ed31.zip |
Add PHP as a possible highlighted language if needed.
Fix up the lexer so that when httpdComments is true, httpd style comments are not parsed as such unless the hash character is at the beginning of a line (disregarding spaces)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1332544 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'docs/manual/style')
-rw-r--r-- | docs/manual/style/scripts/prettify.js | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/docs/manual/style/scripts/prettify.js b/docs/manual/style/scripts/prettify.js index b230fa8877..9d49ece991 100644 --- a/docs/manual/style/scripts/prettify.js +++ b/docs/manual/style/scripts/prettify.js @@ -114,6 +114,13 @@ var prettyPrint; var PERL_KEYWORDS = "caller,delete,die,do,dump,else,elsif,eval,exit,foreach,for," + "goto,if,import,last,local,my,next,no,our,print,package,redo,require," + "sub,undef,unless,until,use,wantarray,while,BEGIN,END"; + var PHP_KEYWORDS = "abstract,and,array,as,break,case,catch,cfunction,class," + + "clone,const,continue,declare,default,do,else,elseif,enddeclare,endfor," + + "endforeach,endif,endswitch,endwhile,extends,final,for,foreach,function," + + "global,goto,if,implements,interface,instanceof,namespace,new,old_function," + + "or,private,protected,public,static,switch,throw,try,use,var,while,xor," + + "die,echo,empty,exit,eval,include,include_once,isset,list,require," + + "require_once,return,print,unset"; var PYTHON_KEYWORDS = [FLOW_CONTROL_KEYWORDS, "and,as,assert,class,def,del," + "elif,except,exec,finally,from,global,import,in,is,lambda," + "nonlocal,not,or,pass,print,raise,try,with,yield," + @@ -128,7 +135,7 @@ var prettyPrint; var CONFIG_OPTIONS = /^[\\+\\-]?(AuthConfig|Includes|ExecCGI|FollowSymLinks|MultiViews|IncludesNOEXEC|Indexes|SymLinksIfOwnerMatch)/; var ALL_KEYWORDS = [ CPP_KEYWORDS, CSHARP_KEYWORDS, JSCRIPT_KEYWORDS, PERL_KEYWORDS + - PYTHON_KEYWORDS, RUBY_KEYWORDS, SH_KEYWORDS, CONFIG_KEYWORDS]; + PYTHON_KEYWORDS, RUBY_KEYWORDS, SH_KEYWORDS, CONFIG_KEYWORDS, PHP_KEYWORDS]; var C_TYPES = /^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float|char|void|const|static|struct)\d*(_t)?\b)|[a-z_]+_rec|cmd_parms\b/; // token style names. correspond to css classes @@ -889,6 +896,11 @@ var REGEXP_PRECEDER_PATTERN = '(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[ } shortcutStylePatterns.push([PR_PLAIN, /^\s+/, null, ' \r\n\t\xA0']); + if (options['httpdComments']) { + fallthroughStylePatterns.push( + [PR_PLAIN, /^.*\S.*#/i, null] + ); + } fallthroughStylePatterns.push( // TODO(mikesamuel): recognize non-latin letters and numerals in idents [PR_LITERAL, /^@[a-z_$][a-z_$@0-9]*|\bNULL\b/i, null], @@ -1056,7 +1068,7 @@ var REGEXP_PRECEDER_PATTERN = '(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[ // Stick a class on the LIs so that stylesheets can // color odd/even rows, or any other row pattern that // is co-prime with 10. - li.className = 'L' + ((i + offset) % 10); + li.className = 'L' + ((i + offset) % 1); if (!li.firstChild) { li.appendChild(document.createTextNode('\xA0')); } @@ -1140,7 +1152,7 @@ var REGEXP_PRECEDER_PATTERN = '(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[ var X = 0; while (spanIndex < nSpans) { X = X + 1; - if (X > 2500) { break; } + if (X > 5000) { break; } var spanStart = spans[spanIndex]; var spanEnd = spans[spanIndex + 2] || sourceLength; @@ -1279,6 +1291,14 @@ var REGEXP_PRECEDER_PATTERN = '(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[ 'types': C_TYPES, }), ['c', 'cc', 'cpp', 'cxx', 'cyc', 'm']); registerLangHandler(sourceDecorator({ + 'keywords': PHP_KEYWORDS, + 'hashComments': false, + 'cStyleComments': true, + 'multiLineStrings': true, + 'regexLiterals': true +// 'types': C_TYPES, + }), ['php', 'phtml', 'inc']); + registerLangHandler(sourceDecorator({ 'keywords': 'null,true,false' }), ['json']); registerLangHandler(sourceDecorator({ @@ -1334,8 +1354,10 @@ var REGEXP_PRECEDER_PATTERN = '(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[ 'keywords': CONFIG_KEYWORDS, 'literals': CONFIG_OPTIONS, 'hashComments': true, + 'cStyleComments': false, 'multiLineStrings': false, - 'regexLiterals': false + 'regexLiterals': false, + 'httpdComments': true }), ['config']); function applyDecorator(job) { |