WordPress.org

Make WordPress Core

Opened 7 years ago

Closed 6 years ago

#27588 closed defect (bug) (fixed)

Shortcodes and nbsp

Reported by: miqrogroove Owned by: DrewAPicture
Milestone: 4.0 Priority: normal
Severity: normal Version: 3.8
Component: Formatting Keywords: has-patch 4.0-early
Focuses: docs Cc:

Description

Continuing from #22692 and as a requirement for #26842, we need to make sure things like  [gallery ids="37,15,11"]  are treated the same as if they are surrounded by whitespace.

The patch for shortcode_unautop() is ready, and there could be other changes needed.

Attachments (3)

prior-work.patch (3.3 KB) - added by miqrogroove 7 years ago.
miqro-27588.patch (2.7 KB) - added by miqrogroove 6 years ago.
Refreshed
miqro-27588.2.patch (3.3 KB) - added by miqrogroove 6 years ago.
Filter docs added.

Download all attachments as: .zip

Change History (15)

#1 @miqrogroove
7 years ago

  • Keywords has-patch 4.0-early added

#2 follow-up: @wonderboymusic
6 years ago

In 28708:

Add a function: wp_spaces_regexp(). It is not used yet.

This function is required by a bunch of patches by miqrogroove. Needs filter docs.

Props miqrogroove.
See #27588.

#3 @wonderboymusic
6 years ago

  • Focuses docs added
  • Keywords needs-docs added

#4 follow-up: @SergeyBiryukov
6 years ago

What would be a use case for the wp_spaces_regexp filter?

#5 @wonderboymusic
6 years ago

Good question - if there isn't a good one, we can delete it.

#6 follow-up: @DrewAPicture
6 years ago

  • Milestone changed from Awaiting Review to 4.0

Seems like the use case would be to change the regex, unless I'm missing something, currently it includes "spaces include new lines, tabs, nbsp entities, and the UTF-8 nbsp".

Happy to write the hook docs if ya'll come to a consensus on whether to keep the filter.

#7 in reply to: ↑ 6 @SergeyBiryukov
6 years ago

Replying to DrewAPicture:

Seems like the use case would be to change the regex, unless I'm missing something, currently it includes "spaces include new lines, tabs, nbsp entities, and the UTF-8 nbsp".

Yeah, I mean, is there a need for this regex to be filterable?

#8 in reply to: ↑ 4 @miqrogroove
6 years ago

Replying to SergeyBiryukov:

What would be a use case for the wp_spaces_regexp filter?

Primarily for anyone not using UTF-8. NBSP has alternative encodings.

@miqrogroove
6 years ago

Refreshed

@miqrogroove
6 years ago

Filter docs added.

#9 in reply to: ↑ 2 @miqrogroove
6 years ago

  • Keywords needs-docs removed

Replying to wonderboymusic:

In 28708:

Add a function: wp_spaces_regexp(). It is not used yet.

This function is required by a bunch of patches by miqrogroove. Needs filter docs.

Props miqrogroove.
See #27588.

Thank you. Patch refreshed.

#10 @wonderboymusic
6 years ago

In 28716:

Ensure that shortcode_unautop() treats   like whitespace.
shortcode_unautop() and wptexturize() now use wp_spaces_regexp() instead of raw regex.

Adds unit tests.

Props miqrogroove.
See #27588.

#11 @wonderboymusic
6 years ago

  • Owner set to DrewAPicture
  • Status changed from new to assigned

Please review/alter/whatever the inline docs. If they're good, mark as fixed. Otherwise, commit whatever then mark as fixes.

#12 @DrewAPicture
6 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 28724:

Improve inline documentation for the wp_spaces_regexp filter.

Fixes #27588.

Note: See TracTickets for help on using tickets.