excessive / DOMy

A DOM-like GUI framework for the *awesome* LÖVE framework
Other
32 stars 2 forks source link

Markup Syntax #4

Closed karai17 closed 9 years ago

karai17 commented 9 years ago

What does everyone think about the markup syntax? I want the markup to be Lua so I don't need to run a script to convert, say, XML to Lua when it's not necessary. Is the current markup.lua example sensible or are there some serious changes needed?

The basis here is that named named keys within a table are used to define the object and its properties while the sequential keys are used to define child objects (if tables) or direct value (if string/float). Maybe value="some value" would be less ambiguous, if not more wordy?

{ type="block", id="windows",
    { type="text", "Windows XP+" } ,
    { type="list",
        { type="text", class="link", onclick=web_link(strings.some_link), "32-bit installer" },
        { type="text", class="link", onclick=web_link(strings.some_link), "32-bit zipped" },
        { type="text", class="link", onclick=web_link(strings.some_link), "64-bit installer" },
        { type="text", class="link", onclick=web_link(strings.some_link), "64-bit zipped" },
    },
}
karai17 commented 9 years ago

In reference to Issue #3, I have revised the markup spec a bit. Make sure to check out the README for more info.

{ "block", id="windows",
    { "text", "Windows XP+" } ,
    { "list",
        { "text", class="link", onclick=web_link(strings.some_link), "32-bit installer" },
        { "text", class="link", onclick=web_link(strings.some_link), "32-bit zipped" },
        { "text", class="link", onclick=web_link(strings.some_link), "64-bit installer" },
        { "text", class="link", onclick=web_link(strings.some_link), "64-bit zipped" },
    },
}
pablomayobre commented 9 years ago

I'm not sure about putting the events in the middle of the markup... I always like to have them separated in the script.

Also with love.system.openURL you could make an specific index called href that does exactly what a link does in HTML

karai17 commented 9 years ago

Yeah, I just learned about openURL recently and haven't updated the markup yet.

While I prefer defining events in scripts, I think it should also be possible for inline events too. Unless everyone considers that a serious taboo?

pablomayobre commented 9 years ago

Hahaha HTML thinks so... I dont, I just think that it looks ugly to have it in there when it can be somewhere else. But the scripting part should be seriously well done, there are too many thinks to take into account there so I would avoid it till a solid base and rendering mechanics are implemented.

Coming back... I think everything looks right! So similar to HTML already

karai17 commented 9 years ago

Yeah I haven't even looked into scripting yet beyond gathering some links (see the bottom of the README and/or TODO). I do agree that added functionality is probably better done in scripts. I'd like some more input before I decide to remove it or not.