|
@@ -63,45 +63,45 @@ class Token(object): |
|
|
def __delattr__(self, key): |
|
|
def __delattr__(self, key): |
|
|
del self._kwargs[key] |
|
|
del self._kwargs[key] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def make(name): |
|
|
def make(name): |
|
|
"""Create a new Token class using ``type()`` and add it to ``__all__``.""" |
|
|
"""Create a new Token class using ``type()`` and add it to ``__all__``.""" |
|
|
token = type(name if py3k else name.encode("utf8"), (Token,), {}) |
|
|
|
|
|
globals()[name] = token |
|
|
|
|
|
__all__.append(name) |
|
|
__all__.append(name) |
|
|
|
|
|
|
|
|
make("Text") |
|
|
|
|
|
|
|
|
|
|
|
make("TemplateOpen") # {{ |
|
|
|
|
|
make("TemplateParamSeparator") # | |
|
|
|
|
|
make("TemplateParamEquals") # = |
|
|
|
|
|
make("TemplateClose") # }} |
|
|
|
|
|
|
|
|
|
|
|
make("ArgumentOpen") # {{{ |
|
|
|
|
|
make("ArgumentSeparator") # | |
|
|
|
|
|
make("ArgumentClose") # }}} |
|
|
|
|
|
|
|
|
|
|
|
make("WikilinkOpen") # [[ |
|
|
|
|
|
make("WikilinkSeparator") # | |
|
|
|
|
|
make("WikilinkClose") # ]] |
|
|
|
|
|
|
|
|
|
|
|
make("HTMLEntityStart") # & |
|
|
|
|
|
make("HTMLEntityNumeric") # # |
|
|
|
|
|
make("HTMLEntityHex") # x |
|
|
|
|
|
make("HTMLEntityEnd") # ; |
|
|
|
|
|
|
|
|
|
|
|
make("HeadingStart") # =... |
|
|
|
|
|
make("HeadingEnd") # =... |
|
|
|
|
|
|
|
|
|
|
|
make("CommentStart") # <!-- |
|
|
|
|
|
make("CommentEnd") # --> |
|
|
|
|
|
|
|
|
|
|
|
make("TagOpenOpen") # < |
|
|
|
|
|
make("TagAttrStart") |
|
|
|
|
|
make("TagAttrEquals") # = |
|
|
|
|
|
make("TagAttrQuote") # " |
|
|
|
|
|
make("TagCloseOpen") # > |
|
|
|
|
|
make("TagCloseSelfclose") # /> |
|
|
|
|
|
make("TagOpenClose") # </ |
|
|
|
|
|
make("TagCloseClose") # > |
|
|
|
|
|
|
|
|
return type(name if py3k else name.encode("utf8"), (Token,), {}) |
|
|
|
|
|
|
|
|
|
|
|
Text = make("Text") |
|
|
|
|
|
|
|
|
|
|
|
TemplateOpen = make("TemplateOpen") # {{ |
|
|
|
|
|
TemplateParamSeparator = make("TemplateParamSeparator") # | |
|
|
|
|
|
TemplateParamEquals = make("TemplateParamEquals") # = |
|
|
|
|
|
TemplateClose = make("TemplateClose") # }} |
|
|
|
|
|
|
|
|
|
|
|
ArgumentOpen = make("ArgumentOpen") # {{{ |
|
|
|
|
|
ArgumentSeparator = make("ArgumentSeparator") # | |
|
|
|
|
|
ArgumentClose = make("ArgumentClose") # }}} |
|
|
|
|
|
|
|
|
|
|
|
WikilinkOpen = make("WikilinkOpen") # [[ |
|
|
|
|
|
WikilinkSeparator = make("WikilinkSeparator") # | |
|
|
|
|
|
WikilinkClose = make("WikilinkClose") # ]] |
|
|
|
|
|
|
|
|
|
|
|
HTMLEntityStart = make("HTMLEntityStart") # & |
|
|
|
|
|
HTMLEntityNumeric = make("HTMLEntityNumeric") # # |
|
|
|
|
|
HTMLEntityHex = make("HTMLEntityHex") # x |
|
|
|
|
|
HTMLEntityEnd = make("HTMLEntityEnd") # ; |
|
|
|
|
|
|
|
|
|
|
|
HeadingStart = make("HeadingStart") # =... |
|
|
|
|
|
HeadingEnd = make("HeadingEnd") # =... |
|
|
|
|
|
|
|
|
|
|
|
CommentStart = make("CommentStart") # <!-- |
|
|
|
|
|
CommentEnd = make("CommentEnd") # --> |
|
|
|
|
|
|
|
|
|
|
|
TagOpenOpen = make("TagOpenOpen") # < |
|
|
|
|
|
TagAttrStart = make("TagAttrStart") |
|
|
|
|
|
TagAttrEquals = make("TagAttrEquals") # = |
|
|
|
|
|
TagAttrQuote = make("TagAttrQuote") # " |
|
|
|
|
|
TagCloseOpen = make("TagCloseOpen") # > |
|
|
|
|
|
TagCloseSelfclose = make("TagCloseSelfclose") # /> |
|
|
|
|
|
TagOpenClose = make("TagOpenClose") # </ |
|
|
|
|
|
TagCloseClose = make("TagCloseClose") # > |
|
|
|
|
|
|
|
|
del make |
|
|
del make |