Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Comments: Add missing dots in wp-includes/formatting.php #8241

Conversation

Infinite-Null
Copy link

@Infinite-Null Infinite-Null commented Feb 3, 2025

Trac ticket: #62885

Description

This PR adds missing periods (dots) at the end of complete sentence comments in wp-includes/formatting.php.

Implements the changes from this diff in accordance with this comment. Additionally, I have identified and corrected a few other instances in the file where periods were missing at the end of sentences.

Changes:

  • Added missing periods to @return documentation blocks
  • Added missing periods to @param descriptions
  • Added missing periods to complete sentence inline comments
  • Added missing periods to section marker comments

Copy link

github-actions bot commented Feb 3, 2025

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props ankitkumarshah, peterwilsoncc.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@@ -6157,10 +6157,10 @@ function wp_staticize_emoji_for_email( $mail ) {
function _wp_emoji_list( $type = 'entities' ) {
// Do not remove the START/END comments - they're used to find where to insert the arrays.

// START: emoji arrays
// START: emoji arrays.
Copy link
Contributor

Choose a reason for hiding this comment

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

This comment is used as a placeholder to update the arrays below, to make these changes you will also need to update the grunt.js file to include the full stop (remember to escape the dots in the regex).

wordpress-develop/Gruntfile.js

Lines 1049 to 1116 in 99dd184

match: /\/\/ START: emoji arrays[\S\s]*\/\/ END: emoji arrays/g,
replacement: function() {
var regex, files, ghCli,
partials, partialsSet,
entities, emojiArray,
apiResponse, query;
grunt.log.writeln( 'Fetching list of Twemoji files...' );
// Ensure that the GitHub CLI is installed.
ghCli = spawn( 'gh', [ '--version' ] );
if ( 0 !== ghCli.status ) {
grunt.fatal( 'Emoji precommit script requires GitHub CLI. See https://cli.github.com/.' );
}
// Fetch a list of the files that Twemoji supplies.
query = 'query={repository(owner: "jdecked", name: "twemoji") {object(expression: "v15.0.3:assets/svg") {... on Tree {entries {name}}}}}';
files = spawn( 'gh', [ 'api', 'graphql', '-f', query] );
if ( 0 !== files.status ) {
grunt.fatal( files.stderr.toString() );
}
try {
apiResponse = JSON.parse( files.stdout.toString() );
} catch ( e ) {
grunt.fatal( 'Unable to parse Twemoji file list' );
}
entities = apiResponse.data.repository.object.entries;
entities = entities.reduce( function( accumulator, val ) { return accumulator + val.name + '\n'; }, '' );
// Tidy up the file list.
entities = entities.replace( /\.svg/g, '' );
entities = entities.replace( /^$/g, '' );
// Convert the emoji entities to HTML entities.
partials = entities = entities.replace( /([a-z0-9]+)/g, '&#x$1;' );
// Remove the hyphens between the HTML entities.
entities = entities.replace( /-/g, '' );
// Sort the entities list by length, so the longest emoji will be found first.
emojiArray = entities.split( '\n' ).sort( function( a, b ) {
return b.length - a.length;
} );
// Convert the entities list to PHP array syntax.
entities = '\'' + emojiArray.filter( function( val ) {
return val.length >= 8 ? val : false ;
} ).join( '\', \'' ) + '\'';
// Create a list of all characters used by the emoji list.
partials = partials.replace( /-/g, '\n' );
// Set automatically removes duplicates.
partialsSet = new Set( partials.split( '\n' ) );
// Convert the partials list to PHP array syntax.
partials = '\'' + Array.from( partialsSet ).filter( function( val ) {
return val.length >= 8 ? val : false ;
} ).join( '\', \'' ) + '\'';
regex = '// START: emoji arrays\n';
regex += '\t$entities = array( ' + entities + ' );\n';
regex += '\t$partials = array( ' + partials + ' );\n';
regex += '\t// END: emoji arrays';
return regex;

Copy link
Author

Choose a reason for hiding this comment

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

Thanks for catching this! You're absolutely right - I will revert the change to the "START: emoji arrays" comment since it's used as a marker for the Grunt task. I see now that modifying this would require coordinated changes in Gruntfile.js to update the regex pattern.

I'll update the PR to remove the period from this specific comment while keeping the other documentation improvements.

@Infinite-Null
Copy link
Author

Hi @peterwilsoncc,
I have made the necessary changes. Please review it at your convenience.
Thank You!

Copy link

github-actions bot commented Feb 4, 2025

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • The Plugin and Theme Directories cannot be accessed within Playground.
  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

@SergeyBiryukov
Copy link
Member

Thanks for the PR! Merged in r59765.

Copy link
Contributor

@peterwilsoncc peterwilsoncc left a comment

Choose a reason for hiding this comment

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

Just a minor note inline about the terminology WP uses but otherwise I think this is good.

@@ -4696,7 +4696,7 @@ function esc_attr( $text ) {
*
* @since 2.0.6
*
* @param string $safe_text The text after it has been escaped.
* @param string $safe_text The text after it has been sanitized and escaped.
Copy link
Contributor

Choose a reason for hiding this comment

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

esc_attr() is an escaping function, as WordPress uses the term sanitization for user input this could be confusing to developers.

Suggested change
* @param string $safe_text The text after it has been sanitized and escaped.
* @param string $safe_text The text after it has been escaped.

Copy link
Author

@Infinite-Null Infinite-Null Feb 6, 2025

Choose a reason for hiding this comment

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

Hi @peterwilsoncc,
Should I open a follow-up PR to address this issue?

Copy link
Contributor

Choose a reason for hiding this comment

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

@Infinite-Null Don't worry, it was more a nit pick than a particular concern.

Sorry about the coincidence of timing as I commented and Sergey committed. These things happen occasionally :)

Copy link
Author

Choose a reason for hiding this comment

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

No worries at all! I appreciate the clarification. Thank You 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants