Bläddra i källkod

Revert change to tokens; this is clearer.

tags/v0.1.1
Ben Kurtovic 12 år sedan
förälder
incheckning
3868afdc9c
1 ändrade filer med 37 tillägg och 37 borttagningar
  1. +37
    -37
      mwparserfromhell/parser/tokens.py

+ 37
- 37
mwparserfromhell/parser/tokens.py Visa fil

@@ -63,45 +63,45 @@ class Token(object):
def __delattr__(self, key):
del self._kwargs[key]


def make(name):
"""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)

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

Laddar…
Avbryt
Spara