You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
Parsing XML (or HTML) can be a challenge in Lua. Having the ability to register custom XML parsers will allow people to do this.
Describe the solution you'd like
A clear and concise description of what you want to happen.
The creation of a system that allows people to make custom XML parsers which support custom tags. Each custom tag should be predefined.
Example lua:
-- This function will allow people to do what they want if a tag is parsed for example add it to a layout.-- This function will be called for all tags. Parent tags (tags with child tags) will have this function run first on them, this could allow custom data to be passed to child tags.localfunctionparse(tag)
localname=tag.name-- the name of the taglocalattrs=tag.attrs-- the tag's attributeslocalchildren=tag.children-- the tag's children (a table of other tags in the same format) (or a string if it is just text e.g. `<p>text here</p>`)ifname=="p" thenifnottag.inDivthenframe:addLabel():setText(children) -- amusing `frame` is a `Frame` and `children` is a `string`endendifname=="div" thenfork,vinpairs(children) dov.inDiv=true-- set a custom value on the children of this divendendendlocaltags= {
p= { -- define a tag called "p"children="string" -- this will allow only strings inside a `p` if other types are found (like and other tag) then there will be an error. Single numbers should be parsed as a string.
},
div= { -- define a tag called "div"children="any" -- allow anything inside a div
}
}
localparser=basalt.makeParser(tags, parse)
-- The parser object shall work like the normal XML parser with the same `:loadLayout`. In addition there should be a `:loadString` which takes the XML code as a string instead of a file name.
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Copying your existing XML parser and modifying it.
Additional context
Add any other context or screenshots about the feature request here.
This will allow me to make a better HTML parser for my CC Browser and have a very nice UI.
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
Parsing XML (or HTML) can be a challenge in Lua. Having the ability to register custom XML parsers will allow people to do this.
Describe the solution you'd like
A clear and concise description of what you want to happen.
The creation of a system that allows people to make custom XML parsers which support custom tags. Each custom tag should be predefined.
Example lua:
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Copying your existing XML parser and modifying it.
Additional context
Add any other context or screenshots about the feature request here.
This will allow me to make a better HTML parser for my CC Browser and have a very nice UI.
The text was updated successfully, but these errors were encountered: