Changeset 177157
- Timestamp:
- 11/26/2009 09:48:09 AM (16 years ago)
- Location:
- post-typographer/trunk
- Files:
-
- 2 edited
-
readme.txt (modified) (3 diffs)
-
typopost.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
post-typographer/trunk/readme.txt
r176896 r177157 3 3 Requires at least: 2.5 4 4 Tested up to: 2.8.6 5 Stable tag: 75 Stable tag: 8 6 6 7 7 Adds non-breaking spaces, <nobr> tags, common spaces, tags and dashes where needed. Works with English texts only. … … 34 34 * my 35 35 4. Double and more spaces are replaced with the single ones. 36 5. All misplaced spaces near dots, colons, exclamation36 5. All misplaced spaces near dots, colons, semicolons, exclamation 37 37 marks and question marks are fixed, where possible. 38 38 6. Composed words with hyphens in them (e.g. "easy-to-use") will be wrapped in … … 59 59 60 60 == Changelog == 61 62 = 8 = 63 * Added: Tries to remove unneded spaces before colons and semicolons without 64 messing with the smiles. 65 * Added: Word 'by' included to the list of words for ` ` after them. 61 66 62 67 = 7 = -
post-typographer/trunk/typopost.php
r176896 r177157 5 5 Description: Formats the text according to typography rules. Works with English texts only. 6 6 Author: Andriy Moraru 7 Version: 77 Version: 8 8 8 Author URI: http://www.topforexnews.com 9 9 */ … … 53 53 { 54 54 //Remove space before the punctuation marks that are placed directly after the words 55 $without_square[$j] = preg_replace('@ (\.|,| !|\?)@', "\$1", $without_square[$j]);55 $without_square[$j] = preg_replace('@ (\.|,|(: )|(; )|!|\?)@', "\$1", $without_square[$j]); 56 56 //Add space after the punctuation marks where needed 57 57 $without_square[$j] = preg_replace('@(,|!|\?)([a-z]+)@i', "\$1 \$2", $without_square[$j]); … … 61 61 $without_square[$j] = preg_replace('@(([a-zA-Z]+)(-([a-zA-Z]+))+)@', "<nobr>\$1</nobr>", $without_square[$j]); 62 62 //Add non-breaking spaces 63 $new_content .= preg_replace("@(?<!')\b(at|or|and|the|a| an|in|on|of|for|to|as|i|or|my) @i", "\$1 ", $without_square[$j]);63 $new_content .= preg_replace("@(?<!')\b(at|or|and|the|a|by|an|in|on|of|for|to|as|i|or|my) @i", "\$1 ", $without_square[$j]); 64 64 if ($j < $n_square) $new_content .= $square[0][$j]; 65 65 }
Note: See TracChangeset
for help on using the changeset viewer.