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() {
|
||||
return $this->_exec('./node_modules/.bin/grunt makepot'.
|
||||
' --gruntfile '.__DIR__.'/tasks/makepot/makepot.js'.
|
||||
' --base_path '.__DIR__
|
||||
);
|
||||
}
|
||||
|
||||
function pushpot() {
|
||||
return $this->_exec('./node_modules/.bin/grunt pushpot'.
|
||||
' --gruntfile '.__DIR__.'/tasks/makepot/makepot.js'.
|
||||
' --base_path '.__DIR__
|
||||
' --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
|
||||
domainPath: 'lang', // where to save the .pot
|
||||
exclude: [
|
||||
'build/.*',
|
||||
'assets/.*',
|
||||
'lang/.*',
|
||||
'node_modules/.*',
|
||||
'plugin_repository/.*',
|
||||
'tasks/.*',
|
||||
'tests/.*',
|
||||
'vendor/.*',
|
||||
'tasks/.*'
|
||||
'vendor/.*'
|
||||
],
|
||||
mainFile: 'index.php', // Main project 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;
|
||||
|
||||
// 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);
|
||||
|
||||
//echo var_dump($arguments_matches[0]);
|
||||
$arguments = array();
|
||||
foreach($arguments_matches[1] as $arg) {
|
||||
foreach($arguments_matches[0] as $arg) {
|
||||
$arguments[] = trim($arg, "'\"");
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user