A Python parser for MediaWiki wikicode https://mwparserfromhell.readthedocs.io/
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 

31 行
766 B

  1. # -*- coding: utf-8 -*-
  2. """
  3. Implements support for both Python 2 and Python 3 by defining common types in
  4. terms of their Python 2/3 variants. For example, :py:class:`str` is set to
  5. :py:class:`unicode` on Python 2 but :py:class:`str` on Python 3; likewise,
  6. :py:class:`bytes` is :py:class:`str` on 2 but :py:class:`bytes` on 3. These
  7. types are meant to be imported directly from within the parser's modules.
  8. """
  9. import sys
  10. py3k = sys.version_info.major == 3
  11. py32 = py3k and sys.version_info.minor == 2
  12. if py3k:
  13. bytes = bytes
  14. str = str
  15. range = range
  16. maxsize = sys.maxsize
  17. import html.entities as htmlentities
  18. else:
  19. bytes = str
  20. str = unicode
  21. range = xrange
  22. maxsize = sys.maxint
  23. import htmlentitydefs as htmlentities
  24. del sys