rubenv / angular-gettext-tools

Tools for extracting/compiling angular-gettext strings.
http://angular-gettext.rocketeer.be/
MIT License
39 stars 129 forks source link

Change RegExp for extract strings in nested filter #122

Closed fontsie closed 8 years ago

fontsie commented 8 years ago

es. {{ $scope.myString || ('defaultString' | translate) }}

rubenv commented 8 years ago

Interesting!

This breaks some of our test cases, so it needs some work.

Also: could you please add a test case that illustrates the new behavior (in other words: a test case that fails without these changes). I don't accept changes like these unless they're illustrated by a good test case, otherwise there's no way to ensure we don't accidentally break it in the future.

fontsie commented 8 years ago

Hi! Can you check if everything is ok?

rubenv commented 8 years ago

Looks good to me, merging!

rubenv commented 8 years ago

Released to NPM as 2.1.8. Thanks!

rubenv commented 8 years ago

I had to revert this: it breaks extraction of strings for some of the cases we're seeing in one of our projects. Working on a test case right now.

rubenv commented 8 years ago

Just pushed a test case that fails with the code from this pull request (and worked fine previously).

  1) Extract (multi-line HTML) Issue 122:

      AssertionError: 'text-align\': col.align }">{{row[col.id]}}</td></tr></tbody></table><div ng-if="options.type == \'table\' &amp;&amp; options.da == 'No data'
      + expected - actual

      -text-align': col.align }">{{row[col.id]}}</td></tr></tbody></table><div ng-if="options.type == 'table' &amp;&amp; options.data.rows.length == 0" class="panel-body"><div class="vis"><svg width="100%" height="100" class="chart"><g width="100%" height="100%" class="nodata"><text text-anchor="middle" x="50%" y="50%" display="inherit">{{'No data
      +No data

      at assertString (test/extract_multiline.js:26:20)
      at Context.<anonymous> (test/extract_multiline.js:35:9)

This is probably an easy fix (a matter of swapping greedy/ungreedy somewhere).

Rolling a new release without the changes from this pull request.