From 68c21dd6c9cc2f39a95c6f57c20f114bf2d65aa5 Mon Sep 17 00:00:00 2001 From: Michael Camilleri Date: Mon, 6 Apr 2020 05:20:04 +0900 Subject: [PATCH 1/3] Add alternative syntax example to visual sample --- spec/visual/samples/php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/spec/visual/samples/php b/spec/visual/samples/php index 948a4a7f43..bc05852030 100644 --- a/spec/visual/samples/php +++ b/spec/visual/samples/php @@ -628,4 +628,13 @@ class Zip extends Archive { } ?> + + +

Hello world!

+ + + +

Hello world!

+ +

it's html here at the end, too.

From eb60a191d9736dc0785dbc465ec953a8217620da Mon Sep 17 00:00:00 2001 From: Michael Camilleri Date: Tue, 7 Apr 2020 09:40:09 +0900 Subject: [PATCH 2/3] Separate '?' from other operators --- lib/rouge/lexers/php.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/rouge/lexers/php.rb b/lib/rouge/lexers/php.rb index 50ceb7dc6f..835deeae77 100644 --- a/lib/rouge/lexers/php.rb +++ b/lib/rouge/lexers/php.rb @@ -117,7 +117,8 @@ def self.detect?(text) end rule %r/(void|\??(int|float|bool|string|iterable|self|callable))\b/i, Keyword::Type - rule %r/[~!%^&*+=\|:.<>\/?@-]+/, Operator + rule %r/[~!%^&*+=\|:.<>\/@-]+/, Operator + rule %r/\?+/, Operator rule %r/[\[\]{}();,]/, Punctuation rule %r/(class|interface|trait)(\s+)(#{nsid})/i do groups Keyword::Declaration, Text, Name::Class From 60b95c60e901159fe286e8fc79becc4df0fe7a2e Mon Sep 17 00:00:00 2001 From: Michael Camilleri Date: Tue, 7 Apr 2020 09:40:40 +0900 Subject: [PATCH 3/3] Remove repetition metacharacter --- lib/rouge/lexers/php.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rouge/lexers/php.rb b/lib/rouge/lexers/php.rb index 835deeae77..2c3d344dea 100644 --- a/lib/rouge/lexers/php.rb +++ b/lib/rouge/lexers/php.rb @@ -118,7 +118,7 @@ def self.detect?(text) rule %r/(void|\??(int|float|bool|string|iterable|self|callable))\b/i, Keyword::Type rule %r/[~!%^&*+=\|:.<>\/@-]+/, Operator - rule %r/\?+/, Operator + rule %r/\?/, Operator rule %r/[\[\]{}();,]/, Punctuation rule %r/(class|interface|trait)(\s+)(#{nsid})/i do groups Keyword::Declaration, Text, Name::Class