5 ms·
Opa however extends the classical syntax with advanced features specific to the web. HTML fragments can be inserted directly without quotes: line = <di
by gosub 14y ago
Opa however extends the classical syntax with advanced features specific to the web.
HTML fragments can be inserted directly without quotes:
line = <div id="foo">bar</div>;
I'm not sure that this helps readability, feels like reverse php (html inside code, vs code inside html).
- hbbio 14y agoIt's much more readable than complex combinations of " and '. Furthermore, with the static typing, all your structures are checked at compile time: Try it, you'll see how helpful it is.
- nilliams 14y agoEdit: Oops didn't notice you were a developer. I think comparing to complex combinations of ' and "" is a bit of a straw man, as JavaScript developers use templating languages like Handlebars/Mustache so that really isn't an issue! I see why you're doing it the way you are for the static HTML checking though!
- TazeTSchnitzel 14y agoOh yes. The mess of " and '. I'd love to be able to avoid that. Especially for stuff like this: '<img src="' + image.url + '" alt="' + image.title + '" title='" + image.title + '" />' Did you notice the bug? EDIT: Whoops, I made some other bug accidentally.
- nilliams 14y agoAh but you should never have to write code that looks like that. Use a templating language like Mustache (http://mustache.github.com/ http://mustache.github.com/). Or simply use string interpolation, which most dynamic languages have baked in: http://en.wikipedia.org/wiki/String_interpolation http://en.wikipedia.org/wiki/String_interpolation
- ryanpetrich 14y agoI count four bugs.
- scarmig 14y agoReminds me of XML literals in .NET.