wp-cli / scaffold-command

Generates code for post types, taxonomies, blocks, plugins, child themes, etc.
MIT License
165 stars 87 forks source link

When a block name contains a single quote it needs to be escaped #150

Closed salcode closed 6 years ago

salcode commented 6 years ago

When a block name contains a single quote (') it needs to be escaped

e.g.

wp scaffold block sal-block --title="Sal's Block" --plugin=sal-cool-plugin

generates an index.js file that includes

registerBlockType( 'sal-cool-plugin/sal-block', {
    /**
     * This is the display title for your block, which can be translated with `i18n` functions.
     * The block inserter will show this name.
     */
    title: __( 'Sal's Block' ),

where the title value causes an error due to the extra single quote.

I've not looked into doing it but I'm assuming we can escape ' in this value (title_ucfirst).

I'm happy to do a PR for this but I'm not able to at this moment.

salcode commented 6 years ago

Thanks for the fix @thrijith 👍