Permalink
Browse files

Work in progress

--HG--
branch : svgmathml
rename : python/README => python3/README
rename : python/html5-tests.patch => python3/html5-tests.patch
rename : python/parse.py => python3/parse.py
rename : python/setup.py => python3/setup.py
rename : python/setup_base.py => python3/setup_base.py
rename : python/src/html5lib/__init__.py => python3/src/html5lib/__init__.py
rename : python/src/html5lib/constants.py => python3/src/html5lib/constants.py
rename : python/src/html5lib/filters/__init__.py => python3/src/html5lib/filters/__init__.py
rename : python/src/html5lib/filters/_base.py => python3/src/html5lib/filters/_base.py
rename : python/src/html5lib/filters/formfiller.py => python3/src/html5lib/filters/formfiller.py
rename : python/src/html5lib/filters/inject_meta_charset.py => python3/src/html5lib/filters/inject_meta_charset.py
rename : python/src/html5lib/filters/iso639codes.py => python3/src/html5lib/filters/iso639codes.py
rename : python/src/html5lib/filters/lint.py => python3/src/html5lib/filters/lint.py
rename : python/src/html5lib/filters/optionaltags.py => python3/src/html5lib/filters/optionaltags.py
rename : python/src/html5lib/filters/rfc2046.py => python3/src/html5lib/filters/rfc2046.py
rename : python/src/html5lib/filters/rfc3987.py => python3/src/html5lib/filters/rfc3987.py
rename : python/src/html5lib/filters/sanitizer.py => python3/src/html5lib/filters/sanitizer.py
rename : python/src/html5lib/filters/validator.py => python3/src/html5lib/filters/validator.py
rename : python/src/html5lib/filters/whitespace.py => python3/src/html5lib/filters/whitespace.py
rename : python/src/html5lib/html5parser.py => python3/src/html5lib/html5parser.py
rename : python/src/html5lib/ihatexml.py => python3/src/html5lib/ihatexml.py
rename : python/src/html5lib/inputstream.py => python3/src/html5lib/inputstream.py
rename : python/src/html5lib/liberalxmlparser.py => python3/src/html5lib/liberalxmlparser.py
rename : python/src/html5lib/sanitizer.py => python3/src/html5lib/sanitizer.py
rename : python/src/html5lib/serializer/__init__.py => python3/src/html5lib/serializer/__init__.py
rename : python/src/html5lib/serializer/htmlserializer.py => python3/src/html5lib/serializer/htmlserializer.py
rename : python/src/html5lib/serializer/xhtmlserializer.py => python3/src/html5lib/serializer/xhtmlserializer.py
rename : python/src/html5lib/tokenizer.py => python3/src/html5lib/tokenizer.py
rename : python/src/html5lib/treebuilders/__init__.py => python3/src/html5lib/treebuilders/__init__.py
rename : python/src/html5lib/treebuilders/_base.py => python3/src/html5lib/treebuilders/_base.py
rename : python/src/html5lib/treebuilders/dom.py => python3/src/html5lib/treebuilders/dom.py
rename : python/src/html5lib/treebuilders/etree.py => python3/src/html5lib/treebuilders/etree.py
rename : python/src/html5lib/treebuilders/etree_lxml.py => python3/src/html5lib/treebuilders/etree_lxml.py
rename : python/src/html5lib/treebuilders/simpletree.py => python3/src/html5lib/treebuilders/simpletree.py
rename : python/src/html5lib/treebuilders/soup.py => python3/src/html5lib/treebuilders/soup.py
rename : python/src/html5lib/treewalkers/__init__.py => python3/src/html5lib/treewalkers/__init__.py
rename : python/src/html5lib/treewalkers/_base.py => python3/src/html5lib/treewalkers/_base.py
rename : python/src/html5lib/treewalkers/dom.py => python3/src/html5lib/treewalkers/dom.py
rename : python/src/html5lib/treewalkers/etree.py => python3/src/html5lib/treewalkers/etree.py
rename : python/src/html5lib/treewalkers/genshistream.py => python3/src/html5lib/treewalkers/genshistream.py
rename : python/src/html5lib/treewalkers/lxmletree.py => python3/src/html5lib/treewalkers/lxmletree.py
rename : python/src/html5lib/treewalkers/pulldom.py => python3/src/html5lib/treewalkers/pulldom.py
rename : python/src/html5lib/treewalkers/simpletree.py => python3/src/html5lib/treewalkers/simpletree.py
rename : python/src/html5lib/treewalkers/soup.py => python3/src/html5lib/treewalkers/soup.py
rename : python/src/html5lib/utils.py => python3/src/html5lib/utils.py
rename : python/tests/README => python3/tests/README
rename : python/tests/__init__.py => python3/tests/__init__.py
rename : python/tests/mockParser.py => python3/tests/mockParser.py
rename : python/tests/performance/concatenation.py => python3/tests/performance/concatenation.py
rename : python/tests/runparsertests.py => python3/tests/runparsertests.py
rename : python/tests/runtests.py => python3/tests/runtests.py
rename : python/tests/support.py => python3/tests/support.py
rename : python/tests/test_encoding.py => python3/tests/test_encoding.py
rename : python/tests/test_formfiller.py => python3/tests/test_formfiller.py
rename : python/tests/test_lxp.py => python3/tests/test_lxp.py
rename : python/tests/test_parser.py => python3/tests/test_parser.py
rename : python/tests/test_parser2.py => python3/tests/test_parser2.py
rename : python/tests/test_sanitizer.py => python3/tests/test_sanitizer.py
rename : python/tests/test_sax.py => python3/tests/test_sax.py
rename : python/tests/test_serializer.py => python3/tests/test_serializer.py
rename : python/tests/test_stream.py => python3/tests/test_stream.py
rename : python/tests/test_tokenizer.py => python3/tests/test_tokenizer.py
rename : python/tests/test_treewalkers.py => python3/tests/test_treewalkers.py
rename : python/tests/test_validator.py => python3/tests/test_validator.py
rename : python/tests/test_whitespace_filter.py => python3/tests/test_whitespace_filter.py
rename : python/tests/us-ascii.html => python3/tests/us-ascii.html
rename : python/tests/utf-8-bom.html => python3/tests/utf-8-bom.html
rename : python/utils/encodings.py => python3/utils/encodings.py
rename : python/utils/extract-entities.py => python3/utils/extract-entities.py
rename : python/utils/iana_parse.py => python3/utils/iana_parse.py
rename : python/utils/package.py => python3/utils/package.py
rename : python/utils/spider.py => python3/utils/spider.py
rename : python/validate.py => python3/validate.py
extra : convert_revision : svn%3Aacbfec75-9323-0410-a652-858a13e371e0/branches/svgmathml%401265
  • Loading branch information...
0 parents commit 495b92b463a6749dfeb491def73c93a275adcf5b jgraham.html committed Feb 1, 2009
Showing with 13,978 additions and 0 deletions.
  1. +39 −0 README
  2. +145 −0 html5-tests.patch
  3. +202 −0 parse.py
  4. +43 −0 setup.py
  5. +40 −0 setup_base.py
  6. +19 −0 src/html5lib/__init__.py
  7. +1,112 −0 src/html5lib/constants.py
  8. 0 src/html5lib/filters/__init__.py
  9. +10 −0 src/html5lib/filters/_base.py
  10. +127 −0 src/html5lib/filters/formfiller.py
  11. +63 −0 src/html5lib/filters/inject_meta_charset.py
  12. +749 −0 src/html5lib/filters/iso639codes.py
  13. +88 −0 src/html5lib/filters/lint.py
  14. +196 −0 src/html5lib/filters/optionaltags.py
  15. +29 −0 src/html5lib/filters/rfc2046.py
  16. +79 −0 src/html5lib/filters/rfc3987.py
  17. +8 −0 src/html5lib/filters/sanitizer.py
  18. +716 −0 src/html5lib/filters/validator.py
  19. +41 −0 src/html5lib/filters/whitespace.py
  20. +2,271 −0 src/html5lib/html5parser.py
  21. +170 −0 src/html5lib/ihatexml.py
  22. +727 −0 src/html5lib/inputstream.py
  23. +156 −0 src/html5lib/liberalxmlparser.py
  24. +228 −0 src/html5lib/sanitizer.py
  25. +3 −0 src/html5lib/serializer/__init__.py
  26. +218 −0 src/html5lib/serializer/htmlserializer.py
  27. +9 −0 src/html5lib/serializer/xhtmlserializer.py
  28. +1,151 −0 src/html5lib/tokenizer.py
  29. +79 −0 src/html5lib/treebuilders/__init__.py
  30. +340 −0 src/html5lib/treebuilders/_base.py
  31. +245 −0 src/html5lib/treebuilders/dom.py
  32. +288 −0 src/html5lib/treebuilders/etree.py
  33. +300 −0 src/html5lib/treebuilders/etree_lxml.py
  34. +219 −0 src/html5lib/treebuilders/simpletree.py
  35. +203 −0 src/html5lib/treebuilders/soup.py
  36. +52 −0 src/html5lib/treewalkers/__init__.py
  37. +156 −0 src/html5lib/treewalkers/_base.py
  38. +37 −0 src/html5lib/treewalkers/dom.py
  39. +120 −0 src/html5lib/treewalkers/etree.py
  40. +67 −0 src/html5lib/treewalkers/genshistream.py
  41. +168 −0 src/html5lib/treewalkers/lxmletree.py
  42. +52 −0 src/html5lib/treewalkers/pulldom.py
  43. +72 −0 src/html5lib/treewalkers/simpletree.py
  44. +59 −0 src/html5lib/treewalkers/soup.py
  45. +156 −0 src/html5lib/utils.py
  46. +3 −0 tests/README
  47. +1 −0 tests/__init__.py
  48. +37 −0 tests/mockParser.py
  49. +30 −0 tests/performance/concatenation.py
  50. +27 −0 tests/runparsertests.py
  51. +26 −0 tests/runtests.py
  52. +121 −0 tests/support.py
  53. +54 −0 tests/test_encoding.py
  54. +296 −0 tests/test_formfiller.py
  55. +243 −0 tests/test_lxp.py
  56. +161 −0 tests/test_parser.py
  57. +28 −0 tests/test_parser2.py
  58. +91 −0 tests/test_sanitizer.py
  59. +115 −0 tests/test_sax.py
  60. +78 −0 tests/test_serializer.py
  61. +94 −0 tests/test_stream.py
  62. +169 −0 tests/test_tokenizer.py
  63. +303 −0 tests/test_treewalkers.py
  64. +32 −0 tests/test_validator.py
  65. +123 −0 tests/test_whitespace_filter.py
  66. +3 −0 tests/us-ascii.html
  67. +3 −0 tests/utf-8-bom.html
  68. +225 −0 utils/encodings.py
  69. +13 −0 utils/extract-entities.py
  70. +24 −0 utils/iana_parse.py
  71. +234 −0 utils/package.py
  72. +123 −0 utils/spider.py
  73. +69 −0 validate.py
@@ -0,0 +1,39 @@
+html5lib is a pure-python library for parsing HTML. It is designed to
+conform to the HTML 5 specification, which has formalized the error handling
+algorithms of popular web browsers.
+
+ = Installation =
+
+html5lib is packaged with distutils. To install it use:
+ $ python setup.py install
+
+ = Tests =
+
+You may wish to check that your installation has been a success by
+running the testsuite. All the tests can be run by invoking
+runtests.py in the tests/ directory
+
+ = Usage =
+
+Simple usage follows this pattern:
+
+import html5lib
+f = open("mydocument.html")
+parser = html5lib.HTMLParser()
+document = parser.parse(f)
+
+
+More documentation is avaliable in the docstrings or from
+http://code.google.com/p/html5lib/wiki/UserDocumentation
+
+ = Bugs =
+
+Please report any bugs on the issue tracker:
+http://code.google.com/p/html5lib/issues/list
+
+ = Get Involved =
+
+Contributions to code or documenation are actively encouraged. Submit
+patches to the issue tracker or discuss changes on irc in the #whatwg
+channel on freenode.net
+
@@ -0,0 +1,145 @@
+Index: src/html5lib/treebuilders/dom.py
+===================================================================
+--- src/html5lib/treebuilders/dom.py (revision 1118)
++++ src/html5lib/treebuilders/dom.py (working copy)
+@@ -137,16 +137,21 @@
+ rv = []
+ def serializeElement(element, indent=0):
+ if element.nodeType == Node.DOCUMENT_TYPE_NODE:
+- if element.name:
+- rv.append("|%s<!DOCTYPE %s>"%(' '*indent, element.name))
++ if element.publicId:
++ if element.systemId:
++ rv.append('|%s<!DOCTYPE %s PUBLIC "%s" "%s">'%(' '*indent, element.name or "", element.publicId, element.systemId))
++ else:
++ rv.append('|%s<!DOCTYPE %s PUBLIC "%s">'%(' '*indent, element.name or "", element.publicId))
++ elif element.systemId:
++ rv.append('|%s<!DOCTYPE %s SYSTEM "%s">'%(' '*indent, element.name or "", element.systemId))
+ else:
+- rv.append("|%s<!DOCTYPE >"%(' '*indent,))
++ rv.append("|%s<!DOCTYPE %s>"%(' '*indent, element.name or ""))
+ elif element.nodeType == Node.DOCUMENT_NODE:
+ rv.append("#document")
+ elif element.nodeType == Node.DOCUMENT_FRAGMENT_NODE:
+ rv.append("#document-fragment")
+ elif element.nodeType == Node.COMMENT_NODE:
+- rv.append("|%s<!-- %s -->"%(' '*indent, element.nodeValue))
++ rv.append("|%s<!--%s-->"%(' '*indent, element.nodeValue))
+ elif element.nodeType == Node.TEXT_NODE:
+ rv.append("|%s\"%s\"" %(' '*indent, element.nodeValue))
+ else:
+Index: src/html5lib/treebuilders/etree.py
+===================================================================
+--- src/html5lib/treebuilders/etree.py (revision 1118)
++++ src/html5lib/treebuilders/etree.py (working copy)
+@@ -169,7 +169,15 @@
+ if not(hasattr(element, "tag")):
+ element = element.getroot()
+ if element.tag == "<!DOCTYPE>":
+- rv.append("|%s<!DOCTYPE %s>"%(' '*indent, element.text))
++ if element.get("publicId"):
++ if element.get("systemId"):
++ rv.append('|%s<!DOCTYPE %s PUBLIC "%s" "%s">'%(' '*indent, element.text, element.get("publicId"), element.get("systemId")))
++ else:
++ rv.append('|%s<!DOCTYPE %s PUBLIC "%s">'%(' '*indent, element.text, element.get("publicId")))
++ elif element.get("systemId"):
++ rv.append('|%s<!DOCTYPE %s SYSTEM "%s">'%(' '*indent, element.text, element.get("systemId")))
++ else:
++ rv.append("|%s<!DOCTYPE %s>"%(' '*indent, element.text))
+ elif element.tag == "<DOCUMENT_ROOT>":
+ rv.append("#document")
+ if element.text:
+@@ -177,7 +185,7 @@
+ if element.tail:
+ finalText = element.tail
+ elif type(element.tag) == type(ElementTree.Comment):
+- rv.append("|%s<!-- %s -->"%(' '*indent, element.text))
++ rv.append("|%s<!--%s-->"%(' '*indent, element.text))
+ else:
+ rv.append("|%s<%s>"%(' '*indent, element.tag))
+ if hasattr(element, "attrib"):
+Index: src/html5lib/treebuilders/etree_lxml.py
+===================================================================
+--- src/html5lib/treebuilders/etree_lxml.py (revision 1118)
++++ src/html5lib/treebuilders/etree_lxml.py (working copy)
+@@ -50,12 +50,19 @@
+ if not hasattr(element, "tag"):
+ rv.append("#document")
+ if element.docinfo.internalDTD:
+- if not (element.docinfo.public_id or element.docinfo.system_url):
++ if element.docinfo.public_id:
++ if element.docinfo.system_url:
++ dtd_str = """<!DOCTYPE %s PUBLIC "%s" "%s">"""%(
++ element.docinfo.root_name, element.docinfo.public_id,
++ element.docinfo.system_url)
++ else:
++ dtd_str = """<!DOCTYPE %s PUBLIC "%s">"""%(
++ element.docinfo.root_name, element.docinfo.public_id)
++ elif element.docinfo.system_url:
++ dtd_str = """<!DOCTYPE %s SYSTEM "%s">"""%(
++ element.docinfo.root_name, element.docinfo.system_url)
++ else:
+ dtd_str = "<!DOCTYPE %s>"%element.docinfo.root_name
+- else:
+- dtd_str = """<!DOCTYPE %s PUBLIC "%s" "%s">"""%(
+- element.docinfo.root_name, element.docinfo.public_id,
+- element.docinfo.system_url)
+ rv.append("|%s%s"%(' '*(indent+2), dtd_str))
+ next_element = element.getroot()
+ while next_element.getprevious() is not None:
+@@ -64,7 +71,7 @@
+ serializeElement(next_element, indent+2)
+ next_element = next_element.getnext()
+ elif type(element.tag) == type(etree.Comment):
+- rv.append("|%s<!-- %s -->"%(' '*indent, element.text))
++ rv.append("|%s<!--%s-->"%(' '*indent, element.text))
+ else:
+ rv.append("|%s<%s>"%(' '*indent, element.tag))
+ if hasattr(element, "attrib"):
+Index: src/html5lib/treebuilders/simpletree.py
+===================================================================
+--- src/html5lib/treebuilders/simpletree.py (revision 1118)
++++ src/html5lib/treebuilders/simpletree.py (working copy)
+@@ -112,7 +112,15 @@
+ self.systemId = u""
+
+ def __unicode__(self):
+- return u"<!DOCTYPE %s>" % self.name
++ if self.publicId:
++ if self.systemId:
++ return u'<!DOCTYPE %s PUBLIC "%s" "%s">'%(self.name, self.publicId, self.systemId)
++ else:
++ return u'<!DOCTYPE %s PUBLIC "%s">'%(self.name, self.publicId)
++ elif self.systemId:
++ return u'<!DOCTYPE %s SYSTEM "%s">'%(self.name, self.systemId)
++ else:
++ return u"<!DOCTYPE %s>"%self.name
+
+ toxml = __unicode__
+
+@@ -186,7 +194,7 @@
+ self.data = data
+
+ def __unicode__(self):
+- return "<!-- %s -->" % self.data
++ return u"<!--%s-->" % self.data
+
+ def toxml(self):
+ return "<!--%s-->" % self.data
+Index: tests/support.py
+===================================================================
+--- tests/support.py (revision 1118)
++++ tests/support.py (working copy)
+@@ -11,10 +11,10 @@
+
+ #Define the location of the tests as this changes in release versions
+ #RELEASE remove
+-test_dir = os.path.join(os.path.pardir,os.path.pardir,'testdata')
++test_dir = os.path.join(os.path.pardir,os.path.pardir,os.path.pardir,'html5-tests')
+ #END RELEASE
+ #RELEASE add
+-#test_dir = './testdata'
++#test_dir = './html5-tests'
+ #END RELEASE
+
+ try:
@@ -0,0 +1,202 @@
+#!/usr/bin/env python
+"""usage: %prog [options] filename
+
+Parse a document to a simpletree tree, with optional profiling
+"""
+#RELEASE move ./examples/
+
+import sys
+import os
+from optparse import OptionParser
+
+#RELEASE remove
+sys.path.insert(0,os.path.abspath(os.path.join(__file__,'../src')))
+#END RELEASE
+from html5lib import html5parser, liberalxmlparser, sanitizer
+from html5lib.tokenizer import HTMLTokenizer
+from html5lib import treebuilders, serializer, treewalkers
+from html5lib import constants
+
+def parse():
+ optParser = getOptParser()
+ opts,args = optParser.parse_args()
+ encoding = None
+
+ try:
+ f = args[-1]
+ # Try opening from the internet
+ if f.startswith('http://'):
+ try:
+ import urllib, cgi
+ f = urllib.urlopen(f)
+ contentType = f.headers.get('content-type')
+ if contentType:
+ (mediaType, params) = cgi.parse_header(contentType)
+ encoding = params.get('charset')
+ except: pass
+ elif f == '-':
+ f = sys.stdin
+ else:
+ try:
+ # Try opening from file system
+ f = open(f)
+ except IOError: pass
+ except IndexError:
+ sys.stderr.write("No filename provided. Use -h for help\n")
+ sys.exit(1)
+
+ treebuilder = treebuilders.getTreeBuilder(opts.treebuilder)
+
+ if opts.sanitize:
+ tokenizer = sanitizer.HTMLSanitizer
+ else:
+ tokenizer = HTMLTokenizer
+
+ if opts.xml:
+ p = liberalxmlparser.XHTMLParser(tree=treebuilder, tokenizer=tokenizer)
+ else:
+ p = html5parser.HTMLParser(tree=treebuilder, tokenizer=tokenizer)
+
+ if opts.fragment:
+ parseMethod = p.parseFragment
+ else:
+ parseMethod = p.parse
+
+ if opts.profile:
+ #XXX should import cProfile instead and use that
+ import hotshot
+ import hotshot.stats
+ prof = hotshot.Profile('stats.prof')
+ prof.runcall(parseMethod, f, encoding=encoding)
+ prof.close()
+ # XXX - We should use a temp file here
+ stats = hotshot.stats.load('stats.prof')
+ stats.strip_dirs()
+ stats.sort_stats('time')
+ stats.print_stats()
+ elif opts.time:
+ import time
+ t0 = time.time()
+ document = parseMethod(f, encoding=encoding)
+ t1 = time.time()
+ printOutput(p, document, opts)
+ t2 = time.time()
+ sys.stderr.write("\n\nRun took: %fs (plus %fs to print the output)"%(t1-t0, t2-t1))
+ else:
+ document = parseMethod(f, encoding=encoding)
+ printOutput(p, document, opts)
+
+def printOutput(parser, document, opts):
+ if opts.encoding:
+ print "Encoding:", parser.tokenizer.stream.charEncoding
+ if opts.xml:
+ sys.stdout.write(document.toxml("utf-8"))
+ elif opts.tree:
+ if not hasattr(document,'__getitem__'): document = [document]
+ for fragment in document:
+ print parser.tree.testSerializer(fragment).encode("utf-8")
+ elif opts.hilite:
+ sys.stdout.write(document.hilite("utf-8"))
+ elif opts.html:
+ kwargs = {}
+ for opt in serializer.HTMLSerializer.options:
+ kwargs[opt] = getattr(opts,opt)
+ if not kwargs['quote_char']: del kwargs['quote_char']
+ tokens = treewalkers.getTreeWalker(opts.treebuilder)(document)
+ for text in serializer.HTMLSerializer(**kwargs).serialize(tokens, encoding='utf-8'):
+ sys.stdout.write(text)
+ if not text.endswith('\n'): sys.stdout.write('\n')
+ if opts.error:
+ errList=[]
+ for pos, errorcode, datavars in parser.errors:
+ errList.append("Line %i Col %i"%pos + " " + constants.E.get(errorcode, 'Unknown error "%s"' % errorcode) % datavars)
+ sys.stdout.write("\nParse errors:\n" + "\n".join(errList)+"\n")
+
+def getOptParser():
+ parser = OptionParser(usage=__doc__)
+
+ parser.add_option("-p", "--profile", action="store_true", default=False,
+ dest="profile", help="Use the hotshot profiler to "
+ "produce a detailed log of the run")
+
+ parser.add_option("-t", "--time",
+ action="store_true", default=False, dest="time",
+ help="Time the run using time.time (may not be accurate on all platforms, especially for short runs)")
+
+ parser.add_option("-b", "--treebuilder", action="store", type="string",
+ dest="treebuilder", default="simpleTree")
+
+ parser.add_option("-e", "--error", action="store_true", default=False,
+ dest="error", help="Print a list of parse errors")
+
+ parser.add_option("-f", "--fragment", action="store_true", default=False,
+ dest="fragment", help="Parse as a fragment")
+
+ parser.add_option("", "--tree", action="store_true", default=False,
+ dest="tree", help="Output as debug tree")
+
+ parser.add_option("-x", "--xml", action="store_true", default=False,
+ dest="xml", help="Output as xml")
+
+ parser.add_option("", "--no-html", action="store_false", default=True,
+ dest="html", help="Don't output html")
+
+ parser.add_option("", "--hilite", action="store_true", default=False,
+ dest="hilite", help="Output as formatted highlighted code.")
+
+ parser.add_option("-c", "--encoding", action="store_true", default=False,
+ dest="encoding", help="Print character encoding used")
+
+ parser.add_option("", "--inject-meta-charset", action="store_true",
+ default=False, dest="inject_meta_charset",
+ help="inject <meta charset>")
+
+ parser.add_option("", "--strip-whitespace", action="store_true",
+ default=False, dest="strip_whitespace",
+ help="strip whitespace")
+
+ parser.add_option("", "--omit-optional-tags", action="store_true",
+ default=False, dest="omit_optional_tags",
+ help="omit optional tags")
+
+ parser.add_option("", "--quote-attr-values", action="store_true",
+ default=False, dest="quote_attr_values",
+ help="quote attribute values")
+
+ parser.add_option("", "--use-best-quote-char", action="store_true",
+ default=False, dest="use_best_quote_char",
+ help="use best quote character")
+
+ parser.add_option("", "--quote-char", action="store",
+ default=None, dest="quote_char",
+ help="quote character")
+
+ parser.add_option("", "--no-minimize-boolean-attributes",
+ action="store_false", default=True,
+ dest="minimize_boolean_attributes",
+ help="minimize boolean attributes")
+
+ parser.add_option("", "--use-trailing-solidus", action="store_true",
+ default=False, dest="use_trailing_solidus",
+ help="use trailing solidus")
+
+ parser.add_option("", "--space-before-trailing-solidus",
+ action="store_true", default=False,
+ dest="space_before_trailing_solidus",
+ help="add space before trailing solidus")
+
+ parser.add_option("", "--escape-lt-in-attrs", action="store_true",
+ default=False, dest="escape_lt_in_attrs",
+ help="escape less than signs in attribute values")
+
+ parser.add_option("", "--escape-rcdata", action="store_true",
+ default=False, dest="escape_rcdata",
+ help="escape rcdata element values")
+
+ parser.add_option("", "--sanitize", action="store_true", default=False,
+ dest="sanitize", help="sanitize")
+
+ return parser
+
+if __name__ == "__main__":
+ parse()
Oops, something went wrong.

0 comments on commit 495b92b

Please sign in to comment.