Changeset 169677
- Timestamp:
- 11/02/2009 04:07:42 PM (16 years ago)
- Location:
- post-typographer/trunk
- Files:
-
- 2 edited
-
readme.txt (modified) (3 diffs)
-
typopost.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
post-typographer/trunk/readme.txt
r142686 r169677 2 2 Tags: typography, formatting, post, posts, plugin 3 3 Requires at least: 2.5 4 Tested up to: 2.8. 35 Stable tag: 44 Tested up to: 2.8.5 5 Stable tag: 5 6 6 7 Adds non-breaking spaces, common spaces and dashes where needed. Works with English texts only.7 Adds non-breaking spaces, <nobr> tags, common spaces, tags and dashes where needed. Works with English texts only. 8 8 9 9 == Description == … … 36 36 5. All misplaced spaces near dots, commas, semicolons, colons, exclamation 37 37 marks and question marks are fixed, where possible. 38 6. Composed words with hyphens in them (e.g. easy-to-use) will be wrapped in 39 <nobr></nobr> tags. 38 40 39 41 Porblems: … … 56 58 57 59 == Changelog == 60 61 = 5 = 62 * Added: Wrapping the composed words with hyphens with <nobr> tags. 58 63 59 64 = 4 = -
post-typographer/trunk/typopost.php
r142371 r169677 35 35 $content = preg_replace('@ {2,}@', ' ', $content); 36 36 37 //Add m-dashes with a preceeding non-breaking space in place of the hyphenswhere neeeded37 //Add m-dashes with a preceeding non-breaking space, in place of the hyphens, where neeeded 38 38 $content = str_replace(' - ', ' — ', $content); 39 39 … … 52 52 //Add n-dashes in place of hyphens in the numeric ranges, skipping the supposed phone numbers 53 53 $without_html[$i] = preg_replace('@((^|[^\-^0-9])[0-9]+)-([0-9]+([^0-9^\-]|$))@', "\$1–\$3", $without_html[$i]); 54 //Wrap composed words with hyphens with <nobr> tag 55 $without_html[$i] = preg_replace('@(([a-zA-Z]+)(-([a-zA-Z]+))+)@', "<nobr>\$1</nobr>", $without_html[$i]); 54 56 //Add non-breaking spaces 55 57 $new_content .= preg_replace("@(?<!')\b(at|or|and|the|a|an|in|on|of|for|to|as|i|or|my) @i", "\$1 ", $without_html[$i]);
Note: See TracChangeset
for help on using the changeset viewer.