diff --git a/includes/create-theme/theme-locale.php b/includes/create-theme/theme-locale.php index 3016dd10..110b38d0 100644 --- a/includes/create-theme/theme-locale.php +++ b/includes/create-theme/theme-locale.php @@ -125,6 +125,13 @@ private static function get_text_replacement_patterns_for_html( $block_name ) { return array( '/(alt=")(.*?)(")/' ); case 'core/details': return array( '/(]*>)(.*?)(<\/summary>)/' ); + case 'core/file': + return array( + // File-name link: without the boolean `download` attribute. + '/(])[^>])*?>)(.*?)(<\/a>)/', + // Download button: . + '/(]*\sdownload[^>]*?>)(.*?)(<\/a>)/', + ); default: return null; } @@ -197,6 +204,7 @@ public static function escape_text_content_of_blocks( $blocks ) { case 'core/cover': case 'core/media-text': case 'core/details': + case 'core/file': $replace_content_callback = function ( $content, $pattern ) { if ( empty( $content ) ) { return; diff --git a/tests/CbtThemeLocale/escapeTextContentOfBlocks.php b/tests/CbtThemeLocale/escapeTextContentOfBlocks.php index 40c4f631..0eb79687 100644 --- a/tests/CbtThemeLocale/escapeTextContentOfBlocks.php +++ b/tests/CbtThemeLocale/escapeTextContentOfBlocks.php @@ -28,12 +28,12 @@ public function test_escape_text_content_of_blocks( $block_markup, $expected_mar public function data_test_escape_text_content_of_blocks() { return array( - 'paragraph' => array( + 'paragraph' => array( 'block_markup' => '

This is a test text.

', 'expected_markup' => '

', ), - 'paragraph on nested groups' => array( + 'paragraph on nested groups' => array( 'block_markup' => '
@@ -52,7 +52,7 @@ public function data_test_escape_text_content_of_blocks() { ', ), - 'heading 1' => array( + 'heading 1' => array( 'block_markup' => '

A passion for creating spaces

@@ -63,7 +63,7 @@ public function data_test_escape_text_content_of_blocks() { ', ), - 'heading 2' => array( + 'heading 2' => array( 'block_markup' => '

A passion for creating spaces

@@ -74,7 +74,7 @@ public function data_test_escape_text_content_of_blocks() { ', ), - 'list item' => array( + 'list item' => array( 'block_markup' => '