Changeset 33292
- Timestamp:
- 07/16/2015 09:44:43 AM (9 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Gruntfile.js
r33129 r33292 400 400 }, 401 401 uglify: { 402 options: { 403 ASCIIOnly: true 404 }, 402 405 core: { 403 406 expand: true, -
trunk/src/wp-admin/js/word-count.js
r33290 r33292 15 15 HTMLRegExp: /<\/?[a-z][^>]*?>/gi, 16 16 spaceRegExp: / | /gi, 17 removeRegExp: /[0-9.(),;:!?%#$¿'"_+=\\\/-]+/g, 17 connectorRegExp: /--|\u2014/gi, 18 removeRegExp: new RegExp( [ 19 '[', 20 // Basic Latin (extract) 21 '\u0021-\u0040\u005B-\u0060\u007B-\u007E', 22 // Latin-1 Supplement (extract) 23 '\u0080-\u00BF\u00D7\u00F7', 24 // General Punctuation 25 // Superscripts and Subscripts 26 // Currency Symbols 27 // Combining Diacritical Marks for Symbols 28 // Letterlike Symbols 29 // Number Forms 30 // Arrows 31 // Mathematical Operators 32 // Miscellaneous Technical 33 // Control Pictures 34 // Optical Character Recognition 35 // Enclosed Alphanumerics 36 // Box Drawing 37 // Block Elements 38 // Geometric Shapes 39 // Miscellaneous Symbols 40 // Dingbats 41 // Miscellaneous Mathematical Symbols-A 42 // Supplemental Arrows-A 43 // Braille Patterns 44 // Supplemental Arrows-B 45 // Miscellaneous Mathematical Symbols-B 46 // Supplemental Mathematical Operators 47 // Miscellaneous Symbols and Arrows 48 '\u2000-\u2BFF', 49 // Supplemental Punctuation 50 '\u2E00-\u2E7F', 51 ']' 52 ].join( '' ), 'g' ), 18 53 wordsRegExp: /\S\s+/g, 19 54 charactersRegExp: /\S/g, … … 32 67 text = text.replace( this.settings.HTMLRegExp, '\n' ); 33 68 text = text.replace( this.settings.spaceRegExp, ' ' ); 34 text = text.replace( this.settings.removeRegExp, '' ); 69 70 if ( type === 'words' ) { 71 text = text.replace( this.settings.connectorRegExp, ' ' ); 72 text = text.replace( this.settings.removeRegExp, '' ); 73 } 35 74 36 75 text = text.match( this.settings[ type + 'RegExp' ] ); -
trunk/tests/qunit/wp-admin/js/word-count.js
r33290 r33292 34 34 { 35 35 message: 'Punctuation.', 36 string: 'It\'s two three ...4?',36 string: 'It\'s two three \u2026 4?', 37 37 words: 3, 38 characters: 11, 38 characters: 15, 39 all: 19 40 }, 41 { 42 message: 'Em dash.', 43 string: 'one\u2014two--three', 44 words: 3, 45 characters: 14, 39 46 all: 14 40 47 }
Note: See TracChangeset
for help on using the changeset viewer.