Plugin Directory

Changeset 169677


Ignore:
Timestamp:
11/02/2009 04:07:42 PM (16 years ago)
Author:
enivid
Message:
 
Location:
post-typographer/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • post-typographer/trunk/readme.txt

    r142686 r169677  
    22Tags: typography, formatting, post, posts, plugin
    33Requires at least: 2.5
    4 Tested up to: 2.8.3
    5 Stable tag: 4
     4Tested up to: 2.8.5
     5Stable tag: 5
    66
    7 Adds non-breaking spaces, common spaces and dashes where needed. Works with English texts only.
     7Adds non-breaking spaces, <nobr> tags, common spaces, tags and dashes where needed. Works with English texts only.
    88
    99== Description ==
     
    36365. All misplaced spaces near dots, commas, semicolons, colons, exclamation
    3737marks and question marks are fixed, where possible.
     386. Composed words with hyphens in them (e.g. easy-to-use) will be wrapped in
     39<nobr></nobr> tags.
    3840
    3941Porblems:
     
    5658
    5759== Changelog ==
     60
     61= 5 =
     62* Added: Wrapping the composed words with hyphens with <nobr> tags.
    5863
    5964= 4 =
  • post-typographer/trunk/typopost.php

    r142371 r169677  
    3535    $content = preg_replace('@ {2,}@', ' ', $content);
    3636
    37     //Add m-dashes with a preceeding non-breaking space in place of the hyphens where neeeded
     37    //Add m-dashes with a preceeding non-breaking space, in place of the hyphens, where neeeded
    3838    $content = str_replace(' - ', '&nbsp;&#8212; ', $content);
    3939
     
    5252            //Add n-dashes in place of hyphens in the numeric ranges, skipping the supposed phone numbers
    5353        $without_html[$i] = preg_replace('@((^|[^\-^0-9])[0-9]+)-([0-9]+([^0-9^\-]|$))@', "\$1&#8211;\$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]);
    5456        //Add non-breaking spaces
    5557        $new_content .= preg_replace("@(?<!')\b(at|or|and|the|a|an|in|on|of|for|to|as|i|or|my) @i", "\$1&nbsp;", $without_html[$i]);
Note: See TracChangeset for help on using the changeset viewer.