smhg / gettext-swig

Extract translatable strings from Swig template strings.
MIT License
1 stars 2 forks source link

Consider loosening the spaces match from '{{ +' to '{{ {0,3}' #3

Closed dschissler closed 9 years ago

dschissler commented 9 years ago

Its valid to have no spaces after the {{. I set it at up to a maximum of 3 spaces just because it could help if someone quickly pasted it in while testing. I was having issues with getting it to run until I browsed at the source.

  this.expressionPattern = new RegExp([
//    '{{ +',
    '{{ {0,3}',
    '(' + Object.keys(keywordSpec).map(escapeRegExp).join('|') + ')',
    '\\(',
    '([\\s\\S]*?)',
    '\\)',
    ' {0,3}}}'
//    ' +}}'
    ].join(''), 'g');
}

Sorry, I'm too lazy for a pull request plus I figure that you need to reversion npm anyways if you like it. Personally, I need this.

smhg commented 9 years ago

Spaces are now optional with the * quantifier.