Build tools: Fix the grunt format:php
build.
Re-add variable that was removed on accident by [44359]. Also run `grunt format:php` to adjust the code style. .--This line, and those below, will be ignored-- M Gruntfile.js M src/index.php M src/wp-admin/index.php M src/wp-includes/class-wp-block-parser.php git-svn-id: https://develop.svn.wordpress.org/trunk@44360 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
d2d7243e80
commit
68dd26a4c0
@ -25,7 +25,10 @@ module.exports = function(grunt) {
|
||||
'wp-content/plugins/index.php',
|
||||
'wp-content/plugins/hello.php',
|
||||
'wp-content/plugins/akismet/**'
|
||||
];
|
||||
],
|
||||
changedFiles = {
|
||||
php: []
|
||||
};
|
||||
|
||||
if ( 'watch:phpunit' === grunt.cli.tasks[ 0 ] && ! phpUnitWatchGroup ) {
|
||||
grunt.log.writeln();
|
||||
|
@ -36,7 +36,7 @@ $die = sprintf(
|
||||
'WordPress'
|
||||
) . '</p>';
|
||||
|
||||
$die .= '<p>' . __( 'Before running any grunt tasks you need to make sure the dependencies are installed. You can install these by running ');
|
||||
$die .= '<p>' . __( 'Before running any grunt tasks you need to make sure the dependencies are installed. You can install these by running ' );
|
||||
$die .= '<code style="color: green;">npm install</code>.</p>';
|
||||
|
||||
$die .= '<ul>';
|
||||
@ -44,17 +44,17 @@ $die .= '<li>' . sprintf(
|
||||
/* translators: %s: WordPress */
|
||||
__( 'To build %s while developing run:' ),
|
||||
'WordPress'
|
||||
) . '<br /><br />';
|
||||
) . '<br /><br />';
|
||||
$die .= '<code style="color: green;">grunt build --dev</code></li>';
|
||||
$die .= '<li>' . sprintf(
|
||||
__( 'To build files automatically when changing the source files run:' ),
|
||||
'WordPress'
|
||||
) . '<br /><br />';
|
||||
) . '<br /><br />';
|
||||
$die .= '<code style="color: green;">grunt watch</code></li>';
|
||||
$die .= '<li>' . sprintf(
|
||||
__( 'To create a production build of %s run:' ),
|
||||
'WordPress'
|
||||
) . '<br /><br />';
|
||||
) . '<br /><br />';
|
||||
$die .= '<code style="color: green;">grunt build</code></li>';
|
||||
$die .= '</ul>';
|
||||
|
||||
|
@ -36,7 +36,7 @@ $die = sprintf(
|
||||
'WordPress'
|
||||
) . '</p>';
|
||||
|
||||
$die .= '<p>' . __( 'Before running any grunt tasks you need to make sure the dependencies are installed. You can install these by running ');
|
||||
$die .= '<p>' . __( 'Before running any grunt tasks you need to make sure the dependencies are installed. You can install these by running ' );
|
||||
$die .= '<code style="color: green;">npm install</code>.</p>';
|
||||
|
||||
$die .= '<ul>';
|
||||
@ -44,17 +44,17 @@ $die .= '<li>' . sprintf(
|
||||
/* translators: %s: WordPress */
|
||||
__( 'To build %s while developing run:' ),
|
||||
'WordPress'
|
||||
) . '<br /><br />';
|
||||
) . '<br /><br />';
|
||||
$die .= '<code style="color: green;">grunt build --dev</code></li>';
|
||||
$die .= '<li>' . sprintf(
|
||||
__( 'To build files automatically when changing the source files run:' ),
|
||||
'WordPress'
|
||||
) . '<br /><br />';
|
||||
) . '<br /><br />';
|
||||
$die .= '<code style="color: green;">grunt watch</code></li>';
|
||||
$die .= '<li>' . sprintf(
|
||||
__( 'To create a production build of %s run:' ),
|
||||
'WordPress'
|
||||
) . '<br /><br />';
|
||||
) . '<br /><br />';
|
||||
$die .= '<code style="color: green;">grunt build</code></li>';
|
||||
$die .= '</ul>';
|
||||
|
||||
@ -65,6 +65,6 @@ $die .= '<p>' . sprintf(
|
||||
'https://www.npmjs.com/',
|
||||
'https://gruntjs.com/',
|
||||
__( 'https://make.wordpress.org/core/handbook/tutorials/installing-wordpress-locally/' )
|
||||
) . '</p>';
|
||||
) . '</p>';
|
||||
|
||||
wp_die( $die, __( 'WordPress › Error' ) );
|
||||
|
@ -269,11 +269,13 @@ class WP_Block_Parser {
|
||||
*/
|
||||
if ( 0 === $stack_depth ) {
|
||||
if ( isset( $leading_html_start ) ) {
|
||||
$this->output[] = (array) self::freeform( substr(
|
||||
$this->output[] = (array) self::freeform(
|
||||
substr(
|
||||
$this->document,
|
||||
$leading_html_start,
|
||||
$start_offset - $leading_html_start
|
||||
) );
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$this->output[] = (array) new WP_Block_Parser_Block( $block_name, $attrs, array(), '', array() );
|
||||
@ -292,13 +294,16 @@ class WP_Block_Parser {
|
||||
|
||||
case 'block-opener':
|
||||
// track all newly-opened blocks on the stack
|
||||
array_push( $this->stack, new WP_Block_Parser_Frame(
|
||||
array_push(
|
||||
$this->stack,
|
||||
new WP_Block_Parser_Frame(
|
||||
new WP_Block_Parser_Block( $block_name, $attrs, array(), '', array() ),
|
||||
$start_offset,
|
||||
$token_length,
|
||||
$start_offset + $token_length,
|
||||
$leading_html_start
|
||||
) );
|
||||
)
|
||||
);
|
||||
$this->offset = $start_offset + $token_length;
|
||||
return true;
|
||||
|
||||
@ -391,22 +396,22 @@ class WP_Block_Parser {
|
||||
return array( 'no-more-tokens', null, null, null, null );
|
||||
}
|
||||
|
||||
list( $match, $started_at ) = $matches[ 0 ];
|
||||
list( $match, $started_at ) = $matches[0];
|
||||
|
||||
$length = strlen( $match );
|
||||
$is_closer = isset( $matches[ 'closer' ] ) && -1 !== $matches[ 'closer' ][ 1 ];
|
||||
$is_void = isset( $matches[ 'void' ] ) && -1 !== $matches[ 'void' ][ 1 ];
|
||||
$namespace = $matches[ 'namespace' ];
|
||||
$namespace = ( isset( $namespace ) && -1 !== $namespace[ 1 ] ) ? $namespace[ 0 ] : 'core/';
|
||||
$name = $namespace . $matches[ 'name' ][ 0 ];
|
||||
$has_attrs = isset( $matches[ 'attrs' ] ) && -1 !== $matches[ 'attrs' ][ 1 ];
|
||||
$is_closer = isset( $matches['closer'] ) && -1 !== $matches['closer'][1];
|
||||
$is_void = isset( $matches['void'] ) && -1 !== $matches['void'][1];
|
||||
$namespace = $matches['namespace'];
|
||||
$namespace = ( isset( $namespace ) && -1 !== $namespace[1] ) ? $namespace[0] : 'core/';
|
||||
$name = $namespace . $matches['name'][0];
|
||||
$has_attrs = isset( $matches['attrs'] ) && -1 !== $matches['attrs'][1];
|
||||
|
||||
/*
|
||||
* Fun fact! It's not trivial in PHP to create "an empty associative array" since all arrays
|
||||
* are associative arrays. If we use `array()` we get a JSON `[]`
|
||||
*/
|
||||
$attrs = $has_attrs
|
||||
? json_decode( $matches[ 'attrs' ][ 0 ], /* as-associative */ true )
|
||||
? json_decode( $matches['attrs'][0], /* as-associative */ true )
|
||||
: $this->empty_attrs;
|
||||
|
||||
/*
|
||||
@ -505,11 +510,13 @@ class WP_Block_Parser {
|
||||
}
|
||||
|
||||
if ( isset( $stack_top->leading_html_start ) ) {
|
||||
$this->output[] = (array) self::freeform( substr(
|
||||
$this->output[] = (array) self::freeform(
|
||||
substr(
|
||||
$this->document,
|
||||
$stack_top->leading_html_start,
|
||||
$stack_top->token_start - $stack_top->leading_html_start
|
||||
) );
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$this->output[] = (array) $stack_top->block;
|
||||
|
Loading…
Reference in New Issue
Block a user