From a366cfb4d7a69fa48e431f2bf29c287f60592b2a Mon Sep 17 00:00:00 2001 From: ccl Date: Sun, 6 Dec 2020 11:07:54 +0100 Subject: [PATCH] added the class to magic words --- etherpump/commands/pull.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/etherpump/commands/pull.py b/etherpump/commands/pull.py index bf8290f..d1e571f 100644 --- a/etherpump/commands/pull.py +++ b/etherpump/commands/pull.py @@ -467,10 +467,10 @@ async def handle_pad(args, padid, data, info, session): # Process text, html, dhtml, all options if args.all or args.html: - # mb: line causing the error of not writing the correct HTML content to the correct HTML file: + # mb: line causing the error of not writing the correct HTML content to the correct HTML file: # url = info["localapiurl"] + "getHTML?" + urlencode(data) # mb: warning, HACK! Catching the error by writing the API request url manually ... - url = info["localapiurl"] + "getHTML?" + "padID=" + padid + "&" + 'apikey=' + data["apikey"] + url = info["localapiurl"] + "getHTML?" + "padID=" + padid + "&" + 'apikey=' + data["apikey"] # print(url) html = await agetjson(session, url) ver = {"type": "html"} @@ -511,6 +511,10 @@ async def handle_pad(args, padid, data, info, session): html = html["data"]["html"] ver["path"] = p + ".magicwords.html" ver["url"] = quote(ver["path"]) + for magic_word in magic_words: + replace_word = ""+magic_word+"" + if magic_word in html: + html = html.replace(magic_word,replace_word) doc = html5lib.parse( html, treebuilder="etree", namespaceHTMLElements=False )