A Python parser for MediaWiki wikicode https://mwparserfromhell.readthedocs.io/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

28 lines
652 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. py3k = (sys.version_info[0] == 3)
  11. if py3k:
  12. bytes = bytes
  13. str = str
  14. range = range
  15. import html.entities as htmlentities
  16. else:
  17. bytes = str
  18. str = unicode
  19. range = xrange
  20. import htmlentitydefs as htmlentities
  21. del sys