Quick fixes Removed PHP from examples
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116
diff --git a/components/prism-clike.js b/components/prism-clike.js
index 449a787..bbbb1a2 100644
--- a/components/prism-clike.js
+++ b/components/prism-clike.js
@@ -20,7 +20,7 @@ Prism.languages.clike = {
}
},
'number': /\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?)\b/g,
- 'operator': /[-+]{1,2}|!|=?<|=?<|=?>|=?>|={1,3}|(&){1,2}|\|?\||\?|\*|\/|\~|\^|\%/g,
+ 'operator': /[-+]{1,2}|!|<=?|=?>|={1,3}|(&){1,2}|\|?\||\?|\*|\/|\~|\^|\%/g,
'ignore': /&(lt|gt|amp);/gi,
'punctuation': /[{}[\];(),.:]/g
};
\ No newline at end of file
diff --git a/components/prism-clike.min.js b/components/prism-clike.min.js
index 9c17ab1..bfc016d 100644
--- a/components/prism-clike.min.js
+++ b/components/prism-clike.min.js
@@ -1 +1 @@
-Prism.languages.clike={comment:{pattern:/(^|[^\\])(\/\*[\w\W]*?\*\/|(^|[^:])\/\/.*?(\r?\n|$))/g,lookbehind:!0},string:/("|')(\\?.)*?\1/g,"class-name":{pattern:/((?:class|interface|extends|implements|trait|instanceof|new)\s+)[a-z0-9_\.\\]+/ig,lookbehind:!0,inside:{punctuation:/(\.|\\)/}},keyword:/\b(if|else|while|do|for|return|in|instanceof|function|new|try|catch|finally|null|break|continue)\b/g,"boolean":/\b(true|false)\b/g,"function":{pattern:/[a-z0-9_]+\(/ig,inside:{punctuation:/\(/}},number:/\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?)\b/g, operator:/[-+]{1,2}|!|=?<|=?<|=?>|=?>|={1,3}|(&){1,2}|\|?\||\?|\*|\/|\~|\^|\%/g,ignore:/&(lt|gt|amp);/gi,punctuation:/[{}[\];(),.:]/g};
\ No newline at end of file
+Prism.languages.clike={comment:{pattern:/(^|[^\\])(\/\*[\w\W]*?\*\/|(^|[^:])\/\/.*?(\r?\n|$))/g,lookbehind:!0},string:/("|')(\\?.)*?\1/g,"class-name":{pattern:/((?:class|interface|extends|implements|trait|instanceof|new)\s+)[a-z0-9_\.\\]+/ig,lookbehind:!0,inside:{punctuation:/(\.|\\)/}},keyword:/\b(if|else|while|do|for|return|in|instanceof|function|new|try|catch|finally|null|break|continue)\b/g,"boolean":/\b(true|false)\b/g,"function":{pattern:/[a-z0-9_]+\(/ig,inside:{punctuation:/\(/}},number:/\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?)\b/g, operator:/[-+]{1,2}|!|<=?|=?>|={1,3}|(&){1,2}|\|?\||\?|\*|\/|\~|\^|\%/g,ignore:/&(lt|gt|amp);/gi,punctuation:/[{}[\];(),.:]/g};
\ No newline at end of file
diff --git a/components/prism-php.js b/components/prism-php.js
index b476a71..2d6dd30 100644
--- a/components/prism-php.js
+++ b/components/prism-php.js
@@ -19,7 +19,7 @@ Prism.languages.php = Prism.languages.extend('clike', {
Prism.languages.insertBefore('php', 'keyword', {
'deliminator': /(\?>|\?>|<\?php|<\?php|<\?|<\?)/ig,
'this': /\$this/g,
- 'global': /\$_?(GLOBALS|SERVER|GET|POST|FILES|REQUEST|SESSION|ENV|COOKIE|HTTP_RAW_POST_DATA|argc|argv|php_errormsg|http_response_header)/g,
+ //'global': /\$_?(GLOBALS|SERVER|GET|POST|FILES|REQUEST|SESSION|ENV|COOKIE|HTTP_RAW_POST_DATA|argc|argv|php_errormsg|http_response_header)/g,
'variable': /(\$\w+)\b/ig,
'scope': {
pattern: /\b[\w\\]+::/g,
diff --git a/components/prism-php.min.js b/components/prism-php.min.js
index 62bfb06..1921612 100644
--- a/components/prism-php.min.js
+++ b/components/prism-php.min.js
@@ -1 +1 @@
-Prism.languages.php=Prism.languages.extend("clike",{keyword:/\b(and|or|xor|array|as|break|case|cfunction|class|const|continue|declare|default|die|do|else|elseif|enddeclare|endfor|endforeach|endif|endswitch|endwhile|extends|for|foreach|function|include|include_once|global|if|new|return|static|switch|use|require|require_once|var|while|abstract|interface|public|implements|extends|private|protected|parent|static|throw|null|echo|print|trait|namespace|use|final|yield|goto)\b/ig,constant:/\b[A-Z0-9_]{2,}\b/g}); Prism.languages.insertBefore("php","keyword",{deliminator:/(\?>|\?>|<\?php|<\?php|<\?|<\?)/ig,"this":/\$this/g,global:/\$_?(GLOBALS|SERVER|GET|POST|FILES|REQUEST|SESSION|ENV|COOKIE|HTTP_RAW_POST_DATA|argc|argv|php_errormsg|http_response_header)/g,variable:/(\$\w+)\b/ig,scope:{pattern:/\b[\w\\]+::/g,inside:{keyword:/(static|self|parent)/,punctuation:/(::|\\)/}},"package":{pattern:/(\\|namespace\s+|use\s+)[\w\\]+/g,lookbehind:!0,inside:{punctuation:/\\/}}}); Prism.languages.insertBefore("php","operator",{property:{pattern:/(->)[\w]+/g,lookbehind:!0}}); Prism.languages.markup&&(Prism.hooks.add("before-highlight",function(a){"php"===a.language&&(a.tokenStack=[],a.code=a.code.replace(/(?:<\?php|<\?|<\?php|<\?)[\w\W]*?(?:\?>|\?>)/ig,function(b){a.tokenStack.push(b);return"{{{PHP"+a.tokenStack.length+"}}}"}))}),Prism.hooks.add("after-highlight",function(a){if("php"===a.language){for(var b=0,c;c=a.tokenStack[b];b++)a.highlightedCode=a.highlightedCode.replace("{{{PHP"+(b+1)+"}}}",Prism.highlight(c,a.grammar,"php"));a.element.innerHTML=a.highlightedCode}}), Prism.hooks.add("wrap",function(a){"php"===a.language&&"markup"===a.type&&(a.content=a.content.replace(/(\{\{\{PHP[0-9]+\}\}\})/,'<span class="token php">$1</span>'))}),Prism.languages.insertBefore("php","comment",{markup:Prism.languages.markup.tag,php:/\{\{\{PHP[0-9]+\}\}\}/}));
\ No newline at end of file
+Prism.languages.php=Prism.languages.extend("clike",{keyword:/\b(and|or|xor|array|as|break|case|cfunction|class|const|continue|declare|default|die|do|else|elseif|enddeclare|endfor|endforeach|endif|endswitch|endwhile|extends|for|foreach|function|include|include_once|global|if|new|return|static|switch|use|require|require_once|var|while|abstract|interface|public|implements|extends|private|protected|parent|static|throw|null|echo|print|trait|namespace|use|final|yield|goto)\b/ig,constant:/\b[A-Z0-9_]{2,}\b/g}); Prism.languages.insertBefore("php","keyword",{deliminator:/(\?>|\?>|<\?php|<\?php|<\?|<\?)/ig,"this":/\$this/g,variable:/(\$\w+)\b/ig,scope:{pattern:/\b[\w\\]+::/g,inside:{keyword:/(static|self|parent)/,punctuation:/(::|\\)/}},"package":{pattern:/(\\|namespace\s+|use\s+)[\w\\]+/g,lookbehind:!0,inside:{punctuation:/\\/}}});Prism.languages.insertBefore("php","operator",{property:{pattern:/(->)[\w]+/g,lookbehind:!0}}); Prism.languages.markup&&(Prism.hooks.add("before-highlight",function(a){"php"===a.language&&(a.tokenStack=[],a.code=a.code.replace(/(?:<\?php|<\?|<\?php|<\?)[\w\W]*?(?:\?>|\?>)/ig,function(b){a.tokenStack.push(b);return"{{{PHP"+a.tokenStack.length+"}}}"}))}),Prism.hooks.add("after-highlight",function(a){if("php"===a.language){for(var b=0,c;c=a.tokenStack[b];b++)a.highlightedCode=a.highlightedCode.replace("{{{PHP"+(b+1)+"}}}",Prism.highlight(c,a.grammar,"php"));a.element.innerHTML=a.highlightedCode}}), Prism.hooks.add("wrap",function(a){"php"===a.language&&"markup"===a.type&&(a.content=a.content.replace(/(\{\{\{PHP[0-9]+\}\}\})/,'<span class="token php">$1</span>'))}),Prism.languages.insertBefore("php","comment",{markup:Prism.languages.markup.tag,php:/\{\{\{PHP[0-9]+\}\}\}/}));
\ No newline at end of file
diff --git a/examples.html b/examples.html
index 5a44ff9..db40836 100644
--- a/examples.html
+++ b/examples.html
@@ -309,66 +309,6 @@ public class PrismJS {
<p>As you can notice String keyword is not highlighted because it's not a Java language keyword (cf. <a href="http://docs.oracle.com/javase/tutorial/java/nutsandbolts/_keywords.html">Java Language Keywords</a>). The main reason is that String is not a primitive type such as <em>int</em> but a class type like <em>Integer</em>.</p>
</section>
-<section class="language-php">
- <h1>PHP</h1>
-
- <pre><code>namespace Prism;
-
-use Some\Child\Class;
-
-class Prism extends AbstractClass implements Interface_Class {
- const CONSTANT = 12345;
- public $foo = true;
- public static $bar = array('foo' => 'bar');
-
- final public __construct(array $arg1, $arg2 = false) {
- $this->foo = $arg2;
- $this->bar = new Child\Class();
-
- $int = 123456;
- $string = 'Prism.js is the best!';
- $bool = true;
- $array = array('foo');
- $shortArray = ['bar'];
- $null = null;
- $closure = function($var) use ($int) {
- return $int * 2;
- };
- }
-
- public function under_score() {
- self::doSomething();
- static::_other_method();
- }
-
- public function doSomething() {
- $var = Static\Class::methodCall();
-
- for ($i = 0; $i <= 10; $i++) {
- $var = str_replace($i, rand(), $var);
- }
-
- return $var;
- }
-}</code></pre>
-
- <h2>HTML then PHP</h2>
- <pre><code><a href="<?php echo $url; ?>">Link</a></code></pre>
-
- <h2>PHP then HTML (with short tags)</h2>
- <pre><code><? if ($var) { ?><a href="#">Link</a><? } ?></code></pre>
-
- <h2>PHP & HTML</h2>
- <pre><code><?php foreach (fetchData() as $key => $value) { ?>
- <li>
- <? if ($value) { ?>
- <span class="class-name"><?php echo $value; ?></span>
- <? } ?>
- </li>
-<?php } ?></code></pre>
-
-</section>
-
<section class="language-coffeescript">
<h1>Coffeescript</h1>