Changeset 1729782
- Timestamp:
- 09/14/2017 09:52:58 AM (9 years ago)
- Location:
- post-typographer/trunk
- Files:
-
- 2 edited
-
readme.txt (modified) (4 diffs)
-
typopost.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
post-typographer/trunk/readme.txt
r821548 r1729782 2 2 Tags: typography, formatting, post, posts, plugin 3 3 Requires at least: 2.5 4 Tested up to: 3.8 5 Stable tag: 10 4 Tested up to: 4.8.1 5 Stable tag: 11 6 Author: Andriy Moraru 7 Version: 11 8 Author URI: https://www.earnforex.com 6 9 7 Adds non-breaking spaces, <nobr> tags, common spaces, tags and dashes where needed. Works with English texts only. 10 11 Adds non-breaking spaces, `<nobr>` tags, common spaces, tags and dashes where needed. Works with English texts only. 8 12 9 13 == Description == 10 14 11 When you publish a post or update an already published post, this plugin will 12 format the post's content to certain typographic rules: 15 When you publish a post or update an already published post, this plugin will format the post's content to certain typographic rules: 13 16 14 1. All hyphens between two words (surrounded by spaces) will be transformed to 15 m-dashes with the non-breaking spaces ahead of them. 16 2. All hyphens between digits (without spaces) will be transformed to n-dashes. 17 But it tries to preserve phone numbers. 18 3. All spaces following these words will be replaced with the non-breaking 19 spaces: 17 1. All hyphens between two words (surrounded by spaces) will be transformed to m-dashes with the non-breaking spaces ahead of them. 20 18 19 2. All hyphens between digits (without spaces) will be transformed to n-dashes. But it tries to preserve phone numbers. 20 21 3. All spaces following these words will be replaced with the non-breaking spaces: 21 22 * at 22 23 23 * or 24 25 24 * and 26 27 25 * the 28 29 26 * a 30 31 27 * an 32 33 28 * in 34 35 29 * on 36 37 30 * of 38 39 31 * for 40 41 32 * to 42 43 33 * as 44 45 34 * i 46 47 35 * or 48 49 36 * my 50 37 51 38 4. Double and more spaces are replaced with the single ones. 52 39 53 5. All misplaced spaces near dots, colons, semicolons, exclamation 54 marks and question marks are fixed, where possible. 40 5. All misplaced spaces near dots, colons, semicolons, exclamation marks and question marks are fixed, where possible. 55 41 56 6. Composed words with hyphens in them (e.g. "easy-to-use") will be wrapped in 57 `<nobr></nobr>` tags. 42 6. Composed words with hyphens in them (e.g. *easy-to-use*) will be wrapped in `<nobr></nobr>` tags. 58 43 59 44 7. `<pre></pre>` tag and its contents are preserved. … … 61 46 Porblems: 62 47 63 1. The plugin **won't** mess with the HTML tags or other mark-up tags delimited 64 with < and >. It **will** mess with the Javascript code and such constructions 65 as:` 48 1. The plugin **will not** mess with the HTML tags or other mark-up tags delimited with < and >. It **will** mess with the Javascript code and such constructions as: 49 ` 66 50 [code] 67 51 bla bla bla 68 52 [/code] 69 53 ` 70 Though, since version 6 the mess is minimized for [code] and [video] tags.71 54 72 2. The n-dash thing will mess up with the phone numbers that have only one 73 hyphen in them. They will be confused with the value ranges. 55 Though, since version 6, the mess is minimized for [code] and [video] tags. 56 57 2. The n-dash thing will mess up with the phone numbers that have only one hyphen in them. They will be confused with the value ranges. 74 58 75 59 == Installation == 76 60 77 1. Upload `typopost.php` to the `/wp-content/plugins/` directory. 78 2. Activate the plugin through the 'Plugins' menu in your WordPress Admin section. 61 = From your WordPress dashboard = 62 63 1. Visit ‘Plugins > Add New’ 64 2. Search for ‘Post Typographer’ 65 3. Activate Post Typographer from your Plugins page. 66 67 = From WordPress.org = 68 69 1. Download Post Typographer. 70 2. Upload the ‘post-typographer’ directory to your ‘/wp-content/plugins/’ directory. 71 3. Activate Post Typographer from your Plugins page. 79 72 80 73 == Changelog == 81 74 75 = 11 = 76 * Fixed: Contents of <pre></pre> tag aren't messed up with typographing. 77 82 78 = 10 = 83 * Fixed: Contents of <pre></pre>tag aren't messed up with typographing.79 * Fixed: Contents of `<pre></pre>` tag aren't messed up with typographing. 84 80 85 81 = 9 = … … 88 84 89 85 = 8 = 90 * Added: Tries to remove unneded spaces before colons and semicolons without 91 messing with the smiles. 86 * Added: Tries to remove unneeded spaces before colons and semicolons without messing with the smiles. 92 87 * Added: Word 'by' included to the list of words for ` ` after them. 93 88 94 89 = 7 = 95 * Fixed: No longer removes spaces before colons and semicolons - not to mess 96 with the smiles. 90 * Fixed: No longer removes spaces before colons and semicolons - not to mess with the smiles. 97 91 98 92 = 6 = 99 * Fixed: Double (and more) warpping with the <nobr> tags. 100 * Fixed: <nobr> wrapping and some other formatting in the [code] and [video] 101 embedded text. 93 * Fixed: Double (and more) warpping with the `<nobr>` tags. 94 * Fixed: `<nobr>` wrapping and some other formatting in the [code] and [video] embedded text. 102 95 103 96 = 5 = 104 * Added: Wrapping the composed words with hyphens with <nobr>tags.97 * Added: Wrapping the composed words with hyphens with `<nobr>` tags. 105 98 106 99 = 4 = 107 100 * Fixed: Nasty double-space bug on post-updating. 108 101 * Fixed: M-dash placement didn't work in version 3. 109 * Fixed: N-dashes are now placed correctly even if the value ranges are near the 110 beginning or the end of the text. 102 * Fixed: N-dashes are now placed correctly even if the value ranges are near the beginning or the end of the text. 111 103 112 104 = 3 = 113 105 * Added: Replaces misplaced spaces near punctuation marks. 114 * Fixed: Phone numbers and dates are now avoided (except single-hyphen phone 115 numbers) when the hyphens in the value ranges are transformed into n-dashes. 106 * Fixed: Phone numbers and dates are now avoided (except single-hyphen phone numbers) when the hyphens in the value ranges are transformed into n-dashes. 116 107 117 108 = 2 = … … 124 115 == Thanks to == 125 116 126 [Typograf by Artemy Lebedev](http ://www.artlebedev.ru/tools/typograf/)117 [Typograf by Artemy Lebedev](https://www.artlebedev.ru/typograf/) -
post-typographer/trunk/typopost.php
r288046 r1729782 2 2 /* 3 3 Plugin Name: Post Typographer 4 Plugin URI: http ://wordpress.org/extend/plugins/post-typographer/4 Plugin URI: https://wordpress.org/plugins/post-typographer/ 5 5 Description: Formats the text according to typography rules. Works with English texts only. 6 6 Author: Andriy Moraru 7 Version: 1 08 Author URI: http ://www.topforexnews.com7 Version: 11 8 Author URI: https://www.earnforex.com 9 9 */ 10 10 … … 54 54 55 55 //Add m-dashes with a preceeding non-breaking space, in place of the hyphens, where neeeded 56 $without_html[$i] = str_replace(' - ', ' & #8212; ', $without_html[$i]);56 $without_html[$i] = str_replace(' - ', ' — ', $without_html[$i]); 57 57 58 58 //Get the array of strings made of text without text wrapped with [] tags … … 68 68 $without_square[$j] = preg_replace('@(,|!|\?)([a-z]+)@i', "\$1 \$2", $without_square[$j]); 69 69 //Add n-dashes in place of hyphens in the numeric ranges, skipping the supposed phone numbers 70 $without_square[$j] = preg_replace('@((^|[^\-^0-9])[0-9]+)-([0-9]+([^0-9^\-]|$))@', "\$1& #8211;\$3", $without_square[$j]);70 $without_square[$j] = preg_replace('@((^|[^\-^0-9])[0-9]+)-([0-9]+([^0-9^\-]|$))@', "\$1–\$3", $without_square[$j]); 71 71 //Wrap composed words with hyphens with <nobr> tag 72 72 $without_square[$j] = preg_replace('@(([a-zA-Z]+)(-([a-zA-Z]+))+)@', "<nobr>\$1</nobr>", $without_square[$j]);
Note: See TracChangeset
for help on using the changeset viewer.