Ticket #35293: 35293.2.diff
File 35293.2.diff, 2.8 KB (added by , 9 years ago) |
---|
-
Gruntfile.js
591 591 dest: '.' 592 592 } 593 593 }, 594 replace: { 595 emojiRegex: { 596 options: { 597 patterns: [ 598 { 599 match: /\/\/ START: emoji regex[\S\s]*\/\/ END: emoji regex/g, 600 replacement: function () { 601 var twemoji = grunt.file.read( SOURCE_DIR + 'wp-includes/js/twemoji.js' ); 602 var found = twemoji.match( /re = \/(.*)\/g,/ ); 603 var emojiRegex = found[1]; 604 605 // Magically transform emojiRegex into a PHP-friendly regex here. 606 607 return "// START: emoji regex\n\treturn 'lol';\n\t// END: emoji regex"; 608 } 609 } 610 ] 611 }, 612 files: [ 613 { 614 expand: true, 615 flatten: true, 616 src: [ 617 SOURCE_DIR + 'wp-includes/formatting.php' 618 ], 619 dest: SOURCE_DIR + 'wp-includes/' 620 } 621 ] 622 } 623 }, 594 624 _watch: { 595 625 all: { 596 626 files: [ … … 687 717 'phpunit' 688 718 ] ); 689 719 720 grunt.registerTask( 'precommit:emoji', [ 721 'replace:emojiRegex' 722 ] ); 723 690 724 grunt.registerTask( 'precommit', 'Runs test and build tasks in preparation for a commit', function() { 691 725 var done = this.async(); 692 726 var map = { … … 752 786 taskList.push( 'precommit:' + extension ); 753 787 } 754 788 } ); 789 790 if ( [ 'twemoji.js' ].some( testPath ) ) { 791 grunt.log.writeln( 'twemoji.js has updated. Running `precomitt:emoji.' ); 792 taskList.push( 'precommit:emoji' ); 793 } 755 794 } 756 795 757 796 grunt.task.run( taskList ); -
package.json
27 27 "grunt-legacy-util": "^0.2.0", 28 28 "grunt-patch-wordpress": "~0.4.0", 29 29 "grunt-postcss": "~0.7.1", 30 "grunt-replace": "~1.0.1", 30 31 "grunt-rtlcss": "~2.0.1", 31 32 "grunt-sass": "~1.1.0", 32 33 "matchdep": "~1.0.0" -
src/wp-includes/formatting.php
5209 5209 } 5210 5210 5211 5211 /** 5212 * Returns a regex string to match all emoji that WordPress recognises. 5213 * 5214 * This regex is automatically built from the regex in twemoji.js - if it needs to be updated, 5215 * you should update the regex there, then run the `grunt precommit:emoji` job. 5216 * 5217 * @since 4.6.0 5218 * 5219 * @return string A regex to match all emoji that WordPress recognises. 5220 */ 5221 function wp_emoji_regex() { 5222 // Do not remove the START/END comments - they're used to find where to insert the regex. 5223 5224 // START: emoji regex 5225 return 'lol'; 5226 // END: emoji regex 5227 } 5228 5229 /** 5212 5230 * Shorten a URL, to be used as link text. 5213 5231 * 5214 5232 * @since 1.2.0