Nesting macro

46 views
Skip to first unread message

Mathieu Emilian

unread,
May 31, 2015, 6:01:39 AM5/31/15
to haxe...@googlegroups.com
I have been working on a school project for a few weeks, using ufront and hxdom. Two great libs so far, but I found working with hxdom a bit tedious and verbose when it comes to write big views. I wrote a macro that allow to define my view structure with indentation, like the jade template engine do, and get rid of all the append calls and parenthesis nightmare :)
It allow me to define my views like this :

@jade(this){
new EHead();
new EBody();
   new EHeader2().addText("My shop list");
   new EUnorderedList();
      new EListItem().addText("Coffee");
      new EListItem().addText("Tea");
         new EUnorderedList();
            new EListItem().addText("Black tea");
            new EListItem().addText("Green tea");
    new EListItem().addText("Milk");
}

Thought I should share it, the code is here : https://github.com/memilian/JadeNesting

Chii Chan

unread,
May 31, 2015, 10:56:33 PM5/31/15
to haxe...@googlegroups.com
Thanks for sharing!

It's a bit weird to have some part of your source code be space/indent sensitive, whilst other parts aren't, but i guess you can get use to it with time...
Reply all
Reply to author
Forward
0 new messages