1 | Index: Gruntfile.js |
---|
2 | =================================================================== |
---|
3 | [1;31m--- Gruntfile.js (revision 38086)[0;0m |
---|
4 | [1;34m+++ Gruntfile.js (working copy)[0;0m |
---|
5 | [1;35m@@ -591,6 +591,36 @@[0;0m |
---|
6 | [0;0m dest: '.'[0;0m |
---|
7 | [0;0m }[0;0m |
---|
8 | [0;0m },[0;0m |
---|
9 | [1;34m+ replace: {[0;0m |
---|
10 | [1;34m+ emojiRegex: {[0;0m |
---|
11 | [1;34m+ options: {[0;0m |
---|
12 | [1;34m+ patterns: [[0;0m |
---|
13 | [1;34m+ {[0;0m |
---|
14 | [1;34m+ match: /\/\/ START: emoji regex[\S\s]*\/\/ END: emoji regex/g,[0;0m |
---|
15 | [1;34m+ replacement: function () {[0;0m |
---|
16 | [1;34m+ var twemoji = grunt.file.read( SOURCE_DIR + 'wp-includes/js/twemoji.js' );[0;0m |
---|
17 | [1;34m+ var found = twemoji.match( /re = \/(.*)\/g,/ );[0;0m |
---|
18 | [1;34m+ var emojiRegex = found[1];[0;0m |
---|
19 | [1;34m+[0;0m |
---|
20 | [1;34m+ // Magically transform emojiRegex into a PHP-friendly regex here.[0;0m |
---|
21 | [1;34m+[0;0m |
---|
22 | [1;34m+ return "// START: emoji regex\n\treturn 'lol';\n\t// END: emoji regex";[0;0m |
---|
23 | [1;34m+ }[0;0m |
---|
24 | [1;34m+ }[0;0m |
---|
25 | [1;34m+ ][0;0m |
---|
26 | [1;34m+ },[0;0m |
---|
27 | [1;34m+ files: [[0;0m |
---|
28 | [1;34m+ {[0;0m |
---|
29 | [1;34m+ expand: true,[0;0m |
---|
30 | [1;34m+ flatten: true,[0;0m |
---|
31 | [1;34m+ src: [[0;0m |
---|
32 | [1;34m+ SOURCE_DIR + 'wp-includes/formatting.php'[0;0m |
---|
33 | [1;34m+ ],[0;0m |
---|
34 | [1;34m+ dest: SOURCE_DIR + 'wp-includes/'[0;0m |
---|
35 | [1;34m+ }[0;0m |
---|
36 | [1;34m+ ][0;0m |
---|
37 | [1;34m+ }[0;0m |
---|
38 | [1;34m+ },[0;0m |
---|
39 | [0;0m _watch: {[0;0m |
---|
40 | [0;0m all: {[0;0m |
---|
41 | [0;0m files: [[0;0m |
---|
42 | [1;35m@@ -687,6 +717,10 @@[0;0m |
---|
43 | [0;0m 'phpunit'[0;0m |
---|
44 | [0;0m ] );[0;0m |
---|
45 | [0;0m [0;0m |
---|
46 | [1;34m+ grunt.registerTask( 'precommit:emoji', [[0;0m |
---|
47 | [1;34m+ 'replace:emojiRegex'[0;0m |
---|
48 | [1;34m+ ] );[0;0m |
---|
49 | [1;34m+[0;0m |
---|
50 | [0;0m grunt.registerTask( 'precommit', 'Runs test and build tasks in preparation for a commit', function() {[0;0m |
---|
51 | [0;0m var done = this.async();[0;0m |
---|
52 | [0;0m var map = {[0;0m |
---|
53 | [1;35m@@ -752,6 +786,11 @@[0;0m |
---|
54 | [0;0m taskList.push( 'precommit:' + extension );[0;0m |
---|
55 | [0;0m }[0;0m |
---|
56 | [0;0m } );[0;0m |
---|
57 | [1;34m+[0;0m |
---|
58 | [1;34m+ if ( [ 'twemoji.js' ].some( testPath ) ) {[0;0m |
---|
59 | [1;34m+ grunt.log.writeln( 'twemoji.js has updated. Running `precomitt:emoji.' );[0;0m |
---|
60 | [1;34m+ taskList.push( 'precommit:emoji' );[0;0m |
---|
61 | [1;34m+ }[0;0m |
---|
62 | [0;0m }[0;0m |
---|
63 | [0;0m [0;0m |
---|
64 | [0;0m grunt.task.run( taskList );[0;0m |
---|
65 | Index: package.json |
---|
66 | =================================================================== |
---|
67 | [1;31m--- package.json (revision 38086)[0;0m |
---|
68 | [1;34m+++ package.json (working copy)[0;0m |
---|
69 | [1;35m@@ -27,6 +27,7 @@[0;0m |
---|
70 | [0;0m "grunt-legacy-util": "^0.2.0",[0;0m |
---|
71 | [0;0m "grunt-patch-wordpress": "~0.4.0",[0;0m |
---|
72 | [0;0m "grunt-postcss": "~0.7.1",[0;0m |
---|
73 | [1;34m+ "grunt-replace": "~1.0.1",[0;0m |
---|
74 | [0;0m "grunt-rtlcss": "~2.0.1",[0;0m |
---|
75 | [0;0m "grunt-sass": "~1.1.0",[0;0m |
---|
76 | [0;0m "matchdep": "~1.0.0"[0;0m |
---|
77 | Index: src/wp-includes/formatting.php |
---|
78 | =================================================================== |
---|
79 | [1;31m--- src/wp-includes/formatting.php (revision 38087)[0;0m |
---|
80 | [1;34m+++ src/wp-includes/formatting.php (working copy)[0;0m |
---|
81 | [1;35m@@ -5209,6 +5209,24 @@[0;0m |
---|
82 | [0;0m }[0;0m |
---|
83 | [0;0m [0;0m |
---|
84 | [0;0m /**[0;0m |
---|
85 | [1;34m+ * Returns a regex string to match all emoji that WordPress recognises.[0;0m |
---|
86 | [1;34m+ *[0;0m |
---|
87 | [1;34m+ * This regex is automatically built from the regex in twemoji.js - if it needs to be updated,[0;0m |
---|
88 | [1;34m+ * you should update the regex there, then run the `grunt precommit:emoji` job.[0;0m |
---|
89 | [1;34m+ *[0;0m |
---|
90 | [1;34m+ * @since 4.6.0[0;0m |
---|
91 | [1;34m+ *[0;0m |
---|
92 | [1;34m+ * @return string A regex to match all emoji that WordPress recognises.[0;0m |
---|
93 | [1;34m+ */[0;0m |
---|
94 | [1;34m+function wp_emoji_regex() {[0;0m |
---|
95 | [1;34m+ // Do not remove the START/END comments - they're used to find where to insert the regex.[0;0m |
---|
96 | [1;34m+[0;0m |
---|
97 | [1;34m+ // START: emoji regex[0;0m |
---|
98 | [1;34m+ return 'lol';[0;0m |
---|
99 | [1;34m+ // END: emoji regex[0;0m |
---|
100 | [1;34m+}[0;0m |
---|
101 | [1;34m+[0;0m |
---|
102 | [1;34m+/**[0;0m |
---|
103 | [0;0m * Shorten a URL, to be used as link text.[0;0m |
---|
104 | [0;0m *[0;0m |
---|
105 | [0;0m * @since 1.2.0[0;0m |
---|