html5tidy as proper tool
This commit is contained in:
parent
55fbdea410
commit
ad6e190048
@ -6,15 +6,17 @@ usage = """Usage:
|
|||||||
etherdump CMD
|
etherdump CMD
|
||||||
|
|
||||||
where CMD could be:
|
where CMD could be:
|
||||||
sync
|
pull
|
||||||
|
index
|
||||||
|
dumpcsv
|
||||||
gettext
|
gettext
|
||||||
gethtml
|
gethtml
|
||||||
creatediffhtml
|
creatediffhtml
|
||||||
dumpcsv
|
|
||||||
list
|
list
|
||||||
listauthors
|
listauthors
|
||||||
revisionscount
|
revisionscount
|
||||||
showmeta
|
showmeta
|
||||||
|
html5tidy
|
||||||
|
|
||||||
For more information on each command try:
|
For more information on each command try:
|
||||||
etherdump CMD --help
|
etherdump CMD --help
|
||||||
|
@ -83,8 +83,7 @@ def html5tidy (doc, charset="utf-8", title=None, scripts=None, links=None, inden
|
|||||||
etree_indent(doc)
|
etree_indent(doc)
|
||||||
return doc
|
return doc
|
||||||
|
|
||||||
|
def main (args):
|
||||||
if __name__ == "__main__":
|
|
||||||
p = ArgumentParser("")
|
p = ArgumentParser("")
|
||||||
p.add_argument("input", nargs="?", default=None)
|
p.add_argument("input", nargs="?", default=None)
|
||||||
p.add_argument("--indent", default=False, action="store_true")
|
p.add_argument("--indent", default=False, action="store_true")
|
||||||
@ -103,7 +102,7 @@ if __name__ == "__main__":
|
|||||||
p.add_argument("--rss", action="append", default=[], nargs="+", help="ensure/add alternate link of type application/rss+xml")
|
p.add_argument("--rss", action="append", default=[], nargs="+", help="ensure/add alternate link of type application/rss+xml")
|
||||||
p.add_argument("--atom", action="append", default=[], nargs="+", help="ensure/add alternate link of type application/atom+xml")
|
p.add_argument("--atom", action="append", default=[], nargs="+", help="ensure/add alternate link of type application/atom+xml")
|
||||||
|
|
||||||
args = p.parse_args()
|
args = p.parse_args(args)
|
||||||
links = []
|
links = []
|
||||||
def add_links (links, items, rel, _type=None):
|
def add_links (links, items, rel, _type=None):
|
||||||
for href in items:
|
for href in items:
|
||||||
@ -164,3 +163,7 @@ if __name__ == "__main__":
|
|||||||
if tmppath:
|
if tmppath:
|
||||||
os.rename(args.input, args.input+"~")
|
os.rename(args.input, args.input+"~")
|
||||||
os.rename(tmppath, args.input)
|
os.rename(tmppath, args.input)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main(sys.argv)
|
||||||
|
Loading…
Reference in New Issue
Block a user