Fix parsing function call arguments when arg strings contain commas
This commit is contained in:
11
RoboFile.php
11
RoboFile.php
@ -99,15 +99,8 @@ class RoboFile extends \Robo\Tasks {
|
|||||||
|
|
||||||
function makepot() {
|
function makepot() {
|
||||||
return $this->_exec('./node_modules/.bin/grunt makepot'.
|
return $this->_exec('./node_modules/.bin/grunt makepot'.
|
||||||
' --gruntfile '.__DIR__.'/tasks/makepot/makepot.js'.
|
' --gruntfile='.__DIR__.'/tasks/makepot/makepot.js'.
|
||||||
' --base_path '.__DIR__
|
' --base_path='.__DIR__
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function pushpot() {
|
|
||||||
return $this->_exec('./node_modules/.bin/grunt pushpot'.
|
|
||||||
' --gruntfile '.__DIR__.'/tasks/makepot/makepot.js'.
|
|
||||||
' --base_path '.__DIR__
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,10 +23,13 @@ module.exports = function (grunt) {
|
|||||||
cwd: '.', // base path where to look for translatable strings
|
cwd: '.', // base path where to look for translatable strings
|
||||||
domainPath: 'lang', // where to save the .pot
|
domainPath: 'lang', // where to save the .pot
|
||||||
exclude: [
|
exclude: [
|
||||||
'build/.*',
|
'assets/.*',
|
||||||
|
'lang/.*',
|
||||||
|
'node_modules/.*',
|
||||||
|
'plugin_repository/.*',
|
||||||
|
'tasks/.*',
|
||||||
'tests/.*',
|
'tests/.*',
|
||||||
'vendor/.*',
|
'vendor/.*'
|
||||||
'tasks/.*'
|
|
||||||
],
|
],
|
||||||
mainFile: 'index.php', // Main project file.
|
mainFile: 'index.php', // Main project file.
|
||||||
potFilename: 'mailpoet.pot', // Name of the POT file.
|
potFilename: 'mailpoet.pot', // Name of the POT file.
|
||||||
|
5
tasks/makepot/node_modules/grunt-wp-i18n/vendor/wp-i18n-tools/extract.php
generated
vendored
5
tasks/makepot/node_modules/grunt-wp-i18n/vendor/wp-i18n-tools/extract.php
generated
vendored
@ -270,11 +270,12 @@ class StringExtractor {
|
|||||||
$line_number = strlen($before) - strlen(str_replace("\n", "", $before)) + 1;
|
$line_number = strlen($before) - strlen(str_replace("\n", "", $before)) + 1;
|
||||||
|
|
||||||
// extract arguments (potentially multiple)
|
// extract arguments (potentially multiple)
|
||||||
$arguments_pattern = "/([^,\\s][^\\,]*)[^,\\s]*/s";
|
$arguments_pattern = "/(?s)(?<!\\\\)(\"|')(?:[^\\\\]|\\\\.)*?\\1|[^,\\s]+/";
|
||||||
preg_match_all($arguments_pattern, $matches[2][$i][0], $arguments_matches);
|
preg_match_all($arguments_pattern, $matches[2][$i][0], $arguments_matches);
|
||||||
|
|
||||||
|
//echo var_dump($arguments_matches[0]);
|
||||||
$arguments = array();
|
$arguments = array();
|
||||||
foreach($arguments_matches[1] as $arg) {
|
foreach($arguments_matches[0] as $arg) {
|
||||||
$arguments[] = trim($arg, "'\"");
|
$arguments[] = trim($arg, "'\"");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -241,4 +241,4 @@
|
|||||||
'mailerResumeSendingButton': __('Resume sending'),
|
'mailerResumeSendingButton': __('Resume sending'),
|
||||||
'mailerSendingResumedNotice': __('Sending has been resumed.')
|
'mailerSendingResumedNotice': __('Sending has been resumed.')
|
||||||
}) %>
|
}) %>
|
||||||
<% endblock %>
|
<% endblock %>
|
||||||
|
Reference in New Issue
Block a user