Skip to content

Commit

Permalink
i-bem__i18n: Fix for nested XML/TEXT content in keys
Browse files Browse the repository at this point in the history
Merge branch 'lego-8934' into 0.3
  • Loading branch information
Vladimir Varankin committed Mar 20, 2013
2 parents 7456f96 + d15aa77 commit bff138b
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 6 deletions.
29 changes: 23 additions & 6 deletions blocks-common/i-bem/__i18n/lib/tanker.js
Expand Up @@ -115,16 +115,33 @@ function jsExpander(node, _raw) {
var tag = node[0],
attrs = node[1],
prop = [],
a;
s = '', t, c;

for(a in attrs) { prop.push([a, SINGLE_QUOTE_CHAR + attrs[a] + SINGLE_QUOTE_CHAR].join('=')); };
code = [];

for(c in attrs) { prop.push([c, SINGLE_QUOTE_CHAR + attrs[c] + SINGLE_QUOTE_CHAR].join('=')); };
prop = prop.length? jsQuote(' ' + prop.join(' ')) : '';

code = node[2].length?
['"<' + tag + prop + '>"', expandNodes(node[2], currentExpander), '"</' + tag + '>"'].join(' + ') :
'"<' + tag + prop + '/>"';
c = '';
t = '"<' + tag + prop;

return code;
if(node[2].length) {
s = ' + ';

t += '>"';
code.push(t);

c = expandNodes(node[2], currentExpander);
Array.isArray(c) || (c = [c]);
[].push.apply(code, c);

code.push(t = '"</' + tag + '>"');
} else {
t += '/>"';
code.push(t);
}

return code.join(s);

case 'PARAMS':
// [ [params] ]
Expand Down
1 change: 1 addition & 0 deletions blocks-common/i-bem/__i18n/test/files/html-02.xml
@@ -0,0 +1 @@
Merhaba! <p>Ulaşmak istediğiniz sayfa sadece Yandex.Browser'da görüntülenebilmektedir. Devam etmek için buraya <a href="http://browser.yandex.com.tr?from=kazan" class="b-link" target="_blank">tıklayın</a>.</p>
1 change: 1 addition & 0 deletions blocks-common/i-bem/__i18n/test/test-js-parser.js
Expand Up @@ -31,6 +31,7 @@ unit('dynamic-02');
unit('dynamic-03');
unit('param-xml-01');
unit('html-01');
unit('html-02');
unit('entity-01');
unit('param-empty-01');
unit('complex-01');
Expand Down

0 comments on commit bff138b

Please sign in to comment.