From bddf7f9f2107280dd1259bc607bce6a36258869e Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Tue, 2 Mar 2021 20:49:24 +0100 Subject: [PATCH 1/4] Changed a bit the way PHP code is highlighted --- src/Renderers/CodeNodeRenderer.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Renderers/CodeNodeRenderer.php b/src/Renderers/CodeNodeRenderer.php index a450740..5180e47 100644 --- a/src/Renderers/CodeNodeRenderer.php +++ b/src/Renderers/CodeNodeRenderer.php @@ -74,6 +74,9 @@ public function render(): string if ('text' !== $language) { $highLighter = new Highlighter(); $code = $highLighter->highlight(self::LANGUAGES_MAPPING[$language] ?? $language, $code)->value; + + // this allows to highlight the $ in PHP variable names + $code = str_replace('$', '$', $code); } return $this->templateRenderer->render( From fd82358c7e15dbf46ecc4c775d45b7442188a3a0 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Fri, 5 Mar 2021 13:24:55 +0100 Subject: [PATCH 2/4] Updated tests --- .../fixtures/expected/blocks/code-blocks/php-annotations.html | 2 +- tests/fixtures/expected/blocks/code-blocks/php.html | 4 ++-- tests/fixtures/expected/blocks/nodes/literal.html | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/fixtures/expected/blocks/code-blocks/php-annotations.html b/tests/fixtures/expected/blocks/code-blocks/php-annotations.html index 214408a..fbbd85a 100644 --- a/tests/fixtures/expected/blocks/code-blocks/php-annotations.html +++ b/tests/fixtures/expected/blocks/code-blocks/php-annotations.html @@ -27,7 +27,7 @@ { /** * @Assert\Iban( * message="This is not a valid International Bank Account Number (IBAN)." * ) */ - protected $bankAccountNumber; + protected $bankAccountNumber; } diff --git a/tests/fixtures/expected/blocks/code-blocks/php.html b/tests/fixtures/expected/blocks/code-blocks/php.html index e436e58..2820de9 100644 --- a/tests/fixtures/expected/blocks/code-blocks/php.html +++ b/tests/fixtures/expected/blocks/code-blocks/php.html @@ -26,9 +26,9 @@ namespace Symfony\Component\Routing\Loader\Configurator; return function - (RoutingConfigurator $routes) + (RoutingConfigurator $routes) - { $routes->add('about_us', ['nl' => '/over-ons', 'en' => '/about-us']) ->controller('App\Controller\CompanyController::about'); + { $routes->add('about_us', ['nl' => '/over-ons', 'en' => '/about-us']) ->controller('App\Controller\CompanyController::about'); }; diff --git a/tests/fixtures/expected/blocks/nodes/literal.html b/tests/fixtures/expected/blocks/nodes/literal.html index 11a560c..5763f5c 100644 --- a/tests/fixtures/expected/blocks/nodes/literal.html +++ b/tests/fixtures/expected/blocks/nodes/literal.html @@ -25,7 +25,7 @@
                                     // config/routes.php
 namespace Symfony\Component\Routing\Loader\Configurator; return
-                                    function (RoutingConfigurator $routes) 
+                                    function (RoutingConfigurator $routes) 
                                     { $routes->add('about_us', ['nl' => '/over-ons', 'en' => '/about-us']) ->controller('App\Controller\CompanyController::about');
 };
From c3c28d44e55e03a410597ee4043124300faa9abd Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Tue, 9 Mar 2021 19:38:56 +0100 Subject: [PATCH 3/4] Fixed tests --- tests/fixtures/expected/blocks/nodes/literal.html | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/fixtures/expected/blocks/nodes/literal.html b/tests/fixtures/expected/blocks/nodes/literal.html index 5763f5c..8408c0e 100644 --- a/tests/fixtures/expected/blocks/nodes/literal.html +++ b/tests/fixtures/expected/blocks/nodes/literal.html @@ -26,7 +26,10 @@ // config/routes.php namespace Symfony\Component\Routing\Loader\Configurator; return function (RoutingConfigurator $routes) - { $routes->add('about_us', ['nl' => '/over-ons', 'en' => '/about-us']) ->controller('App\Controller\CompanyController::about'); + { + $ + routes + ->add('about_us', ['nl' => '/over-ons', 'en' => '/about-us']) ->controller('App\Controller\CompanyController::about'); }; From 4e4bbd05ae5642c088007d8fc6ae403f900e41b2 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Thu, 11 Mar 2021 08:54:12 +0100 Subject: [PATCH 4/4] Fixed more tests --- tests/fixtures/expected/main/datetime.html | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/fixtures/expected/main/datetime.html b/tests/fixtures/expected/main/datetime.html index 31c160b..9d0837e 100644 --- a/tests/fixtures/expected/main/datetime.html +++ b/tests/fixtures/expected/main/datetime.html @@ -140,7 +140,10 @@

\ DateTimeType ; - $builder + + $ + builder + -> add( 'startDateTime' @@ -397,7 +400,10 @@

                                                                     // app/config/config.php
-                                                                    $container
+                                                                    
+                                                                        $
+                                                                        container
+                                                                    
                                                                     ->
                                                                     loadFromExtension(
                                                                     'framework'