Python: module simpleparse.examples.formatvrml

simpleparse.examples.formatvrml | index s:\sp\simpleparse\examples\formatvrml.py

`Example using a parser to format VRML97 code as HTML w/CSS`

Modules
`` |  |
os | string | sys |

Classes
`` |  | VRMLFormatter HTMLVRMLFormatter
class HTMLVRMLFormatter(VRMLFormatter)
`` | `Format VRML files for display in HTML`
| Methods defined here: _escapeData(self, data) _headdata(self, nodetype, head=1) Data and non-method functions defined here: NODEMAP = {'DEF': '<%(head)sstrong>', 'DEFName': '<span class="%(nodetype)s">', 'DEFName_tail': '</span>', 'EXTERNPROTO': '<span class="%(nodetype)s">', 'EXTERNPROTO_tail': '</span>', 'PROTO': '<span class="%(nodetype)s">', 'PROTO_tail': '</span>', 'ROUTEData': '<strong class="%(nodetype)s">', 'ROUTEData_tail': '</span>', 'SFString': '<span class="%(nodetype)s">', ...} `dict() -> new empty dictionary. dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs. dict(seq) -> new dictionary initialized as if via: d = {} for k, v in seq: d[k] = v` __doc__ = '\n\tFormat VRML files for display in HTML\n\t' `str(object) -> string Return a nice string representation of the object. If the argument is a string, the return value is the same object.` __module__ = 'simpleparse.examples.formatvrml' `str(object) -> string Return a nice string representation of the object. If the argument is a string, the return value is the same object.` Methods inherited from VRMLFormatter: __init__(self, infile, vrmlparser=<simpleparse.parser.Parser instance at 0x008B06E0>) _format(self, tup, outfile, infile) `Step through the children, our result is thisnode's head, data_to_first_child, firstchild, data_to_second_child, secondchild,...,data_from_last_child, thisnode's tail` format(self, outfile)
class VRMLFormatter
`` | `Base formatting class`
| Methods defined here: __init__(self, infile, vrmlparser=<simpleparse.parser.Parser instance at 0x008B06E0>) _escapeData(self, data) _format(self, tup, outfile, infile) `Step through the children, our result is thisnode's head, data_to_first_child, firstchild, data_to_second_child, secondchild,...,data_from_last_child, thisnode's tail` _headdata(self, nodetype, head=1) `Return head or tail data for this nodetype if available, None otherwise` format(self, outfile) Data and non-method functions defined here: __doc__ = '\n\tBase formatting class\n\t' `str(object) -> string Return a nice string representation of the object. If the argument is a string, the return value is the same object.` __module__ = 'simpleparse.examples.formatvrml' `str(object) -> string Return a nice string representation of the object. If the argument is a string, the return value is the same object.`

Data
`` |  | VRMLPARSERDEF = '\n# Specialised VRML parser for colourising VRML ... := ( [ \\011-\\015,]+ / comment+ )*\n' __file__ = r'S:\sp\simpleparse\examples\formatvrml.pyc' __name__ = 'simpleparse.examples.formatvrml' usage = "formatvrml.py infile outfile\n\tinfile -- properly... your\n\tVRML by changing this file's definitions.\n" vrmlparser = <simpleparse.parser.Parser instance at 0x008B06E0>