Skip to content

Commit 0f5b424

Browse files
github-actions[bot]wordpress-org-automations[bot]ryelle
authored
Content updates from Page Editor (#531)
* [automated] Sync content from Page Editor. * Remove the custom download modal * Parser: Set a parser for the `modal` block, strip newlines from attribute replacements --------- Co-authored-by: wordpress-org-automations[bot] <68366308+wordpress-org-automations[bot]@users.noreply.github.com> Co-authored-by: Kelly Dwan <[email protected]>
1 parent e7fa527 commit 0f5b424

File tree

10 files changed

+56
-247
lines changed

10 files changed

+56
-247
lines changed

env/export-content/includes/parser.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ public function __construct( string $content = '' ) {
5454

5555
// Shared custom blocks.
5656
'wporg/link-wrapper' => new Parsers\HTMLParser( 'a', [ 'href' ] ),
57+
'wporg/modal' => new Parsers\AttributeParser( [ 'label' ] ),
5758
];
5859
}
5960

env/export-content/includes/parsers/BlockParser.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,9 @@ private function get_attribute( string $attribute_name, array $block ) : array {
6161
private function set_attribute( string $attribute_name, array &$block, array $replacements ) {
6262
if ( isset( $block['attrs'][ $attribute_name ] ) && is_string( $block['attrs'][ $attribute_name ] ) ) {
6363
if ( isset( $replacements[ $block['attrs'][ $attribute_name ] ] ) ) {
64-
$block['attrs'][ $attribute_name ] = $replacements[ $block['attrs'][ $attribute_name ] ];
64+
$replace = $replacements[ $block['attrs'][ $attribute_name ] ];
65+
$replace = str_replace( "\n", ' ', $replace );
66+
$block['attrs'][ $attribute_name ] = $replace;
6567
}
6668
}
6769
}

env/export-content/tests/block-parser-test.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,10 @@ public function data_block_content_strings() {
8080
"<!-- wp:table -->\n<figure class=\"wp-block-table\"><table><thead><tr><th>Cookie</th><th>Logged-in Users Only?</th></tr></thead><tbody><tr><th>welcome-{blog_id}</th><td>No</td></tr><tr><th>showComments</th><td>No</td></tr></tbody></table></figure>\n<!-- /wp:table -->",
8181
[ 'Cookie', 'Logged-in Users Only?', 'welcome-{blog_id}', 'No', 'showComments' ],
8282
],
83+
[
84+
"<!-- wp:wporg/modal {\"closeButtonColor\":\"white\",\"customCloseButtonColor\":\"#ffffff\",\"href\":\"[download_link]\",\"label\":\"Download WordPress [latest_version]\"} -->\n<!-- wp:group {\"style\":{\"elements\":{\"link\":{\"color\":{\"text\":\"var:preset|color|white\"}}},\"spacing\":{\"padding\":{\"top\":\"var:preset|spacing|40\",\"bottom\":\"var:preset|spacing|30\",\"left\":\"var:preset|spacing|40\",\"right\":\"var:preset|spacing|40\"},\"blockGap\":\"var:preset|spacing|10\"}},\"backgroundColor\":\"blueberry-1\",\"textColor\":\"white\",\"layout\":{\"type\":\"constrained\"}} -->\n<div class=\"wp-block-group has-white-color has-blueberry-1-background-color has-text-color has-background has-link-color\" style=\"padding-top:var(--wp--preset--spacing--40);padding-right:var(--wp--preset--spacing--40);padding-bottom:var(--wp--preset--spacing--30);padding-left:var(--wp--preset--spacing--40)\"><!-- wp:heading {\"style\":{\"spacing\":{\"margin\":{\"top\":\"0\"}}}} -->\n<h2 class=\"wp-block-heading\" style=\"margin-top:0\">Howdy!</h2>\n<!-- /wp:heading --></div>\n<!-- /wp:group -->\n<!-- /wp:wporg/modal -->",
85+
[ 'Download WordPress [latest_version]', 'Howdy!' ],
86+
],
8387
];
8488
}
8589

@@ -178,6 +182,11 @@ public function data_block_content_i18n_with_shortcode() {
178182
"<!-- wp:buttons -->\n<div class=\"wp-block-buttons\"><!-- wp:button -->\n<div class=\"wp-block-button\"><a class=\"wp-block-button__link wp-element-button\" href=\"[download_link]\">Download WordPress [latest_version]</a></div>\n<!-- /wp:button --></div>\n<!-- /wp:buttons -->",
179183
"<!-- wp:buttons -->\n<div class=\"wp-block-buttons\"><!-- wp:button -->\n<div class=\"wp-block-button\"><a class=\"wp-block-button__link wp-element-button\" href=\"[download_link]\"><?php\n/* translators: [latest_version] is a shortcode and should not be translated. */\n_e( 'Download WordPress [latest_version]', 'wporg' );\n?></a></div>\n<!-- /wp:button --></div>\n<!-- /wp:buttons -->",
180184
],
185+
[
186+
// Modal, with shortcode in the label (shortcode in attribute).
187+
"<!-- wp:wporg/modal {\"closeButtonColor\":\"white\",\"customCloseButtonColor\":\"#ffffff\",\"href\":\"[download_link]\",\"label\":\"Download WordPress [latest_version]\"} -->\n<!-- wp:group -->\n<div class=\"wp-block-group\"><!-- wp:heading {\"style\":{\"spacing\":{\"margin\":{\"top\":\"0\"}}}} -->\n<h2 class=\"wp-block-heading\" style=\"margin-top:0\">Howdy!</h2>\n<!-- /wp:heading --></div>\n<!-- /wp:group -->\n<!-- /wp:wporg/modal -->",
188+
"<!-- wp:wporg/modal {\"closeButtonColor\":\"white\",\"customCloseButtonColor\":\"#ffffff\",\"href\":\"[download_link]\",\"label\":\"<?php /* translators: [latest_version] is a shortcode and should not be translated. */ _e( 'Download WordPress [latest_version]', 'wporg' ); ?>\"} -->\n<!-- wp:group -->\n<div class=\"wp-block-group\"><!-- wp:heading {\"style\":{\"spacing\":{\"margin\":{\"top\":\"0\"}}}} -->\n<h2 class=\"wp-block-heading\" style=\"margin-top:0\"><?php _e( 'Howdy!', 'wporg' ); ?></h2>\n<!-- /wp:heading --></div>\n<!-- /wp:group -->\n<!-- /wp:wporg/modal -->",
189+
],
181190
];
182191
}
183192

source/wp-content/themes/wporg-main-2022/functions.php

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -44,33 +44,6 @@ function enqueue_assets() {
4444
);
4545
wp_style_add_data( 'wporg-main-2022-style', 'rtl', 'replace' );
4646

47-
if ( is_page( 'download' ) ) {
48-
$path = __DIR__ . '/build/download/index.js';
49-
$deps_path = __DIR__ . '/build/download/index.asset.php';
50-
$script_info = file_exists( $deps_path )
51-
? require $deps_path
52-
: array(
53-
'dependencies' => array(),
54-
'version' => filemtime( $path ),
55-
);
56-
57-
wp_enqueue_script(
58-
'wporg-main-2022-download-script',
59-
get_stylesheet_directory_uri() . '/build/download/index.js',
60-
$script_info['dependencies'],
61-
$script_info['version'],
62-
true
63-
);
64-
65-
wp_enqueue_style(
66-
'wporg-main-2022-download-style',
67-
get_stylesheet_directory_uri() . '/build/download/style-index.css',
68-
array(),
69-
filemtime( __DIR__ . '/build/download/style-index.css' )
70-
);
71-
wp_style_add_data( 'wporg-main-2022-download-style', 'rtl', 'replace' );
72-
}
73-
7447
if ( is_page( 'stats' ) ) {
7548
// phpcs:ignore WordPress.WP.EnqueuedResourceParameters
7649
wp_enqueue_script( 'google-charts', 'https://www.gstatic.com/charts/loader.js', [], null, true );

source/wp-content/themes/wporg-main-2022/patterns/download.php

Lines changed: 43 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,51 @@
2828
<p class="is-style-short-text"><?php _e( 'For anyone comfortable getting their own hosting and domain.', 'wporg' ); ?></p>
2929
<!-- /wp:paragraph -->
3030

31-
<!-- wp:buttons {"layout":{"type":"flex","justifyContent":"left"},"style":{"spacing":{"blockGap":"10px"}}} -->
32-
<div class="wp-block-buttons"><!-- wp:button -->
33-
<div class="wp-block-button" id="wporg__download-button"><a class="wp-block-button__link wp-element-button" href="[download_link]"><?php
34-
/* translators: [latest_version] is a shortcode and should not be translated. */
35-
_e( 'Download WordPress [latest_version]', 'wporg' );
36-
?></a></div>
37-
<!-- /wp:button -->
31+
<!-- wp:group {"style":{"spacing":{"blockGap":"var:preset|spacing|10"}},"layout":{"type":"flex","flexWrap":"nowrap"}} -->
32+
<div class="wp-block-group"><!-- wp:wporg/modal {"closeButtonColor":"white","customCloseButtonColor":"#ffffff","href":"[download_link]","label":"<?php /* translators: [latest_version] is a shortcode and should not be translated. */ _e( 'Download WordPress [latest_version]', 'wporg' ); ?>"} -->
33+
<!-- wp:group {"style":{"elements":{"link":{"color":{"text":"var:preset|color|white"}}},"spacing":{"padding":{"top":"var:preset|spacing|40","bottom":"var:preset|spacing|30","left":"var:preset|spacing|40","right":"var:preset|spacing|40"},"blockGap":"var:preset|spacing|10"}},"backgroundColor":"blueberry-1","textColor":"white","layout":{"type":"constrained"}} -->
34+
<div class="wp-block-group has-white-color has-blueberry-1-background-color has-text-color has-background has-link-color" style="padding-top:var(--wp--preset--spacing--40);padding-right:var(--wp--preset--spacing--40);padding-bottom:var(--wp--preset--spacing--30);padding-left:var(--wp--preset--spacing--40)"><!-- wp:heading {"style":{"spacing":{"margin":{"top":"0"}}}} -->
35+
<h2 class="wp-block-heading" style="margin-top:0"><?php _e( 'Howdy!', 'wporg' ); ?></h2>
36+
<!-- /wp:heading -->
37+
38+
<!-- wp:paragraph {"fontSize":"extra-large","fontFamily":"eb-garamond"} -->
39+
<p class="has-eb-garamond-font-family has-extra-large-font-size"><?php _e( 'Thanks for downloading WordPress', 'wporg' ); ?></p>
40+
<!-- /wp:paragraph --></div>
41+
<!-- /wp:group -->
42+
43+
<!-- wp:group {"style":{"spacing":{"padding":{"top":"var:preset|spacing|30","bottom":"var:preset|spacing|40","left":"var:preset|spacing|40","right":"var:preset|spacing|40"}}},"layout":{"type":"constrained"}} -->
44+
<div class="wp-block-group" style="padding-top:var(--wp--preset--spacing--30);padding-right:var(--wp--preset--spacing--40);padding-bottom:var(--wp--preset--spacing--40);padding-left:var(--wp--preset--spacing--40)"><!-- wp:paragraph {"className":"is-style-default"} -->
45+
<p class="is-style-default"><?php _e( 'You&#039;re an important part of the global community that has used, built, and transformed the platform into what it is today. Find out more ways you can contribute and make an impact on the future of the web.', 'wporg' ); ?></p>
46+
<!-- /wp:paragraph -->
47+
48+
<!-- wp:group {"className":"is-style-default","style":{"spacing":{"blockGap":"0"}},"layout":{"type":"flex","orientation":"vertical"}} -->
49+
<div class="wp-block-group is-style-default"><!-- wp:paragraph -->
50+
<p><?php _e( '<a href="https://make.wordpress.org/">Get involved in WordPress ↗︎</a>', 'wporg' ); ?></p>
51+
<!-- /wp:paragraph -->
52+
53+
<!-- wp:paragraph -->
54+
<p><?php _e( '<a href="https://www.meetup.com/pro/wordpress/">Join a local WordPress meetup ↗︎</a>', 'wporg' ); ?></p>
55+
<!-- /wp:paragraph -->
56+
57+
<!-- wp:paragraph -->
58+
<p><?php _e( '<a href="https://central.wordcamp.org/">Attend a WordCamp ↗︎</a>', 'wporg' ); ?></p>
59+
<!-- /wp:paragraph -->
3860

39-
<!-- wp:button {"textColor":"blue-1","className":"is-style-outline"} -->
61+
<!-- wp:paragraph -->
62+
<p><?php _e( '<a href="https://wordpressfoundation.org/donate/">Support WordPress and open source education ↗︎</a>', 'wporg' ); ?></p>
63+
<!-- /wp:paragraph --></div>
64+
<!-- /wp:group --></div>
65+
<!-- /wp:group -->
66+
<!-- /wp:wporg/modal -->
67+
68+
<!-- wp:buttons {"style":{"spacing":{"blockGap":"10px"}},"layout":{"type":"flex","justifyContent":"left"}} -->
69+
<div class="wp-block-buttons"><!-- wp:button {"textColor":"blue-1","className":"is-style-outline"} -->
4070
<div class="wp-block-button is-style-outline"><a class="wp-block-button__link has-blue-1-color has-text-color wp-element-button" href="<?php _e( 'https://developer.wordpress.org/advanced-administration/before-install/howto-install/', 'wporg' ); ?>"><?php _e( 'Installation guide', 'wporg' ); ?></a></div>
4171
<!-- /wp:button --></div>
42-
<!-- /wp:buttons -->
72+
<!-- /wp:buttons --></div>
73+
<!-- /wp:group -->
4374

44-
<!-- wp:paragraph {"textColor":"charcoal-4","className":"is-style-short-text","fontSize":"small"} -->
75+
<!-- wp:paragraph {"className":"is-style-short-text","textColor":"charcoal-4","fontSize":"small"} -->
4576
<p class="is-style-short-text has-charcoal-4-color has-text-color has-small-font-size"><?php
4677
/* translators: [recommended_php], [recommended_mysql], [recommended_mariadb] are shortcodes and should not be translated. */
4778
_e( 'Recommend PHP [recommended_php] or greater and MySQL version [recommended_mysql] or MariaDB version [recommended_mariadb] or greater.', 'wporg' );
@@ -82,7 +113,7 @@
82113
<div class="wp-block-group alignfull has-blueberry-4-background-color has-background" id="features" style="padding-right:var(--wp--preset--spacing--edge-space);padding-left:var(--wp--preset--spacing--edge-space)"><!-- wp:columns {"verticalAlignment":"center","align":"wide","style":{"spacing":{"blockGap":{"top":"var:preset|spacing|30","left":"var:preset|spacing|70"}}}} -->
83114
<div class="wp-block-columns alignwide are-vertically-aligned-center"><!-- wp:column {"verticalAlignment":"center","width":"50%","style":{"spacing":{"padding":{"right":"0"}}}} -->
84115
<div class="wp-block-column is-vertically-aligned-center" style="padding-right:0;flex-basis:50%"><!-- wp:list {"className":"is-style-features"} -->
85-
<ul class="is-style-features"><!-- wp:list-item -->
116+
<ul class="wp-block-list is-style-features"><!-- wp:list-item -->
86117
<li><?php _e( 'Simple', 'wporg' ); ?></li>
87118
<!-- /wp:list-item -->
88119

@@ -134,7 +165,7 @@
134165

135166
<!-- wp:column -->
136167
<div class="wp-block-column"><!-- wp:list {"className":"is-style-links-list"} -->
137-
<ul class="is-style-links-list"><!-- wp:list-item -->
168+
<ul class="wp-block-list is-style-links-list"><!-- wp:list-item -->
138169
<li><?php _e( '<a href="https://learn.wordpress.org/course/getting-started-with-wordpress-get-setup/">WordPress courses ↗</a>', 'wporg' ); ?></li>
139170
<!-- /wp:list-item -->
140171

source/wp-content/themes/wporg-main-2022/src/components/download-modal/download-modal.js

Lines changed: 0 additions & 45 deletions
This file was deleted.

source/wp-content/themes/wporg-main-2022/src/components/download-modal/index.js

Lines changed: 0 additions & 39 deletions
This file was deleted.

source/wp-content/themes/wporg-main-2022/src/download/block.json

Lines changed: 0 additions & 3 deletions
This file was deleted.

source/wp-content/themes/wporg-main-2022/src/download/index.js

Lines changed: 0 additions & 19 deletions
This file was deleted.

source/wp-content/themes/wporg-main-2022/src/download/style.scss

Lines changed: 0 additions & 101 deletions
This file was deleted.

0 commit comments

Comments
 (0)