unescape html
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
import html
|
||||||
import logging
|
import logging
|
||||||
import re
|
import re
|
||||||
import time
|
import time
|
||||||
@@ -258,6 +259,27 @@ def export_invoice_pdf(
|
|||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
||||||
fill_invoice_fields(invoice_page)
|
fill_invoice_fields(invoice_page)
|
||||||
|
invoice_page.evaluate("""() => {
|
||||||
|
const decode = (value) => {
|
||||||
|
let prev = value;
|
||||||
|
for (let i = 0; i < 5; i += 1) {
|
||||||
|
const textarea = document.createElement('textarea');
|
||||||
|
textarea.innerHTML = prev;
|
||||||
|
const next = textarea.value;
|
||||||
|
if (next === prev) return next;
|
||||||
|
prev = next;
|
||||||
|
}
|
||||||
|
return prev;
|
||||||
|
};
|
||||||
|
const container = document.querySelector('.b2-invoice-customer-right');
|
||||||
|
if (!container) return;
|
||||||
|
const walker = document.createTreeWalker(container, NodeFilter.SHOW_TEXT);
|
||||||
|
const nodes = [];
|
||||||
|
while (walker.nextNode()) nodes.push(walker.currentNode);
|
||||||
|
nodes.forEach((node) => {
|
||||||
|
node.nodeValue = decode(node.nodeValue);
|
||||||
|
});
|
||||||
|
}""")
|
||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
|
|
||||||
date_text = ""
|
date_text = ""
|
||||||
|
|||||||
Reference in New Issue
Block a user