Difference between revisions of "lure"

 
(71 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
== Summary ==
 
== 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:
+
LURE is an attempt to implement a 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 non-validating 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.
 
* 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.  
+
Lure's purpose will NOT be to implement a web browser in Love2d, that is just ridiculous :D Instead, Lure's purpose will be to provide the core html DOM interfaces allowing Lovers the ability to to work with html data structures and to render basic html to the love window for simple UI.
  
== LURE DOM Reference ==
+
== Download ==
  
{|
+
[https://github.com/admin36/LURE Github]
! align="left" | Object
+
 
! align="left" | Description
+
== Active Development ==
 +
 
 +
'''Status:''' In development
 +
 
 +
'''Last Stable:''' N/A
 +
 
 +
'''Development Tracker:''' [https://trello.com/board/lure/503c5baea077f04c54795d7d Trello Board]
 +
 
 +
== Bug Reports/Feedback ==
 +
 
 +
Please place bug reports and feedback on [https://github.com/admin36/LURE/issues Github]
 +
 
 +
== Articles/Tutorials ==
 +
 
 +
* [[lure.tuts.parsepreview|Parser Preview]]
 +
* [[lure.tuts.xmlhttprequest|Using XMLHttpRequest]]
 +
* [[lure.article.renderpreview|Render Preview]]
 +
 
 +
== Documentation ==
 +
 
 +
=== Namespaces ===
 +
 
 +
{|class="wikitable sortable"
 +
!Namespace
 +
!Description
 +
!Implemented
 
|-
 
|-
|[[lure.dom.node | DOM Node]]
+
|[[lure]]
|The Node object represents a single node in the document tree
+
|Lure Root Namespace
 +
|Yes
 
|-
 
|-
|DOM NodeList
+
|[[lure.core]]
|The NodeList object represents an ordered list of nodes
+
|Lure core namespace
 +
|Yes
 
|-
 
|-
|DOM NamedNodeMap
+
|[[lure.layers]]
|The NamedNodeMap object represents an unordered list of nodes.
+
|Lure layers namespace
 +
|Yes
 
|-
 
|-
|DOM document
+
|[[lure.dom]]
|The Document object represents the entire XML/HTML document.
+
|Lure Document Object Model namespace
 +
|Yes
 
|-
 
|-
|DOM Element
+
|[[lure.dom.css]]
|The Element object represents an element in an XML/HTML document
+
|Lure Document Object Model css namespace
 +
|Yes
 
|-
 
|-
|DOM Attribute
+
|[[lure.rom]]
|The Attr object represents an attribute of an Element object.
+
|Lure Render Object Model namespace
 +
|Yes
 
|-
 
|-
|DOM Text
+
|[[lure.rom.layout]]
|The Text object represents the textual content of an element or attribute.
+
|Lure Render Object Model layout namespace
 +
|Yes
 +
|}
 +
 
 +
==== Lure Object Reference ====
 +
 
 +
{|class="wikitable sortable"
 +
!Object
 +
!Description
 +
!Implimented
 
|-
 
|-
|DOM CDATA
+
|[[LURE Window]]
|The CDATASection object represents a CDATA section in a document.
+
|
 +
|yes
 
|-
 
|-
|DOM Comment
+
|[[LURE Layer]]
|The Comment object represents the content of comment nodes in a document.
+
|
 +
|yes
 
|-
 
|-
|DOM Window
 
|The Window object represents Love window
 
 
|}
 
|}
  
 +
==== Lure DOM Object Reference ====
  
== xml/html Parser Preview ==
+
Objects present in this table are DOM objects currently planned for implementation. Not all W3C DOM objects will be implemented.
  
The parser in its current state implements many of the core DOM node objects. Although the library is not yet ready for prototype release, below is an example of the current xml/html parser and some basic use of the resulting DOM Object.
+
{| class="wikitable sortable"
 +
! align="left" | Object
 +
! align="left" style="padding-left:10px;" | Description
 +
! align="left" style="padding-left:10px;" | Implemented
 +
|-
 +
|[[lure.dom.node|DOM Node]]
 +
|style="padding-left:10px;"|The Node object represents a single node in the document tree
 +
|style="padding-left:10px;"|Yes
 +
|-
 +
|[[lure.dom.nodelist|DOM NodeList]]
 +
|style="padding-left:10px;"|The NodeList object represents an ordered list of nodes
 +
|style="padding-left:10px;"|Yes
 +
|-
 +
|[[lure.dom.namednodemap|DOM NamedNodeMap]]
 +
|style="padding-left:10px;"|The NamedNodeMap object represents an unordered list of nodes.
 +
|style="padding-left:10px;"|Yes
 +
|-
 +
|[[lure.dom.document|DOM document]]
 +
|style="padding-left:10px;"|The Document object represents the entire XML/HTML document.
 +
|style="padding-left:10px;"|Yes
 +
|-
 +
|[[lure.dom.element|DOM Element]]
 +
|style="padding-left:10px;"|The Element object represents an element in an XML/HTML document
 +
|style="padding-left:10px;"|Yes
 +
|-
 +
|[[lure.dom.attribute|DOM Attribute]]
 +
|style="padding-left:10px;"|The Attr object represents an attribute of an Element object.
 +
|style="padding-left:10px;"|Yes
 +
|-
 +
|[[lure.dom.text|DOM Text]]
 +
|style="padding-left:10px;"|The Text object represents the textual content of an element or attribute.
 +
|style="padding-left:10px;"|Yes
 +
|-
 +
|[[lure.dom.cdata|DOM CDATA]]
 +
|style="padding-left:10px;"|The CDATASection object represents a CDATA section in a document.
 +
|style="padding-left:10px;"|Yes
 +
|-
 +
|[[lure.dom.comment|DOM Comment]]
 +
|style="padding-left:10px;"|The Comment object represents the content of comment nodes in a document.
 +
|style="padding-left:10px;"|Yes
 +
|-
 +
|[[lure.dom.DOMParser|DOM DOMParser]]
 +
|style="padding-left:10px;"|DOMParser object parses xml/html text and returns a DOM Object
 +
|style="padding-left:10px;"|Yes
 +
|-
 +
|[[lure.dom.XMLHttpRequest|DOM XMLHttpRequest]]
 +
|style="padding-left:10px;"|XMLHttpRequest object can make synchronous or synchronous http requests to external web resources
 +
|style="padding-left:10px;"|Yes
 +
|-
 +
| [[lure.dom.HTMLEvents|DOM HTMLEvent]]
 +
|style="padding-left:10px;"|
 +
|style="padding-left:10px;"|No
 +
|-
 +
| [[lure.dom.HTMLAnchor|DOM HTMLAnchor]]
 +
|style="padding-left:10px;"|
 +
|style="padding-left:10px;"|No
 +
|-
 +
| [[lure.dom.HTMLBody|DOM HTMLBody]]
 +
|style="padding-left:10px;"|
 +
|style="padding-left:10px;"|No
 +
|-
 +
| [[lure.dom.HTMLButton|DOM HTMLButton]]
 +
|style="padding-left:10px;"|
 +
|style="padding-left:10px;"|No
 +
|-
 +
| [[lure.dom.HTMLDiv|DOM HTMLDiv]]
 +
|style="padding-left:10px;"|
 +
|style="padding-left:10px;"|No
 +
|-
 +
| [[lure.dom.HTMLForm|DOM HTMLForm]]
 +
|style="padding-left:10px;"|
 +
|style="padding-left:10px;"|No
 +
|-
 +
| [[lure.dom.HTMLImage|DOM HTMLImage]]
 +
|style="padding-left:10px;"|
 +
|style="padding-left:10px;"|No
 +
|-
 +
| [[lure.dom.HTMLInputbutton|DOM HTMLInput Button]]
 +
|style="padding-left:10px;"|
 +
|style="padding-left:10px;"|No
 +
|-
 +
| [[lure.dom.HTMLInputcheckbox|DOM HTMLInput Checkbox]]
 +
|style="padding-left:10px;"|
 +
|style="padding-left:10px;"|No
 +
|-
 +
| [[lure.dom.HTMLInputhidden|DOM HTMLInput Hidden]]
 +
|style="padding-left:10px;"|
 +
|style="padding-left:10px;"|No
 +
|-
 +
| [[lure.dom.HTMLInputpassword|DOM HTMLInput Password]]
 +
|style="padding-left:10px;"|
 +
|style="padding-left:10px;"|No
 +
|-
 +
| [[lure.dom.HTMLInputradio|DOM HTMLInput Radio]]
 +
|style="padding-left:10px;"|
 +
|style="padding-left:10px;"|No
 +
|-
 +
| [[lure.dom.HTMLInputreset|DOM HTMLInput Reset]]
 +
|style="padding-left:10px;"|
 +
|style="padding-left:10px;"|No
 +
|-
 +
| [[lure.dom.HTMLInputsumbit|DOM HTMLInput Submit]]
 +
|style="padding-left:10px;"|
 +
|style="padding-left:10px;"|No
 +
|-
 +
| [[lure.dom.HTMLInputtext|DOM HTMLInput Text]]
 +
|style="padding-left:10px;"|
 +
|style="padding-left:10px;"|No
 +
|-
 +
| [[lure.dom.HTMLLink|DOM HTMLLink]]
 +
|style="padding-left:10px;"|
 +
|style="padding-left:10px;"|No
 +
|-
 +
| [[lure.dom.HTMLOption|DOM HTMLOption]]
 +
|style="padding-left:10px;"|
 +
|style="padding-left:10px;"|No
 +
|-
 +
| [[lure.dom.HTMLScript|DOM HTMLScript]]
 +
|style="padding-left:10px;"|Represents an individual script element. asserts lua script directly from the document.
 +
|style="padding-left:10px;"|Yes
 +
|-
 +
| [[lure.dom.HTMLSelect|DOM HTMLSelect]]
 +
|style="padding-left:10px;"|
 +
|style="padding-left:10px;"|No
 +
|-
 +
| [[lure.dom.HTMLStyle|DOM HTMLStyle]]
 +
|style="padding-left:10px;"|The Style object represents an individual style element.
 +
|style="padding-left:10px;"|Yes
 +
|-
 +
| [[lure.dom.HTMLStylesheet|DOM HTMLStylesheet]]
 +
|style="padding-left:10px;"|Stylesheet object represents an individual stylesheet.
 +
|style="padding-left:10px;"|Yes
 +
|-
 +
| [[lure.dom.HTMLCssRule|DOM HTMLCssRule]]
 +
|style="padding-left:10px;"|HTMLCssRule object represents an individual Css Rule.
 +
|style="padding-left:10px;"|Yes
 +
|-
 +
| [[lure.dom.HTMLTable|DOM HTMLTable]]
 +
|style="padding-left:10px;"|
 +
|style="padding-left:10px;"|No
 +
|-
 +
| [[lure.dom.HTMLTdth|DOM HTMLtd/th]]
 +
|style="padding-left:10px;"|
 +
|style="padding-left:10px;"|No
 +
|-
 +
| [[lure.dom.HTMLTr|DOM HTMLtr]]
 +
|style="padding-left:10px;"|
 +
|style="padding-left:10px;"|No
 +
|-
 +
| [[lure.dom.HTMLTextarea|DOM HTMLTextArea]]
 +
|style="padding-left:10px;"|
 +
|style="padding-left:10px;"|No
 +
|}
  
Below is very simple xml/html markup:
+
==== Lure ROM Object Reference ====
<source lang="xml">
 
<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>
 
</source>
 
  
And to parse and work with the DOM in LURE:
+
The Lure ROM (Render Object Model) is comprised of all core render objects and methods to render a DOM model to the screen
<source lang="lua">
 
require("lure.lua")
 
  
htmlDoc = Lure.load("test.html")
+
{| class="wikitable sortable"
print(htmlDoc.getElementById("div1").childNodes[1].data)
+
!Object
--OUTPUT: this is a sentence
+
!Description
 
+
!Implemented
print(htmlDoc.childNodes[1].childNodes[2].childNodes[1].childNodes[3].data)
+
|-
--OUTPUT: separated by a break line.
+
|[[ROM Viewport]]
 
+
| The viewport object represents the root render object of the ROM model
newElement = htmlDoc.createElement("div")
+
|Yes
newElement.setAttribute("id", "myNewElement")
+
|-
htmlDoc.body.appendChild(newElement)
+
|[[ROM node]]
print(htmlDoc.getElementById("myNewElement").getAttribute("id"))
+
| The ROM node object represents the base object most other ROM nodes inherit from
--OUTPUT: myNewElement
+
|Yes
</source>
+
|-
 +
|[[ROM nodelist]]
 +
| The ROM nodelist is used to maintain indexed lists of ROM Nodes
 +
|yes
 +
|-
 +
|[[ROM Nodeattribute]]
 +
| The Nodeattribute object maintains ROM Node attributes
 +
|Yes
 +
|-
 +
|[[ROM box]]
 +
| The ROM box object represents the base box render object
 +
|yes
 +
|-
 +
|[[ROM blockBox]]
 +
|
 +
|yes
 +
|-
 +
|[[ROM inlineBox]]
 +
|
 +
|yes
 +
|-
 +
|[[ROM inlineBlockBox]]
 +
|
 +
|Partial
 +
|-
 +
|[[ROM lineBox]]
 +
|
 +
|yes
 +
|-
 +
|[[ROM boxComputedStyle]]
 +
|
 +
|yes
 +
|-
 +
|[[ROM boxRenderStyle]]
 +
|
 +
|yes
 +
|-
 +
|[[ROM layoutResponse]]
 +
|
 +
|yes
 +
|-
 +
|[[ROM namednodemap]]
 +
|
 +
|yes
 +
|-
 +
|[[ROM romParser]]
 +
|
 +
|yes
 +
|-
 +
|[[ROM textNode]]
 +
|
 +
|yes
 +
|}
  
  
Line 88: Line 317:
 
MORE TO COME!
 
MORE TO COME!
 
{{#set:LOVE Version=Any}}
 
{{#set:LOVE Version=Any}}
{{#set:Description=XML/HTML DOM Parser/Renderer.}}
+
{{#set:Description=HTML DOM Parser/Renderer.}}
 
[[Category:Libraries]]
 
[[Category:Libraries]]

Latest revision as of 11:53, 6 September 2012

Summary

LURE is an attempt to implement a html DOM parser and renderer for the Love2d game engine. The goal of LURE is to provide the following:

  • A non-validating 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.

Lure's purpose will NOT be to implement a web browser in Love2d, that is just ridiculous :D Instead, Lure's purpose will be to provide the core html DOM interfaces allowing Lovers the ability to to work with html data structures and to render basic html to the love window for simple UI.

Download

Github

Active Development

Status: In development

Last Stable: N/A

Development Tracker: Trello Board

Bug Reports/Feedback

Please place bug reports and feedback on Github

Articles/Tutorials

Documentation

Namespaces

Namespace Description Implemented
lure Lure Root Namespace Yes
lure.core Lure core namespace Yes
lure.layers Lure layers namespace Yes
lure.dom Lure Document Object Model namespace Yes
lure.dom.css Lure Document Object Model css namespace Yes
lure.rom Lure Render Object Model namespace Yes
lure.rom.layout Lure Render Object Model layout namespace Yes

Lure Object Reference

Object Description Implimented
LURE Window yes
LURE Layer yes

Lure DOM Object Reference

Objects present in this table are DOM objects currently planned for implementation. Not all W3C DOM objects will be implemented.

Object Description Implemented
DOM Node The Node object represents a single node in the document tree Yes
DOM NodeList The NodeList object represents an ordered list of nodes Yes
DOM NamedNodeMap The NamedNodeMap object represents an unordered list of nodes. Yes
DOM document The Document object represents the entire XML/HTML document. Yes
DOM Element The Element object represents an element in an XML/HTML document Yes
DOM Attribute The Attr object represents an attribute of an Element object. Yes
DOM Text The Text object represents the textual content of an element or attribute. Yes
DOM CDATA The CDATASection object represents a CDATA section in a document. Yes
DOM Comment The Comment object represents the content of comment nodes in a document. Yes
DOM DOMParser DOMParser object parses xml/html text and returns a DOM Object Yes
DOM XMLHttpRequest XMLHttpRequest object can make synchronous or synchronous http requests to external web resources Yes
DOM HTMLEvent No
DOM HTMLAnchor No
DOM HTMLBody No
DOM HTMLButton No
DOM HTMLDiv No
DOM HTMLForm No
DOM HTMLImage No
DOM HTMLInput Button No
DOM HTMLInput Checkbox No
DOM HTMLInput Hidden No
DOM HTMLInput Password No
DOM HTMLInput Radio No
DOM HTMLInput Reset No
DOM HTMLInput Submit No
DOM HTMLInput Text No
DOM HTMLLink No
DOM HTMLOption No
DOM HTMLScript Represents an individual script element. asserts lua script directly from the document. Yes
DOM HTMLSelect No
DOM HTMLStyle The Style object represents an individual style element. Yes
DOM HTMLStylesheet Stylesheet object represents an individual stylesheet. Yes
DOM HTMLCssRule HTMLCssRule object represents an individual Css Rule. Yes
DOM HTMLTable No
DOM HTMLtd/th No
DOM HTMLtr No
DOM HTMLTextArea No

Lure ROM Object Reference

The Lure ROM (Render Object Model) is comprised of all core render objects and methods to render a DOM model to the screen

Object Description Implemented
ROM Viewport The viewport object represents the root render object of the ROM model Yes
ROM node The ROM node object represents the base object most other ROM nodes inherit from Yes
ROM nodelist The ROM nodelist is used to maintain indexed lists of ROM Nodes yes
ROM Nodeattribute The Nodeattribute object maintains ROM Node attributes Yes
ROM box The ROM box object represents the base box render object yes
ROM blockBox yes
ROM inlineBox yes
ROM inlineBlockBox Partial
ROM lineBox yes
ROM boxComputedStyle yes
ROM boxRenderStyle yes
ROM layoutResponse yes
ROM namednodemap yes
ROM romParser yes
ROM textNode yes


MORE TO COME!