Changeset 2042928
- Timestamp:
- 03/02/2019 06:51:19 PM (7 years ago)
- Location:
- space-lover/trunk
- Files:
-
- 2 edited
-
README.txt (modified) (3 diffs)
-
space-lover.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
space-lover/trunk/README.txt
r1983669 r2042928 5 5 Requires at least: 3.5.1 6 6 Tested up to: 5.0 7 Stable tag: 1.1. 47 Stable tag: 1.1.5 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 85 85 == Changelog == 86 86 87 = 1.1.5 = 88 * Fix: wrong closing punc condition, props John Shen 89 87 90 = 1.1.4 = 88 91 * Fix: missing space for special halfwidth characters, props John Shen … … 153 156 == Upgrade Notice == 154 157 158 = 1.1.5 = 159 * Fix: wrong closing punc condition, props John Shen 160 155 161 = 1.1.4 = 156 162 * Fix: missing space for special halfwidth characters, props John Shen -
space-lover/trunk/space-lover.php
r1983669 r2042928 11 11 * Plugin URI: https://sparanoid.com/work/space-lover/ 12 12 * Description: Magically add an extra space between Chinese characters and English letters / numbers / common punctuation marks 13 * Version: 1.1. 413 * Version: 1.1.5 14 14 * Author: Tunghsiao Liu 15 15 * Author URI: https://sparanoid.com/ … … 68 68 69 69 // Space for HTML tags 70 // https://regex101.com/r/hU3wD2/22 70 // https://regex101.com/r/hU3wD2/25 71 72 // {中文}<tag>{英文/数字/起始标点/特殊符号} 73 // 一台<a href="#">“Makerbot,二代”</a>3D打印机 71 74 $content = preg_replace('~(\p{Han})(<(?!ruby)[a-zA-Z]+?[^>]*?>)([a-zA-Z0-9\p{Ps}\p{Pi}@$#])~u', '\1 \2\3', $content); 72 $content = preg_replace('~(\p{Han})(<\/(?!ruby)[a-zA-Z]+>)([a-zA-Z0-9\p{Pe}\p{Pf}@$#])~u', '\1\2 \3', $content); 75 76 // {中文}</tag>{英文/数字} 77 // <code>Makerbot二代</code>3D打印机 78 $content = preg_replace('~(\p{Han})(<\/(?!ruby)[a-zA-Z]+>)([a-zA-Z0-9])~u', '\1\2 \3', $content); 79 80 // {英文/数字/闭合标点/特殊符号}<tag>{中文} 81 // 买了一台Makerbot,<a href="#">二代3D</a>打印机 73 82 $content = preg_replace('~([a-zA-Z0-9\p{Pe}\p{Pf}!?‽:;,.%])(<(?!ruby)[a-zA-Z]+?[^>]*?>)(\p{Han})~u', '\1 \2\3', $content); 83 84 // {英文/数字/起始标点/特殊符号}</tag>{中文} 85 // 买了一台Makerbot,<a href="#">二代3D</a>打印机 74 86 $content = preg_replace('~([a-zA-Z0-9\p{Ps}\p{Pi}!?‽:;,.%])(<\/(?!ruby)[a-zA-Z]+>)(\p{Han})~u', '\1\2 \3', $content); 75 87
Note: See TracChangeset
for help on using the changeset viewer.