-
Notifications
You must be signed in to change notification settings - Fork 1
The Tree
The Tree class implements a container element (with children, but no tag name or attributes) which is used as a root container for building trees of HTML.
The engine has a tree attribute, which refers to an initially empty instance of Tree.
You can use operators on an instance of the engine (just like you can with elements and slices). The operators work as normal, and operate on the tree. For example, the following code creates an engine, then appends three empty DIVs to its tree:
doc = Engine()
doc *= DIV(), DIV(), DIV()Note: When passing empty elements as children (to a constructor or operator), you can just pass in the class itself, so the following example is equivalent to the last:
doc = Engine()
doc *= DIV, DIV, DIVHTME | The Hypertext Markup Engine | Simple, Pythonic HTML Code Generation for Python 2 or 3
To learn to use HTME, read these articles (in this order):