added the class <highlight> to magic words
This commit is contained in:
parent
9853a34162
commit
a366cfb4d7
@ -467,10 +467,10 @@ async def handle_pad(args, padid, data, info, session):
|
|||||||
|
|
||||||
# Process text, html, dhtml, all options
|
# Process text, html, dhtml, all options
|
||||||
if args.all or args.html:
|
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)
|
# url = info["localapiurl"] + "getHTML?" + urlencode(data)
|
||||||
# mb: warning, HACK! Catching the error by writing the API request url manually ...
|
# 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)
|
# print(url)
|
||||||
html = await agetjson(session, url)
|
html = await agetjson(session, url)
|
||||||
ver = {"type": "html"}
|
ver = {"type": "html"}
|
||||||
@ -511,6 +511,10 @@ async def handle_pad(args, padid, data, info, session):
|
|||||||
html = html["data"]["html"]
|
html = html["data"]["html"]
|
||||||
ver["path"] = p + ".magicwords.html"
|
ver["path"] = p + ".magicwords.html"
|
||||||
ver["url"] = quote(ver["path"])
|
ver["url"] = quote(ver["path"])
|
||||||
|
for magic_word in magic_words:
|
||||||
|
replace_word = "<span class='highlight'>"+magic_word+"</span>"
|
||||||
|
if magic_word in html:
|
||||||
|
html = html.replace(magic_word,replace_word)
|
||||||
doc = html5lib.parse(
|
doc = html5lib.parse(
|
||||||
html, treebuilder="etree", namespaceHTMLElements=False
|
html, treebuilder="etree", namespaceHTMLElements=False
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user