lure
Summary
LURE is an attempt to implement a hybrid xml/html DOM parser and renderer for the Love2d game engine. The goal of LURE is to provide the following:
- A non-validating xml/html parser which generates a (somewhat) W3C Standards complaint DOM Object for use with love.
- A html renderer which will display html markup in the love window.
Although we have a working prototype of the xml/html parser and DOM Object, we do not yet have a working renderer. Given the sheer size of the W3C DOM specification, this area will serve to document and track the current status of DOM Interface implementations.
xml/html Parser Preview
The parser in its current state implements many of the core DOM node objects. Below is an example of the current xml/html parser and some basic use of the resulting DOM Object.
Below is very simple xml/html markup:
<html>
<head>
<title>Lure Test Page</title>
</head>
<body>
<div id="div1">
this is a sentence<br>separated by a break line.
<div id="div2">Hello</div>
<div id="div3">World</div>
</div>
</body>
</html>
And to parse and work with the DOM in LURE:
htmlDoc = Lure.load("test.html")
print(htmlDoc.getElementById("div1").childNodes[1].data)
--OUTPUT: this is a sentence
print(htmlDoc.childNodes[1].childNodes[2].childNodes[1].childNodes[3].data)
--OUTPUT: separated by a break line.
newElement = htmlDoc.createElement("div")
newElement.setAttribute("id", "myNewElement")
htmlDoc.body.appendChild(newElement)
print(htmlDoc.getElementById("myNewElement").getAttribute("id"))
--OUTPUT: myNewElement
MORE TO COME!