image

the sleepy snake

index :: html :: GenericTags

generic tags

The html module provides the following generic tags:

Comment(initvalue) html comment. Start and end markers will be wrapped automatically around the string passed. For <style> and <script> tags any content passed is automatically wrapped in Comment() tags. Note: passing multiple contents will result in multiple comment blocks
Doctype(type="loose", doctype=None) doctype declaration of type "loose", "strict", "frameset" or a custom doctype
PI(initvalue) a processing instruction. initvalue is anything inside <?...>
Raw(initvalue) raw chunk of html
SgmlDecl(initvalue) sgml declaration. initvalue is anything inside <!...>
Text(initvalue) wrapper for text. The string passed will be automatically escaped. Note: anything other than a HtmlBase subclass passed to any tag it will be automatically wrapped as Text()

All generic tags are derrived from the following base classes:

HtmlBase base class for all tags
GenericTagBase base class for all generic tags

Generic tags do not provide any methods, instead expose the following attributes:

name name of the tag (lowercase, readonly)
parent parent of the tag or None (readonly)
value contents of the tag wich will always be the complete tag

Notes:

  • PHP instructions are not supported. They do break pythons HTMLParser