Commit:    6877a6e5dda2ab67854290943e2734c91f8431dc
Author:    Ruslan <nar...@yandex.ru>         Fri, 20 Nov 2020 20:15:02 +0300
Committer: Sara Golemon <poll...@php.net>      Wed, 25 Nov 2020 20:28:13 +0000
Parents:   e345b9e63fa45a485637d983df9dc2edb7d539de
Branches:  master

Link:       
http://git.php.net/?p=web/php.git;a=commitdiff;h=6877a6e5dda2ab67854290943e2734c91f8431dc

Log:
Syntax highlighting

Changed paths:
  M  releases/8_0_x.php
  M  styles/php8.css

diff --git a/releases/8_0_x.php b/releases/8_0_x.php
index 851d9e0f2..4ca9b5ed8 100644
--- a/releases/8_0_x.php
+++ b/releases/8_0_x.php
@@ -80,20 +80,24 @@ site_header("PHP 8.0.0 Release Announcement", array(
       <div class="php8-compare__block example-contents">
         <div class="php8-compare__label">PHP 7</div>
         <div class="php8-code phpcode">
-<pre>/**
+            <?php highlight_php_trimmed(
+                '/**
 * @Route("/api/posts/{id}", methods={"GET", "HEAD"})
 */
-classUser
-{</pre>
+class User
+{'
+            );?>
         </div>
       </div>
       <div class="php8-compare__arrow"></div>
       <div class="php8-compare__block example-contents">
         <div class="php8-compare__label php8-compare__label_new">PHP 8</div>
         <div class="php8-code phpcode">
-<pre>#[Route("/api/posts/{id}", methods: ["GET", "HEAD"])]
+            <?php highlight_php_trimmed(
+                '#[Route("/api/posts/{id}", methods: ["GET", "HEAD"])]
 class User
-{</pre>
+{'
+            );?>
         </div>
       </div>
     </div>
@@ -111,34 +115,38 @@ class User
       <div class="php8-compare__block example-contents">
         <div class="php8-compare__label">PHP 7</div>
         <div class="php8-code phpcode">
-<pre>class Point {
- public float $x;
- public float $y;
- public float $z;
+            <?php highlight_php_trimmed(
+                'class Point {
+  public float $x;
+  public float $y;
+  public float $z;
 
- public function __construct(
-     float $x = 0.0,
-     float $y = 0.0,
-     float $z = 0.0,
- ) {
-     $this->x = $x;
-     $this->y = $y;
-     $this->z = $z;
- }
-}</pre>
+  public function __construct(
+    float $x = 0.0,
+    float $y = 0.0,
+    float $z = 0.0,
+  ) {
+    $this->x = $x;
+    $this->y = $y;
+    $this->z = $z;
+  }
+}'
+            );?>
         </div>
       </div>
       <div class="php8-compare__arrow"></div>
       <div class="php8-compare__block example-contents">
         <div class="php8-compare__label php8-compare__label_new">PHP 8</div>
         <div class="php8-code phpcode">
-<pre>class Point {
- public function __construct(
-     public float $x = 0.0,
-     public float $y = 0.0,
-     public float $z = 0.0,
- ) {}
-}</pre>
+            <?php highlight_php_trimmed(
+                'class Point {
+  public function __construct(
+    public float $x = 0.0,
+    public float $y = 0.0,
+    public float $z = 0.0,
+  ) {}
+}'
+            );?>
         </div>
       </div>
     </div>
@@ -156,32 +164,36 @@ class User
       <div class="php8-compare__block example-contents">
         <div class="php8-compare__label">PHP 7</div>
         <div class="php8-code phpcode">
-<pre>class Number {
- /** @var int|float */
- private $number;
+            <?php highlight_php_trimmed(
+                'class Number {
+  /** @var int|float */
+  private $number;
 
- /**
-  * @param float|int $number
-  */
- public function __construct($number) {
-     $this->number = $number;
- }
+  /**
+   * @param float|int $number
+   */
+  public function __construct($number) {
+    $this->number = $number;
+  }
 }
 
-new Number('NaN'); // Ok</pre>
+new Number(\'NaN\'); // Ok'
+            );?>
         </div>
       </div>
       <div class="php8-compare__arrow"></div>
       <div class="php8-compare__block example-contents">
         <div class="php8-compare__label php8-compare__label_new">PHP 8</div>
         <div class="php8-code phpcode">
-<pre>class Number {
- public function __construct(
-     private int|float $number
- ) {}
+            <?php highlight_php_trimmed(
+                'class Number {
+  public function __construct(
+    private int|float $number
+  ) {}
 }
 
-new Number('NaN'); // TypeError</pre>
+new Number(\'NaN\'); // TypeError'
+            );?>
         </div>
       </div>
     </div>
@@ -200,27 +212,31 @@ new Number('NaN'); // TypeError</pre>
       <div class="php8-compare__block example-contents">
         <div class="php8-compare__label">PHP 7</div>
         <div class="php8-code phpcode">
-<pre>switch (8.0) {
- case '8.0':
-   $result = "Oh no!";
-   break;
- case 8.0:
-   $result = "This is what I expected";
-   break;
+            <?php highlight_php_trimmed(
+                'switch (8.0) {
+  case \'8.0\':
+    $result = "Oh no!";
+    break;
+  case 8.0:
+    $result = "This is what I expected";
+    break;
 }
 echo $result;
-//> Oh no!</pre>
+//> Oh no!'
+            );?>
         </div>
       </div>
       <div class="php8-compare__arrow"></div>
       <div class="php8-compare__block example-contents">
         <div class="php8-compare__label php8-compare__label_new">PHP 8</div>
         <div class="php8-code phpcode">
-<pre>echo match (8.0) {
- '8.0' => "Oh no!",
- 8.0 => "This is what I expected",
+            <?php highlight_php_trimmed(
+                'echo match (8.0) {
+  \'8.0\' => "Oh no!",
+  8.0 => "This is what I expected",
 };
-//> This is what I expected</pre>
+//> This is what I expected'
+            );?>
         </div>
       </div>
     </div>
@@ -243,26 +259,30 @@ echo $result;
       <div class="php8-compare__block example-contents">
         <div class="php8-compare__label">PHP 7</div>
         <div class="php8-code phpcode">
-<pre>$country =  null;
+            <?php highlight_php_trimmed(
+                '$country =  null;
 
 if ($session !== null) {
- $user = $session->user;
-
- if ($user !== null) {
-     $address = $user->getAddress();
+  $user = $session->user;
 
-     if ($address !== null) {
-         $country = $address->country;
-     }
- }
-}</pre>
+  if ($user !== null) {
+    $address = $user->getAddress();
+  
+    if ($address !== null) {
+      $country = $address->country;
+    }
+  }
+}'
+            );?>
         </div>
       </div>
       <div class="php8-compare__arrow"></div>
       <div class="php8-compare__block example-contents">
         <div class="php8-compare__label php8-compare__label_new">PHP 8</div>
         <div class="php8-code phpcode">
-          <pre>$country = $session?->user?->getAddress()?->country;</pre>
+            <?php highlight_php_trimmed(
+                '$country = $session?->user?->getAddress()?->country;'
+            );?>
         </div>
       </div>
     </div>
@@ -282,14 +302,18 @@ if ($session !== null) {
       <div class="php8-compare__block example-contents">
         <div class="php8-compare__label">PHP 7</div>
         <div class="php8-code phpcode">
-          <pre>0 == 'foobar' // true</pre>
+            <?php highlight_php_trimmed(
+                '0 == \'foobar\' // true'
+            );?>
         </div>
       </div>
       <div class="php8-compare__arrow"></div>
       <div class="php8-compare__block example-contents">
         <div class="php8-compare__label php8-compare__label_new">PHP 8</div>
         <div class="php8-code phpcode">
-          <pre>0 == 'foobar' // false</pre>
+            <?php highlight_php_trimmed(
+                '0 == \'foobar\' // false'
+            );?>
         </div>
       </div>
     </div>
@@ -308,18 +332,22 @@ if ($session !== null) {
       <div class="php8-compare__block example-contents">
         <div class="php8-compare__label">PHP 7</div>
         <div class="php8-code phpcode">
-<pre>strlen([]); // Warning: strlen() expects parameter 1 to be string, array 
given
+            <?php highlight_php_trimmed(
+                'strlen([]); // Warning: strlen() expects parameter 1 to be 
string, array given
 
-array_chunk([], -1); // Warning: array_chunk(): Size parameter expected to be 
greater than 0</pre>
+array_chunk([], -1); // Warning: array_chunk(): Size parameter expected to be 
greater than 0'
+            );?>
         </div>
       </div>
       <div class="php8-compare__arrow"></div>
       <div class="php8-compare__block example-contents">
         <div class="php8-compare__label php8-compare__label_new">PHP 8</div>
         <div class="php8-code phpcode">
-<pre>strlen([]); // TypeError: strlen(): Argument #1 ($str) must be of type 
string, array given
+            <?php highlight_php_trimmed(
+                'strlen([]); // TypeError: strlen(): Argument #1 ($str) must 
be of type string, array given
 
-array_chunk([], -1); // ValueError: array_chunk(): Argument #2 ($length) must 
be greater than 0</pre>
+array_chunk([], -1); // ValueError: array_chunk(): Argument #2 ($length) must 
be greater than 0'
+            );?>
         </div>
       </div>
     </div>
diff --git a/styles/php8.css b/styles/php8.css
index d81b28494..b96793e8a 100644
--- a/styles/php8.css
+++ b/styles/php8.css
@@ -286,18 +286,11 @@
   align-items: center;
   width: 100%;
   height: 100%;
-  padding: 50px 76px 38px !important;
+  padding: 50px 40px 38px !important;
   box-sizing: border-box;
   margin: 0 !important;
 }
 
-@media (max-width: 1000px) {
-  .php8-code {
-    padding-left: 50px !important;
-    padding-right: 50px !important;
-  }
-}
-
 @media (max-width: 768px) {
   .php8-code {
     padding-left: 12px !important;
-- 
PHP Webmaster List Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to