|
|
@ -49,6 +49,9 @@ def main (args): |
|
|
|
p.add_argument("--output", default=False, action="store_true", help="output changed padids on stdout") |
|
|
|
p.add_argument("--force", default=False, action="store_true", help="reload, even if revisions count matches previous") |
|
|
|
|
|
|
|
p.add_argument("--css", default="/styles.css", help="add css url to output pages, default: /styles.css") |
|
|
|
p.add_argument("--script", default="/versions.js", help="add script url to output pages, default: /versions.js") |
|
|
|
|
|
|
|
p.add_argument("--nopublish", default="__NOPUBLISH__", help="no publish magic word, default: __NOPUBLISH__") |
|
|
|
|
|
|
|
args = p.parse_args(args) |
|
|
@ -165,7 +168,8 @@ def main (args): |
|
|
|
# and link it in the metadata! |
|
|
|
|
|
|
|
links = [] |
|
|
|
links.append({"href":"/styles.css", "rel":"stylesheet"}) |
|
|
|
if args.css: |
|
|
|
links.append({"href":args.css, "rel":"stylesheet"}) |
|
|
|
# todo, make this process reflect which files actually were made |
|
|
|
versionbaseurl = quote(padid.encode("utf-8")) |
|
|
|
links.append({"href":versions[0]["url"], "rel":"alternate", "type":"text/html", "title":"Etherpad"}) |
|
|
@ -186,7 +190,7 @@ def main (args): |
|
|
|
ver["path"] = p+".diff.html" |
|
|
|
ver["url"] = quote(ver["path"]) |
|
|
|
doc = html5lib.parse(html.encode("utf-8"), encoding="utf-8", namespaceHTMLElements=False) |
|
|
|
html5tidy(doc, indent=True, title=padid, scripts="/versions.js", links=links) |
|
|
|
html5tidy(doc, indent=True, title=padid, scripts=args.script, links=links) |
|
|
|
with open(ver["path"], "w") as f: |
|
|
|
# f.write(html.encode("utf-8")) |
|
|
|
print(ET.tostring(doc, method="html", encoding="utf-8"), file=f) |
|
|
@ -202,7 +206,7 @@ def main (args): |
|
|
|
ver["path"] = p+".raw.html" |
|
|
|
ver["url"] = quote(ver["path"]) |
|
|
|
doc = html5lib.parse(html, namespaceHTMLElements=False) |
|
|
|
html5tidy(doc, indent=True, title=padid, scripts="/versions.js", links=links) |
|
|
|
html5tidy(doc, indent=True, title=padid, scripts=args.script, links=links) |
|
|
|
with open(ver["path"], "w") as f: |
|
|
|
# f.write(html.encode("utf-8")) |
|
|
|
print (ET.tostring(doc, method="html", encoding="utf-8"), file=f) |
|
|
|