瀏覽代碼

Revert change to tokens; this is clearer.

tags/v0.1.1
Ben Kurtovic 12 年之前
父節點
當前提交
3868afdc9c
共有 1 個檔案被更改,包括 37 行新增37 行删除
  1. +37
    -37
      mwparserfromhell/parser/tokens.py

+ 37
- 37
mwparserfromhell/parser/tokens.py 查看文件

@@ -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

Loading…
取消
儲存