nano icon indicating copy to clipboard operation
nano copied to clipboard

Change -= name =- to {{ name }}

Open dbankier opened this issue 10 years ago • 23 comments
trafficstars

a limitation of alloy at the moment. will raise JIRA and/or PR soon.

dbankier avatar Jan 05 '15 06:01 dbankier

From @jhaynie:

i think this might be the regular expression here FYI: https://github.com/appcelerator/alloy/blob/323f0bfd034ccd99912390ae2e12924793d9c1fc/Alloy/commands/compile/styler.js#L19

In order for Alloy not to interfere with {{name}} I think the regexp on the above line should be:

/(?:[^\{]|^)\{([^:}]+)\}(?:[^\}]|$)/

FokkeZB avatar Jan 05 '15 07:01 FokkeZB

Thanks. There is another BINDING_REGEX in Ti.UI.Switch.

dbankier avatar Jan 05 '15 07:01 dbankier

I like {{}} or <% %>

rblalock avatar Jan 05 '15 14:01 rblalock

+1 <% %>

grantges avatar Jan 05 '15 14:01 grantges

+1 {{ }} :wink:

FokkeZB avatar Jan 05 '15 15:01 FokkeZB

+1 {{ }}

netoramalho avatar Jan 05 '15 15:01 netoramalho

+1 <% %>

nicka avatar Jan 05 '15 15:01 nicka

What about ColdFusion style? #name#

iotashan avatar Jan 05 '15 15:01 iotashan

{{ }} would make more sense in my opinion since it has been adopted a lot of Javascript frameworks.

TheBrousse avatar Jan 05 '15 15:01 TheBrousse

+1 {{ }}

jhaynie avatar Jan 05 '15 16:01 jhaynie

@FokkeZB that looks about right to me. if you can submit a PR to alloy we can fix it ASAP.

jhaynie avatar Jan 05 '15 16:01 jhaynie

I prefer {{ }} too. <% %> can be implemented now. # # I don't really like. It needs a a clear opening and closing since the expression can be long.

I will likely make it {{ }} by default but also make the syntax configurable (much like _ templates).

dbankier avatar Jan 05 '15 20:01 dbankier

Sounds good to me. Ive been using handlebars on a new site for Appc , getting pretty comfortable with it. You going to just allow use of handlebars completely? So people can write plugins to it? Just an idea.

rblalock avatar Jan 05 '15 20:01 rblalock

I haven't really used handlebars and not sure how/if it works outside the dom. I'll have a look.

dbankier avatar Jan 05 '15 21:01 dbankier

It doesn't work off the dom. It's all string manipulation.

rblalock avatar Jan 05 '15 21:01 rblalock

OK done. It defaults to {{ }} now. using nano.syntax(/\-\=(.+?)\=\-/gi); to use the old syntax, which you need to do till alloy is fixed.

A warning about using <% %> is that it won't work if you used it as text content in xml, e.g.

<Label> Hi <% name %> </Label>

You will get this:

[ERROR] Error parsing XML file.
[ERROR] element parse error: Error: invalid tagName:%
[ERROR] @#[line:8,col:21]
[ERROR] Alloy compiler failed

nano works are run time and the xml parser that runs at precompile doesn't like it.

Leaving this open until we don't need to use the nano.syntax command anymore.

dbankier avatar Jan 05 '15 22:01 dbankier

@dbankier you're doing a ticket+PR for Alloy?

FokkeZB avatar Jan 06 '15 07:01 FokkeZB

@fokkezb, just implemented your change and tested it. It work well. Thanks. Here is the PR: https://github.com/appcelerator/alloy/pull/648

dbankier avatar Jan 06 '15 08:01 dbankier

Here is the JIRA ticket: https://jira.appcelerator.org/browse/TC-5179

dbankier avatar Jan 06 '15 08:01 dbankier

Good job guys!

nicka avatar Jan 06 '15 08:01 nicka

Nice job @fokkezb ~

On Tue, Jan 6, 2015 at 2:35 AM, Nick den Engelsman <[email protected]

wrote:

Good job guys!

— Reply to this email directly or view it on GitHub https://github.com/dbankier/nano/issues/1#issuecomment-68839125.

grantges avatar Jan 06 '15 14:01 grantges

https://github.com/appcelerator/alloy/pull/648 was merged. We are good to go when the change is part of an official Alloy release. I will update the README.md and close the issue then.

dbankier avatar Jan 08 '15 00:01 dbankier

sweet.

jhaynie avatar Jan 08 '15 02:01 jhaynie