+
+ """)
+ self.sinkEvent("onKeyUp", "onChange")
+
+ self.parser = "earley"
+
+ # Pre-load examples
+ for name, (grammar, input) in examples.items():
+ option = html5.Option(name)
+ option.grammar = grammar
+ option.input = input
+
+ self.examples.appendChild(option)
+
+ def onChange(self, e):
+ if html5.utils.doesEventHitWidgetOrChildren(e, self.examples):
+ example = self.examples.children(self.examples["selectedIndex"])
+ self.grammar["value"] = example.grammar.strip()
+ self.input["value"] = example.input.strip()
+ self.onKeyUp()
+
+ elif html5.utils.doesEventHitWidgetOrChildren(e, self.parser):
+ self.parser = self.parser.children(self.parser["selectedIndex"])["value"]
+ self.onKeyUp()
+
+ def onKeyUp(self, e=None):
+ l = Lark(self.grammar["value"], parser=self.parser)
+
+ try:
+ ast = l.parse(self.input["value"])
+ except Exception as e:
+ self.ast.appendChild(
+ html5.Li(str(e)), replace=True
+ )
+
+ print(ast)
+ traverse = lambda node: html5.Li([node.data, html5.Ul([traverse(c) for c in node.children])] if isinstance(node, Tree) else node)
+ self.ast.appendChild(traverse(ast), replace=True)
diff --git a/docs/ide/examples.py b/docs/ide/examples.py
new file mode 100644
index 0000000..af9c38c
--- /dev/null
+++ b/docs/ide/examples.py
@@ -0,0 +1,150 @@
+
+# Examples formattet this way:
+# "name": ("grammar", "demo-input")
+
+examples = {
+
+ # --- hello.lark ---
+ "hello.lark": ("""
+start: WORD "," WORD "!"
+
+%import common.WORD // imports from terminal library
+%ignore " " // Disregard spaces in text
+""", "Hello, World!"),
+
+ # --- calc.lark ---
+"calc.lark": ("""
+?start: sum
+ | NAME "=" sum -> assign_var
+
+?sum: product
+ | sum "+" product -> add
+ | sum "-" product -> sub
+
+?product: atom
+ | product "*" atom -> mul
+ | product "/" atom -> div
+
+?atom: NUMBER -> number
+ | "-" atom -> neg
+ | NAME -> var
+ | "(" sum ")"
+
+%import common.CNAME -> NAME
+%import common.NUMBER
+%import common.WS_INLINE
+%ignore WS_INLINE""",
+ "1 + 2 * 3 + 4"),
+
+ # --- json.lark ---
+ "json.lark": ("""
+?start: value
+?value: object
+ | array
+ | string
+ | SIGNED_NUMBER -> number
+ | "true" -> true
+ | "false" -> false
+ | "null" -> null
+array : "[" [value ("," value)*] "]"
+object : "{" [pair ("," pair)*] "}"
+pair : string ":" value
+string : ESCAPED_STRING
+%import common.ESCAPED_STRING
+%import common.SIGNED_NUMBER
+%import common.WS
+%ignore WS""",
+"""
+[
+ {
+ "_id": "5edb875cf3d764da55602437",
+ "index": 0,
+ "guid": "3dae2206-5d4d-41fe-b81d-dc8cdba7acaa",
+ "isActive": false,
+ "balance": "$2,872.54",
+ "picture": "http://placehold.it/32x32",
+ "age": 24,
+ "eyeColor": "blue",
+ "name": "Theresa Vargas",
+ "gender": "female",
+ "company": "GEEKOL",
+ "email": "theresavargas@geekol.com",
+ "phone": "+1 (930) 450-3445",
+ "address": "418 Herbert Street, Sexton, Florida, 1375",
+ "about": "Id minim deserunt laborum enim. Veniam commodo incididunt amet aute esse duis veniam occaecat nulla esse aute et deserunt eiusmod. Anim elit ullamco minim magna sint laboris. Est consequat quis deserunt excepteur in magna pariatur laborum quis eu. Ex quis tempor elit qui qui et culpa sunt sit esse mollit cupidatat. Fugiat cillum deserunt enim minim irure reprehenderit est. Voluptate nisi quis amet quis incididunt pariatur nostrud Lorem consectetur adipisicing voluptate.\\r\\n",
+ "registered": "2016-11-19T01:02:42 -01:00",
+ "latitude": -25.65267,
+ "longitude": 104.19531,
+ "tags": [
+ "eiusmod",
+ "reprehenderit",
+ "anim",
+ "sunt",
+ "esse",
+ "proident",
+ "esse"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Roth Herrera"
+ },
+ {
+ "id": 1,
+ "name": "Callie Christian"
+ },
+ {
+ "id": 2,
+ "name": "Gracie Whitfield"
+ }
+ ],
+ "greeting": "Hello, Theresa Vargas! You have 6 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5edb875c845eb08161a83e64",
+ "index": 1,
+ "guid": "a8ada2c1-e2c7-40d3-96b4-52c93baff7f0",
+ "isActive": false,
+ "balance": "$2,717.04",
+ "picture": "http://placehold.it/32x32",
+ "age": 23,
+ "eyeColor": "green",
+ "name": "Lily Ross",
+ "gender": "female",
+ "company": "RODEOMAD",
+ "email": "lilyross@rodeomad.com",
+ "phone": "+1 (941) 465-3561",
+ "address": "525 Beekman Place, Blodgett, Marshall Islands, 3173",
+ "about": "Aliquip duis proident excepteur eiusmod in quis officia consequat culpa eu et ut. Occaecat reprehenderit tempor mollit do eu magna qui et magna exercitation aliqua. Incididunt exercitation dolor proident eiusmod minim occaecat. Sunt et minim mollit et veniam sint ex. Duis ullamco elit aute eu excepteur reprehenderit officia.\\r\\n",
+ "registered": "2019-11-02T04:06:42 -01:00",
+ "latitude": 17.031701,
+ "longitude": -42.657106,
+ "tags": [
+ "id",
+ "non",
+ "culpa",
+ "reprehenderit",
+ "esse",
+ "elit",
+ "sit"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Ursula Maldonado"
+ },
+ {
+ "id": 1,
+ "name": "Traci Huff"
+ },
+ {
+ "id": 2,
+ "name": "Taylor Holt"
+ }
+ ],
+ "greeting": "Hello, Lily Ross! You have 3 unread messages.",
+ "favoriteFruit": "strawberry"
+ }
+]""")
+}
\ No newline at end of file
diff --git a/docs/ide/files.json b/docs/ide/files.json
new file mode 100644
index 0000000..ebeb185
--- /dev/null
+++ b/docs/ide/files.json
@@ -0,0 +1,10 @@
+[
+ "__init__.py",
+ "app.py",
+ "examples.py",
+ "html5/__init__.py",
+ "html5/core.py",
+ "html5/ext.py",
+ "html5/ignite.py",
+ "html5/utils.py"
+]
\ No newline at end of file
diff --git a/docs/ide/html5/.gitignore b/docs/ide/html5/.gitignore
new file mode 100644
index 0000000..b65483f
--- /dev/null
+++ b/docs/ide/html5/.gitignore
@@ -0,0 +1,4 @@
+__target__
+__pycache__
+*.pyc
+.idea
diff --git a/docs/ide/html5/CHANGELOG.md b/docs/ide/html5/CHANGELOG.md
new file mode 100644
index 0000000..6f24335
--- /dev/null
+++ b/docs/ide/html5/CHANGELOG.md
@@ -0,0 +1,93 @@
+# Changelog
+
+This file documents any relevant changes done to ViUR html5 since version 2.
+
+## 3.0.0 [develop]
+
+This is the current development version.
+
+- Feature: Ported framework to Python 3 using [Pyodide](https://github.com/iodide-project/pyodide), with a full source code and library cleanup
+- Feature: `html5.Widget.__init__()` now allows parameters equal to `Widget.appendChild()` to directly stack widgets together.
+ Additionally, the following parameters are available:
+ - `appendTo`: Directly append the newly created widget to another widget.
+ - `style`: Provide class attributes for styling added to the new Widget, using `Widget.addClass()`.
+- Feature: `html5.Widget.appendChild()` and `html5.Widget.prependChild()` can handle arbitrary input now, including HTML, lists of widgets or just text, in any order. `html5.Widget.insertChild()` runs slightly different, but shares same features. This change mostly supersedes `html5.Widget.fromHTML()`.
+- Feature: New `replace`-parameter for `html5.Widget.appendChild()` and `html5.Widget.prependChild()` which clears the content.
+- Feature: `html5.ext.InputDialog` refactored & disables OK-Button when no value is present.
+- Feature: `html5.utils.doesEventHitWidgetOrChildren()` and `html5.utils.doesEventHitWidgetOrParent()` now return the Widget or None instead of a boolean, to avoid creating loops and directly work with the recognized Widget.
+- Feature: New function `html5.Widget.onBind()` enables widgets to react when bound to other widgets using the HTML parser.
+- Feature: Replace HTML-parsing-related `vars`-parameter generally by `**kwargs`, with backward-compatibility.
+- Speed-improvement: Hold static `_WidgetClassWrapper` per `html5.Widget` instead of creating one each time on the fly.
+
+## [2.5.0] Vesuv
+
+Release date: Jul 26, 2019
+
+- Bugfix: `Widget.Th()` now supporting full col-/rowspan getting and setting.
+- Bugfix: HTML-parser accepts tags in upper-/camel-case order now.
+- Bugfix: HTML-parser handles table tags with tbody/thead tags inside more gracefully.
+- Feature: Split HTML-parser into separate stages to compile and run; This allows to pre-compile HTML into a list/dict-structure and render it later on without parsing it again. `parseHTML()` is the new function, `fromHTML()` works like before and handles pre-compiled or raw HTML as parameter.
+- Feature: `fromHTML()` extended to `vars` parameter to replace key-value pairs in text-nodes and attribute values expressed as `{{key}}`.
+- Feature: HTML-parser dynamically reconizes void elements
+- Feature: `html5.registerTag()` can be used to define new or override existing HTML elements in the HTML parser by custom implementations based on `html5.Widget()`
+- Feature: New function `Widget.isVisible()` as counterpart for `Widget.isHidden()`.
+
+## [2.4.0] Agung
+
+Release date: May 17, 2019
+
+- Bugfix: Fixed bug with disabling of input widgets.
+- Feature: Fully refactored the librarys source base into just two single files, to reduce number of required files to download and make the library easier to access.
+- Feature: New function `Widget.isHidden()` to check if a widget is currently shown.
+- Feature: Improved handling of key-events.
+- Feature: Allow to close popups by pressing `ESC`.
+- Feature: Improvements for SVG and TextNode.
+
+## [2.3.0] Kilauea
+
+Release date: Oct 2, 2018
+
+- Refactored `html5.ext.SelectDialog`
+- Extended html parser to apply data-attributes
+- Switching event handling to newer JavaScript event listener API
+- Added `onFocusIn` and `onFocusOut` events
+
+## [2.2.0] Etna
+
+Release date: Apr 23, 2018
+
+- Implemented `html5.Head()` to access the document's head object within the library.
+- Directly append text in construction of Li().
+
+## [2.1.0]
+
+Release date: Nov 2, 2017
+
+- Introduced a build-in HTML parser (`Widget.fromHTML()`) that is capable to compile HTML-code into DOM-objects of the html5 library, and an extra-feature to bind them to their root node for further access. This attempt makes it possible to create PyJS apps using the HTML5 library without creating every single element by hand.
+- A more distinct way for `Widget.hide()` and `Widget.show()` that cannot be overridden by styling. (setting "hidden" does not work when another display value is set).
+- Utility functions `Widget.enable() and `Widget.disable()`.
+- Directly append text in construction of Div() and Span().
+- Allow for tuple and list processing in table cell assignments.
+- Adding `utils.parseFloat()` and `utils.parseInt()` utility functions.
+- Implemented `colspan` attribute for Th()
+- New README.md and CHANGELOG.md.
+
+## 2.0
+
+Release date: Dec 22, 2016
+
+- v[2.0.1]: Directly append text in construction of Option().
+- v[2.0.1]: Anything added to Widget.appendChild() or Widget.prependChild() which is not a widget is handled as text (TextNode() is automatically created).
+- New functions `Widget.prependChild()`, `Widget.insertBefore()`, `Widget.children()`, `Widget.removeAllChildren()`,
+ `Widget.addClass()`, `Widget.removeClass()`, `Widget.toggleClass()`
+- Utility functions `utils.doesEventHitWidgetOrParents()`, `utils.doesEventHitWidgetOrChildren()` taken from vi77
+- Insert text blocks easier with `utils.textToHtml()`
+- Several bugfixes
+
+[develop]: https://github.com/viur-framework/html5/compare/v2.5.0...develop
+[2.5.0]: https://github.com/viur-framework/html5/compare/v2.4.0...v2.5.0
+[2.4.0]: https://github.com/viur-framework/html5/compare/v2.3.0...v2.4.0
+[2.3.0]: https://github.com/viur-framework/html5/compare/v2.2.0...v2.3.0
+[2.2.0]: https://github.com/viur-framework/html5/compare/v2.1.0...v2.2.0
+[2.1.0]: https://github.com/viur-framework/html5/compare/v2.0.0...v2.1.0
+[2.0.1]: https://github.com/viur-framework/html5/compare/v2.0.0...v2.0.1
diff --git a/docs/ide/html5/LICENSE b/docs/ide/html5/LICENSE
new file mode 100644
index 0000000..65c5ca8
--- /dev/null
+++ b/docs/ide/html5/LICENSE
@@ -0,0 +1,165 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc.
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+ This version of the GNU Lesser General Public License incorporates
+the terms and conditions of version 3 of the GNU General Public
+License, supplemented by the additional permissions listed below.
+
+ 0. Additional Definitions.
+
+ As used herein, "this License" refers to version 3 of the GNU Lesser
+General Public License, and the "GNU GPL" refers to version 3 of the GNU
+General Public License.
+
+ "The Library" refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
+
+ An "Application" is any work that makes use of an interface provided
+by the Library, but which is not otherwise based on the Library.
+Defining a subclass of a class defined by the Library is deemed a mode
+of using an interface provided by the Library.
+
+ A "Combined Work" is a work produced by combining or linking an
+Application with the Library. The particular version of the Library
+with which the Combined Work was made is also called the "Linked
+Version".
+
+ The "Minimal Corresponding Source" for a Combined Work means the
+Corresponding Source for the Combined Work, excluding any source code
+for portions of the Combined Work that, considered in isolation, are
+based on the Application, and not on the Linked Version.
+
+ The "Corresponding Application Code" for a Combined Work means the
+object code and/or source code for the Application, including any data
+and utility programs needed for reproducing the Combined Work from the
+Application, but excluding the System Libraries of the Combined Work.
+
+ 1. Exception to Section 3 of the GNU GPL.
+
+ You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
+
+ 2. Conveying Modified Versions.
+
+ If you modify a copy of the Library, and, in your modifications, a
+facility refers to a function or data to be supplied by an Application
+that uses the facility (other than as an argument passed when the
+facility is invoked), then you may convey a copy of the modified
+version:
+
+ a) under this License, provided that you make a good faith effort to
+ ensure that, in the event an Application does not supply the
+ function or data, the facility still operates, and performs
+ whatever part of its purpose remains meaningful, or
+
+ b) under the GNU GPL, with none of the additional permissions of
+ this License applicable to that copy.
+
+ 3. Object Code Incorporating Material from Library Header Files.
+
+ The object code form of an Application may incorporate material from
+a header file that is part of the Library. You may convey such object
+code under terms of your choice, provided that, if the incorporated
+material is not limited to numerical parameters, data structure
+layouts and accessors, or small macros, inline functions and templates
+(ten or fewer lines in length), you do both of the following:
+
+ a) Give prominent notice with each copy of the object code that the
+ Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the object code with a copy of the GNU GPL and this license
+ document.
+
+ 4. Combined Works.
+
+ You may convey a Combined Work under terms of your choice that,
+taken together, effectively do not restrict modification of the
+portions of the Library contained in the Combined Work and reverse
+engineering for debugging such modifications, if you also do each of
+the following:
+
+ a) Give prominent notice with each copy of the Combined Work that
+ the Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
+ document.
+
+ c) For a Combined Work that displays copyright notices during
+ execution, include the copyright notice for the Library among
+ these notices, as well as a reference directing the user to the
+ copies of the GNU GPL and this license document.
+
+ d) Do one of the following:
+
+ 0) Convey the Minimal Corresponding Source under the terms of this
+ License, and the Corresponding Application Code in a form
+ suitable for, and under terms that permit, the user to
+ recombine or relink the Application with a modified version of
+ the Linked Version to produce a modified Combined Work, in the
+ manner specified by section 6 of the GNU GPL for conveying
+ Corresponding Source.
+
+ 1) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (a) uses at run time
+ a copy of the Library already present on the user's computer
+ system, and (b) will operate properly with a modified version
+ of the Library that is interface-compatible with the Linked
+ Version.
+
+ e) Provide Installation Information, but only if you would otherwise
+ be required to provide such information under section 6 of the
+ GNU GPL, and only to the extent that such information is
+ necessary to install and execute a modified version of the
+ Combined Work produced by recombining or relinking the
+ Application with a modified version of the Linked Version. (If
+ you use option 4d0, the Installation Information must accompany
+ the Minimal Corresponding Source and Corresponding Application
+ Code. If you use option 4d1, you must provide the Installation
+ Information in the manner specified by section 6 of the GNU GPL
+ for conveying Corresponding Source.)
+
+ 5. Combined Libraries.
+
+ You may place library facilities that are a work based on the
+Library side by side in a single library together with other library
+facilities that are not Applications and are not covered by this
+License, and convey such a combined library under terms of your
+choice, if you do both of the following:
+
+ a) Accompany the combined library with a copy of the same work based
+ on the Library, uncombined with any other library facilities,
+ conveyed under the terms of this License.
+
+ b) Give prominent notice with the combined library that part of it
+ is a work based on the Library, and explaining where to find the
+ accompanying uncombined form of the same work.
+
+ 6. Revised Versions of the GNU Lesser General Public License.
+
+ The Free Software Foundation may publish revised and/or new versions
+of the GNU Lesser General Public License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Library as you received it specifies that a certain numbered version
+of the GNU Lesser General Public License "or any later version"
+applies to it, you have the option of following the terms and
+conditions either of that published version or of any later version
+published by the Free Software Foundation. If the Library as you
+received it does not specify a version number of the GNU Lesser
+General Public License, you may choose any version of the GNU Lesser
+General Public License ever published by the Free Software Foundation.
+
+ If the Library as you received it specifies that a proxy can decide
+whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is
+permanent authorization for you to choose that version for the
+Library.
diff --git a/docs/ide/html5/README.md b/docs/ide/html5/README.md
new file mode 100644
index 0000000..d51b38c
--- /dev/null
+++ b/docs/ide/html5/README.md
@@ -0,0 +1,69 @@
+# ViUR html5
+
+**html5** is a DOM-abstraction layer and API that is used to create client-side Web-Apps running in the browser and written in Python.
+
+Look [here](https://www.viur.dev/blog/html5-library) for a short introduction.
+
+## About
+
+This API and framework is used to implement HTML5 web-apps using the Python programming language. The framework is an abstraction layer for a DOM running in [Pyodide](https://github.com/iodide-project/pyodide), a Python 3 interpreter compiled to web-assembly.
+
+It provides
+
+- class abstraction for all HTML5-DOM-elements, e.g. `html5.Div()`
+- a built-in HTML parser and executor to generate DOM objects from HTML-code
+- helpers for adding/removing classes, arrange children, handling events etc.
+
+The most prominent software completely established on this library is [ViUR-vi](https://github.com/viur-framework/viur-vi/), the visual administration interface for ViUR-based applications.
+
+[ViUR](https://www.viur.dev) is a free software development framework for the [Google App Engine](https://appengine.google.com).
+
+## Quick Start
+
+**Warning: This section is incomplete, a working example will follow soon!**
+
+```python
+import html5
+
+class Game(html5.Div):
+ def __init__(self):
+ super().__init__(
+ """
+
+
+
Hello Enter Name!
+ """)
+ self.sinkEvent("onChange")
+
+ def onChange(self, event):
+ if html5.utils.doesEventHitWidgetOrChildren(event, self.myInput):
+ self.mySpan.appendChild(self.myInput["value"], replace=True)
+
+Game()
+```
+
+## Contributing
+
+We take a great interest in your opinion about ViUR. We appreciate your feedback and are looking forward to hear about your ideas. Share your visions or questions with us and participate in ongoing discussions.
+
+- [ViUR website](https://www.viur.dev)
+- [#ViUR on freenode IRC](https://webchat.freenode.net/?channels=viur)
+- [ViUR on GitHub](https://github.com/viur-framework)
+- [ViUR on Twitter](https://twitter.com/weloveViUR)
+
+## Credits
+
+ViUR is developed and maintained by [Mausbrand Informationssysteme GmbH](https://www.mausbrand.de/en), from Dortmund in Germany. We are a software company consisting of young, enthusiastic software developers, designers and social media experts, working on exciting projects for different kinds of customers. All of our newer projects are implemented with ViUR, from tiny web-pages to huge company intranets with hundreds of users.
+
+Help of any kind to extend and improve or enhance this project in any kind or way is always appreciated.
+
+## License
+
+Copyright (C) 2012-2020 by Mausbrand Informationssysteme GmbH.
+
+Mausbrand and ViUR are registered trademarks of Mausbrand Informationssysteme GmbH.
+
+You may use, modify and distribute this software under the terms and conditions of the GNU Lesser General Public License (LGPL). See the file LICENSE provided within this package for more information.
diff --git a/docs/ide/html5/__init__.py b/docs/ide/html5/__init__.py
new file mode 100644
index 0000000..b62a821
--- /dev/null
+++ b/docs/ide/html5/__init__.py
@@ -0,0 +1,6 @@
+#-*- coding: utf-8 -*-
+
+from .core import *
+from . import ext, utils, ignite
+
+
diff --git a/docs/ide/html5/core.py b/docs/ide/html5/core.py
new file mode 100644
index 0000000..6ebe679
--- /dev/null
+++ b/docs/ide/html5/core.py
@@ -0,0 +1,3152 @@
+# -*- coding: utf-8 -*
+
+########################################################################################################################
+# DOM-access functions and variables
+########################################################################################################################
+
+try:
+ # Pyodide
+ from js import window, eval as jseval
+ document = window.document
+
+except:
+ print("Emulation mode")
+ from xml.dom.minidom import parseString
+
+ jseval = None
+ window = None
+ document = parseString("" + str(txt), "text/html")
+ return dom.body.textContent
+
+ def scanWhite(l):
+ """
+ Scan and return whitespace.
+ """
+
+ ret = ""
+ while l and l[0] in " \t\r\n":
+ ret += l.pop(0)
+
+ return ret
+
+ def scanWord(l):
+ """
+ Scan and return a word.
+ """
+
+ ret = ""
+ while l and l[0] not in " \t\r\n" + "<>=\"'":
+ ret += l.pop(0)
+
+ return ret
+
+ stack = []
+
+ # Obtain tag descriptions, if not already done!
+ global __tags
+
+ if __tags is None:
+ _buildTags(debug=debug)
+
+ # Prepare stack and input
+ stack.append((None, None, HtmlAst()))
+ html = [ch for ch in html]
+
+ # Parse
+ while html:
+ tag = None
+ text = ""
+
+ # Auto-close void elements (_isVoid), e.g. , , etc.
+ while stack and stack[-1][0] and issubclass(__tags[stack[-1][0]][0], _isVoid):
+ stack.pop()
+
+ if not stack:
+ break
+
+ parent = stack[-1][2]
+
+ while html:
+ ch = html.pop(0)
+
+ # Comment
+ if html and ch == "<" and "".join(html[:3]) == "!--":
+ html = html[3:]
+ while html and "".join(html[:3]) != "-->":
+ html.pop(0)
+
+ html = html[3:]
+
+ # Opening tag
+ elif html and ch == "<" and html[0] != "/":
+ tag = scanWord(html)
+ if tag.lower() in __tags:
+ break
+
+ text += ch + tag
+
+ # Closing tag
+ elif html and stack[-1][0] and ch == "<" and html[0] == "/":
+ junk = ch
+ junk += html.pop(0)
+
+ tag = scanWord(html)
+ junk += tag
+
+ if stack[-1][0] == tag.lower():
+ junk += scanWhite(html)
+ if html and html[0] == ">":
+ html.pop(0)
+ stack.pop()
+ tag = None
+ break
+
+ text += junk
+ tag = None
+
+ else:
+ text += ch
+
+ # Append plain text (if not only whitespace)
+ if (text and ((len(text) == 1 and text in ["\t "])
+ or not all([ch in " \t\r\n" for ch in text]))):
+ # print("text", text)
+ parent.append(convertEncodedText(text))
+
+ # Create tag
+ if tag:
+ tag = tag.lower()
+ # print("tag", tag)
+
+ elem = (tag, {}, HtmlAst())
+
+ stack.append(elem)
+ parent.append(elem)
+
+ while html:
+ scanWhite(html)
+ if not html:
+ break
+
+ # End of tag >
+ if html[0] == ">":
+ html.pop(0)
+ break
+
+ # Closing tag at end />
+ elif html[0] == "/":
+ html.pop(0)
+ scanWhite(html)
+
+ if html[0] == ">":
+ stack.pop()
+ html.pop(0)
+ break
+
+ val = att = scanWord(html).lower()
+
+ if not att:
+ html.pop(0)
+ continue
+
+ if att in __tags[tag][1] or att in ["[name]", "style", "disabled", "hidden"] or att.startswith("data-"):
+ scanWhite(html)
+ if html[0] == "=":
+ html.pop(0)
+ scanWhite(html)
+
+ if html[0] in "\"'":
+ ch = html.pop(0)
+
+ val = ""
+ while html and html[0] != ch:
+ val += html.pop(0)
+
+ html.pop(0)
+
+ if att not in elem[1]:
+ elem[1][att] = val
+ else:
+ elem[1][att] += " " + val
+
+ continue
+
+ while stack and stack[-1][0]:
+ stack.pop()
+
+ return stack[0][2]
+
+def fromHTML(html, appendTo=None, bindTo=None, debug=False, vars=None, **kwargs):
+ """
+ Parses the provided HTML code according to the objects defined in the html5-library.
+ html can also be pre-compiled by `parseHTML()` so that it executes faster.
+
+ Constructs all objects as DOM nodes. The first level is chained into appendTo.
+ If no appendTo is provided, appendTo will be set to html5.Body().
+
+ If bindTo is provided, objects are bound to this widget.
+
+ ```python
+ from vi import html5
+
+ div = html5.Div()
+ html5.parse.fromHTML('''
+
+ """)
+
+ if title:
+ self.itemHeadline.appendChild(html5.TextNode(title))
+
+ if descr:
+ self.itemSubline = html5.Div()
+ self.addClass("item-subline ignt-item-subline")
+ self.itemSubline.appendChild(html5.TextNode(descr))
+ self.appendChild(self.itemSubline)
+
+
+@html5.tag
+class Table(html5.Table):
+ _parserTagName = "ignite-table"
+
+ def __init__(self, *args, **kwargs):
+ super(Table, self).__init__(*args, **kwargs)
+ self.head.addClass("ignt-table-head")
+ self.body.addClass("ignt-table-body")
+
+ def prepareRow(self, row):
+ assert row >= 0, "Cannot create rows with negative index"
+
+ for child in self.body._children:
+ row -= child["rowspan"]
+ if row < 0:
+ return
+
+ while row >= 0:
+ tableRow = html5.Tr()
+ tableRow.addClass("ignt-table-body-row")
+ self.body.appendChild(tableRow)
+ row -= 1
+
+ def prepareCol(self, row, col):
+ assert col >= 0, "Cannot create cols with negative index"
+ self.prepareRow(row)
+
+ for rowChild in self.body._children:
+ row -= rowChild["rowspan"]
+
+ if row < 0:
+ for colChild in rowChild._children:
+ col -= colChild["colspan"]
+ if col < 0:
+ return
+
+ while col >= 0:
+ tableCell = html5.Td()
+ tableCell.addClass("ignt-table-body-cell")
+ rowChild.appendChild(tableCell)
+ col -= 1
+
+ return
+ def fastGrid( self, rows, cols, createHidden=False ):
+ colsstr = "".join(['
' for i in range(0, cols)])
+ tblstr = ''
+
+ for r in range(0, rows):
+ tblstr += '
%s
' %("is-hidden" if createHidden else "",colsstr)
+ tblstr +=""
+
+ self.fromHTML(tblstr)
diff --git a/docs/ide/html5/utils.py b/docs/ide/html5/utils.py
new file mode 100644
index 0000000..d80f672
--- /dev/null
+++ b/docs/ide/html5/utils.py
@@ -0,0 +1,101 @@
+# -*- coding: utf-8 -*-
+from . import core as html5
+
+def unescape(val, maxLength = 0):
+ """
+ Unquotes several HTML-quoted characters in a string.
+
+ :param val: The value to be unescaped.
+ :type val: str
+
+ :param maxLength: Cut-off after maxLength characters.
+ A value of 0 means "unlimited". (default)
+ :type maxLength: int
+
+ :returns: The unquoted string.
+ :rtype: str
+ """
+ val = val \
+ .replace("<", "<") \
+ .replace(">", ">") \
+ .replace(""", "\"") \
+ .replace("'", "'")
+
+ if maxLength > 0:
+ return val[0:maxLength]
+
+ return val
+
+def doesEventHitWidgetOrParents(event, widget):
+ """
+ Test if event 'event' hits widget 'widget' (or *any* of its parents)
+ """
+ while widget:
+ if event.target == widget.element:
+ return widget
+
+ widget = widget.parent()
+
+ return None
+
+def doesEventHitWidgetOrChildren(event, widget):
+ """
+ Test if event 'event' hits widget 'widget' (or *any* of its children)
+ """
+ if event.target == widget.element:
+ return widget
+
+ for child in widget.children():
+ if doesEventHitWidgetOrChildren(event, child):
+ return child
+
+ return None
+
+def textToHtml(node, text):
+ """
+ Generates html nodes from text by splitting text into content and into
+ line breaks html5.Br.
+
+ :param node: The node where the nodes are appended to.
+ :param text: The text to be inserted.
+ """
+
+ for (i, part) in enumerate(text.split("\n")):
+ if i > 0:
+ node.appendChild(html5.Br())
+
+ node.appendChild(html5.TextNode(part))
+
+def parseInt(s, ret = 0):
+ """
+ Parses a value as int
+ """
+ if not isinstance(s, str):
+ return int(s)
+ elif s:
+ if s[0] in "+-":
+ ts = s[1:]
+ else:
+ ts = s
+
+ if ts and all([_ in "0123456789" for _ in ts]):
+ return int(s)
+
+ return ret
+
+def parseFloat(s, ret = 0.0):
+ """
+ Parses a value as float.
+ """
+ if not isinstance(s, str):
+ return float(s)
+ elif s:
+ if s[0] in "+-":
+ ts = s[1:]
+ else:
+ ts = s
+
+ if ts and ts.count(".") <= 1 and all([_ in ".0123456789" for _ in ts]):
+ return float(s)
+
+ return ret
diff --git a/docs/ide/index.html b/docs/ide/index.html
new file mode 100644
index 0000000..48a1505
--- /dev/null
+++ b/docs/ide/index.html
@@ -0,0 +1,101 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/docs/ide/is-loading.gif b/docs/ide/is-loading.gif
new file mode 100644
index 0000000..79a8a67
Binary files /dev/null and b/docs/ide/is-loading.gif differ
diff --git a/docs/ide/lark-logo.png b/docs/ide/lark-logo.png
new file mode 100644
index 0000000..d87b68f
Binary files /dev/null and b/docs/ide/lark-logo.png differ