mcmandelbrot.vroot.Baton(object)
class documentation
Part of mcmandelbrot.vroot
(View In Hierarchy)
The VRoot
gives
an instance of me a reference e to a virtual root element and then
passes my instance to a context caller. The caller can use my convenience
methods to generate XML subelements of the virtual root element, with
placeholders for raw xml/html. Then, when the caller is done, I convert the
tree from the virtual root element into xml/html.
Method | __init__ | Undocumented |
Method | info | Undocumented |
Method | __repr__ | Undocumented |
Method | parent | Returns the parent of the supplied element. |
Method | parentAndClassFromArgs | Undocumented |
Method | se | No summary |
Method | nc | Generates a new child of the last-generated child, another parent specified as an argument, or my root if this is the first child I've generated. |
Method | nci | Iterates over the supplied iterator to generate children of the last-generated child, another parent specified as an argument, or my root if this is the first child I've generated. |
Method | ns | Generates a new child of the parent to the last-generated child or another sibling element specified. The new child will then be considered the last-generated one. |
Method | nu | Generates a new uncle of the last-generated child. This will then be considered the last-generated "child." If a class name is specified, the new element gets that set. |
Method | p | No summary |
Method | ngc | No summary |
Method | rp | No summary |
Method | context | No summary |
Method | np | Assigns a unique placeholder for the supplied content string and stores it to be replaced back during serialization. Returns the placeholder. |
Method | possiblyPlacehold | No summary |
Method | text | Sets the text value of the last-generated child (or an element specified) to the supplied content, with XML escaping if needed. |
Method | textX | Sets the text value of the last-generated child (or an element specified) to the supplied content, with a placeholder if needed to preserve raw XML. |
Method | tail | Sets the tail value of the last-generated child (or an element specified) to the supplied content, with XML escaping if needed. |
Method | tailX | Sets the tail value of the last-generated child (or an element specified) to the supplied content, with a placeholder if needed to preserve raw XML. |
Method | set | Sets an attribute of my last-generated child element. |
Method | meta | Adds a meta tag as a new child, to the last child or a parent specified as a single argument, using the keywords supplied. |
Method | margin | Convenience method to set a margin of my last-generated child element. Specify in em with a float. |
Method | addToMap | Add attribute attrName of the last-generated child to my dynamic-value map. |
Method | html | Gets my HTML rendering, after substituting out any placeholders and applying keywords to my mapped elements. |
Convenience method to return a subelement of the last child I generated (from a subclass entryMethod) before being offered to the context caller. You can use this to generate top-level items within the context of your call to a VROOT.
You can specify a CSS class for the new subelement.
Do not use this method in a VROOT's entryMethod! Doing so will screw up the lastParent. It is for context callers.
Generates a new child of the last-generated child, another parent specified as an argument, or my root if this is the first child I've generated.
Repeated calls to this method without parents specified will result in a nested hierarchy.
If a class name is specified via a string argument, the new child gets that set. The order of the arguments doesn't matter, and neither or both can be specified.
Returns a reference to the new element and saves it as the last-generated child.
Iterates over the supplied iterator to generate children of the last-generated child, another parent specified as an argument, or my root if this is the first child I've generated.
Each child generated will be considered the last-generated one within its iteration, and only there. Children iterated after the first one will be siblings to the first.
If a class name is specified via a string argument, each new child gets that set. The order of the arguments doesn't matter, and neither or both can be specified.
For each iteration, generates a new child of the parent and yields the value of the original iteration. The new child will be treated the last-generated child for that iteration, and only that iteration.
It's expected that you will use stuff like nc to make further children (i.e., grandchilden of the last-generated child) within each iteration, but after the iterations are done, the last-generated child will be restored to where it was before the method call.
Caution: Weird things happen if you do a break
or
continue
. Be warned!
Generates a new child of the parent to the last-generated child or another sibling element specified. The new child will then be considered the last-generated one.
Repeated calls to this method (with or without a sibling element specified) will result in siblings rather than a nested hierarchy, because the parent doesn't change even if the child does.
If a class name is specified, the new child gets that set.
Returns a reference to the new element and saves it as the last-generated child.
Generates a new uncle of the last-generated child. This will then be considered the last-generated "child." If a class name is specified, the new element gets that set.
Useful for making one or more children of an element, and then going on to make a sibling of that element.
Generates a paragraph element as a new child, with either the supplied content as its text, or, if the content is wrapped in paragraph tags, a placeholder for substituting (without the <p> tags) after serialization.
The new element is a child of the last-generated child, unless the last child was also a paragraph. Then the new element is a sibling of that paragraph. You can also specify another parent as an argument. The root is used if this is the first child I've generated. Repeated calls to this method will produce sibling paragraphs, not a nested hierarchy.
If a class name is specified via a string argument, the paragraph element gets that set. The order of any parent/klass arguments doesn't matter, and neither or both can be specified.
Generates a new subelement (somebody's grandchild) of the child last generated with the se, nc, ns, or p method without changing its status as the last child generated. You can specify a parent and class, as usual, in either order.
Repeated calls to this method will result in a succesion of grandchildren with the same ancestors, not a nested hierarchy.
If a class name is specified, the new element gets that set.
Returns a reference to the new element without saving it anywhere.
Reset parent to use for the next child I generate, to the one specified or my seParent. Returns a reference to me (not the parent) for convenience of methods called by my context caller and using me to build stuff.
def context(self):
Isolates a context for you to generate one or more children without affecting my overall context. When the context code completes, restores the last parent/child context to what it was before.
Assigns a unique placeholder for the supplied content string and stores it to be replaced back during serialization. Returns the placeholder.
If the supplied xml/html content string contains a character that must be escaped in XML (e.g., "<"), assigns a unique placeholder for the entire string and stores the content to be replaced back during serialization.
Sets the text value of the last-generated child (or an element specified) to the supplied content, with XML escaping if needed.
Sets the text value of the last-generated child (or an element specified) to the supplied content, with a placeholder if needed to preserve raw XML.
Sets the tail value of the last-generated child (or an element specified) to the supplied content, with XML escaping if needed.
Sets the tail value of the last-generated child (or an element specified) to the supplied content, with a placeholder if needed to preserve raw XML.
Adds a meta tag as a new child, to the last child or a parent specified as a single argument, using the keywords supplied.
The meta tag becomes the new last child.
Convenience method to set a margin of my last-generated child element. Specify in em with a float.