Skip to content

Commit

Permalink
feat: add support for platform specific namespaces for xml attributes (
Browse files Browse the repository at this point in the history
  • Loading branch information
brentonhouse authored and ewanharris committed Mar 29, 2019
1 parent 42cc21e commit 5fdc44c
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion Alloy/commands/compile/compilerUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,18 @@ exports.getParserArgs = function(node, state, opts) {
});
} else {
var theValue = node.getAttribute(attrName);

// find platform specific attributes
var attributeParts = attrName.split(':');
if ( attributeParts.length === 2 && _.includes(CONST.PLATFORMS, attributeParts[0])) {
// if this attribute is for this platform, create it without namespace.
if ( attributeParts[0] === compilerConfig.alloyConfig.platform ) {
attrName = attributeParts[1];
} else {
return;
}
}

if (/(^|\+)\s*(?:(?:Ti|Titanium|Alloy.Globals|Alloy.CFG)\.|L\(.+\)\s*$)/.test(theValue)) {
var match = theValue.match(/^\s*L\([^'"]+\)\s*$/);
if (match !== null) {
Expand All @@ -220,7 +232,6 @@ exports.getParserArgs = function(node, state, opts) {
theValue = styler.STYLE_EXPR_PREFIX + theValue;
}


if (attrName === 'class') {
if (autoStyle) {
createArgs[CONST.CLASS_PROPERTY] = theValue.split(/\s+/) || [];
Expand Down

0 comments on commit 5fdc44c

Please sign in to comment.