A Python parser for MediaWiki wikicode https://mwparserfromhell.readthedocs.io/
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
 
 
 
 

30 行
760 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, :class:`str` is set to
  5. :class:`unicode` on Python 2 but :class:`str` on Python 3; likewise,
  6. :class:`bytes` is :class:`str` on 2 but :class:`bytes` on 3. These types are
  7. meant to be imported directly from within the parser's modules.
  8. """
  9. import sys
  10. py26 = (sys.version_info[0] == 2) and (sys.version_info[1] == 6)
  11. py3k = (sys.version_info[0] == 3)
  12. py32 = py3k and (sys.version_info[1] == 2)
  13. if py3k:
  14. bytes = bytes
  15. str = str
  16. range = range
  17. import html.entities as htmlentities
  18. else:
  19. bytes = str
  20. str = unicode
  21. range = xrange
  22. import htmlentitydefs as htmlentities
  23. del sys