Skip to content

Commit

Permalink
fix line. remove unused 'more' option
Browse files Browse the repository at this point in the history
  • Loading branch information
roo2 committed Dec 18, 2022
1 parent f9a12d0 commit 6555a7e
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions packages/block-library/src/rss/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,12 @@ function trim_to_word_boundary( $to_trim, $character_count, $more = ' […]
* Helper funtion to trim text up to the first period (.) followed by a space.
* If no period is found, the text is trimmed to the nearest word boundary.
* If multiple periods are found, the last one within $title_length is used.
*
*
* @param string $to_trim The text to trim.
* @param int $title_length The maximum number of characters to return.
* @param string $more The string to append to the trimmed text.
*/
function trim_title_from_excerpt( $to_trim, $title_length, $more = ' […]' ) {
$to_trim = trim_to_word_boundary($to_trim, $title_length, $more );
function trim_title_from_excerpt( $to_trim, $title_length ) {
$to_trim = trim_to_word_boundary( $to_trim, $title_length, '' );

// Match to the first period followed by a space.
preg_match( '/^.{0,' . $title_length . '}\.\s/', $to_trim, $parts );
Expand All @@ -43,7 +42,7 @@ function trim_title_from_excerpt( $to_trim, $title_length, $more = ' […]'
return $to_trim;
}

return $parts[0] . $more;
return $parts[0];
}

/**
Expand Down Expand Up @@ -79,7 +78,7 @@ function render_block_core_rss( $attributes ) {

if ( empty( $title ) ) {
// If the title is empty, use the begining of the excerpt instead.
$title = trim_title_from_excerpt( $excerpt_trimmed, $attributes['titleLength'], '' );
$title = trim_title_from_excerpt( $excerpt_trimmed, $attributes['titleLength'] );
if ( $attributes['displayExcerpt'] ) {
// Trim out the words that were used for the title.
$excerpt_trimmed = trim( substr( $excerpt_trimmed, strlen( $title ) ) );
Expand Down

1 comment on commit 6555a7e

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flaky tests detected.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/3727132909
📝 Reported issues:

Please sign in to comment.