Opened 4 months ago
Last modified 4 months ago
#23185 new defect (bug)
Hyphens surrounded by non-breaking spaces are not texturized
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Awaiting Review |
| Component: | Formatting | Version: | 2.8 |
| Severity: | normal | Keywords: | has-patch |
| Cc: | pavelevap@… |
Description (last modified by SergeyBiryukov)
Thanks to Ticket #8161, a single hyphen or double hyphen surounded by space is converted to an en-dash or em-dash, respectively.
The problem is this conversion doesn't take place as expected when the space immediately before or after the affected hypehns is a non-breaking space.
Example paste the following into a post as HTML and view it in a browser after texturization:
Line 1 - Non-breaking spaces around the hyphen.<br> Line 2 - Regular spaces around the hyphen.<br> Line 3 - Non-breaking space before the hyphen.<br> Line 4 -- Non-breaking space after the double-hyphen.<br> Line 5 -- Regular spaces around the double-hyphen.
Only the lines where "Regular spaces" are around the hyphens get converted as expected.Lines 1, 3, and 4 are not converted to match their regular-space counterparts.
It's reasonable to use non-breaking spaces in web content and I think that for situations where a non-breaking space is used it should imply the same kind of texturization for the hyphens as a regular space does.
The attached patch removes the static replacement rules for hyphens and adds dynamic rules to meet this expectation. I had to add a dynamic rule '--' to prevent it being prematurely converted in the static phase, when it was surrounded by appropriate spacing. Since I havd to move that one from static to dynamic, it made sense to me to just have all the hyphen-conversion behavior in one place in dynamic.
Attachments (2)
Change History (7)
redsweater — 4 months ago
comment:1
redsweater — 4 months ago
comment:2
redsweater — 4 months ago
- Keywords has-patch added
- Cc pavelevap@… added
Yes, I noticed the same thing: #16957 (point 2).
comment:4
SergeyBiryukov — 4 months ago
In 1185/tests:
comment:5
SergeyBiryukov — 4 months ago
- Description modified (diff)
- Version changed from trunk to 2.8

Note: I will come up with a unit testing case for this and attach it ASAP.