WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 2 years ago

Last modified 2 years ago

#37304 closed enhancement (fixed)

Allowing use of single quotes for shortcode empty value attributes

Reported by: enrico.sorcinelli Owned by: SergeyBiryukov
Milestone: 4.9 Priority: normal
Severity: normal Version: 4.6
Component: Shortcodes Keywords: has-patch has-unit-tests
Focuses: Cc:
PR Number:

Description

Recently I created a shortcode allowing empty value attributes.

An user added an empty attribute by surrounding it with single quotes, for example:

[my_shortcode 'foo']Lorem ipsum...[/my_shortcode]

I was surprised that the returned attribute still contains single quotes (for the empty value attributes, the double quotes are stripped instead).

Even if, of course, this is not a bug, I made a patch allowing also using single quotes for shortcode empty value attributes.

Regards

Attachments (5)

37304.patch (3.5 KB) - added by enrico.sorcinelli 3 years ago.
37304.2.patch (3.4 KB) - added by enrico.sorcinelli 3 years ago.
Updated
37304.3.patch (4.6 KB) - added by enrico.sorcinelli 3 years ago.
37304.4.patch (4.6 KB) - added by enrico.sorcinelli 2 years ago.
The updated patch for current trunk
37304.5.patch (4.6 KB) - added by enrico.sorcinelli 2 years ago.
I just updated the patch to trunk

Download all attachments as: .zip

Change History (18)

#1 @swissspidy
3 years ago

  • Keywords has-patch has-unit-tests added

@enrico.sorcinelli
3 years ago

Updated

#2 @enrico.sorcinelli
3 years ago

Hi,

I just sent the updated path for current trunk

Regards

#3 @SergeyBiryukov
3 years ago

  • Milestone changed from Awaiting Review to 4.8

#4 @swissspidy
3 years ago

Would be great to have the tests from #32172 added here if possible.

#5 @swissspidy
3 years ago

#32172 was marked as a duplicate.

#6 @enrico.sorcinelli
3 years ago

Hi @swissspidy, I just updated phpunit tests with those of #32172. I also added a more complete qunit test with mxed attributes.

This ticket was mentioned in Slack in #core by jeffpaul. View the logs.


3 years ago

#8 @swissspidy
3 years ago

  • Milestone changed from 4.8 to 4.8.1

I feel like this needs to soak in trunk for some time before going into a release.

Some more eyes on the patch would be helpful.

@enrico.sorcinelli
2 years ago

The updated patch for current trunk

#9 @enrico.sorcinelli
2 years ago

I just sent the updated patch for current trunk.

@enrico.sorcinelli
2 years ago

I just updated the patch to trunk

This ticket was mentioned in Slack in #core by enrico.sorcinelli. View the logs.


2 years ago

#11 @SergeyBiryukov
2 years ago

  • Milestone changed from 4.8.1 to 4.9

#12 @SergeyBiryukov
2 years ago

  • Owner set to SergeyBiryukov
  • Resolution set to fixed
  • Status changed from new to closed

In 41026:

Shortcodes: Allow using single quotes for empty value attributes.

Props enrico.sorcinelli.
Fixes #37304.

#13 @georgestephanis
2 years ago

On the off chance that this causes unit test failures for any other plugins, here's how we resolved it in Jetpack: https://github.com/Automattic/jetpack/pull/7473/files props @kraftbj

Note: See TracTickets for help on using tickets.