Commits

Geoffrey Sneddon committed a9fb72b

Change jgraham's "lxml" value to "lxml.html" (and change the commented out XML support to "lxml.etree", reflected the module names of both). Also change --encoding to --output-encoding to represent better what it does.

  • Participants
  • Parent commits 5145fbc

Comments (0)

Files changed (2)

                       type="string",
                       help="Disable the process given as the option value")
 
-    #parser.add_option("", "", action="store_true",
-    #                  dest="xml", help="Use an XML parser/serializer.")
-
     parser.add_option("", "--parser", type="choice",
-                      choices=("html5lib", "lxml"))
+                      choices=("html5lib", "lxml.html"))
 
     parser.add_option("", "--serializer", type="choice",
-                      choices=("html5lib", "lxml"))
-
+                      choices=("html5lib", "lxml.html"))
 
     parser.add_option("", "--newline-char", action="store", type="string",
                       dest="newline_char",
     parser.add_option("", "--escape-rcdata", action="store_true",
                       dest="escape_rcdata", help=SUPPRESS_HELP)
 
-    parser.add_option("", "--encoding", action="store", type=str,
-                      dest="encoding", help="Output encoding")
+    parser.add_option("", "--output-encoding", action="store", type=str,
+                      dest="output_encoding", help="Output encoding")
 
     parser.set_defaults(
         processes=set(["sub", "xref", "toc"]),
-        xml=False,
         parser="html5lib",
         serializer="html5lib",
         newline_char=u"\n",

File anolislib/generator.py

 def fromFile(input, processes=set(["sub", "toc", "xref"]), parser="html5lib",
              profile=False, **kwargs):
     # Parse as XML:
-    #if xml:
+    #if parser == "lxml.etree":
     if False:
         tree = etree.parse(input)
     # Parse as HTML using lxml.html
-    elif parser == "lxml":
+    elif parser == "lxml.html":
         tree = lxml.html.parse(input)
     # Parse as HTML using html5lib
     else:
     return tree
 
 
-def toString(tree, encoding="utf-8", serializer="html5lib", **kwargs):
+def toString(tree, output_encoding="utf-8", serializer="html5lib", **kwargs):
     # Serialize to XML
-    #if xml:
+    #if serializer == "lxml.etree":
     if False:
         rendered = etree.tostring(tree, encoding=encoding)
     # Serialize to HTML using lxml.html
-    elif serializer == "lxml":
+    elif serializer == "lxml.html":
         rendered = lxml.html.tostring(tree, encoding=encoding)
     # Serialize to HTML using html5lib
     else: