Hi!, i'm having troubles to add a custom tag with my plugin using Beautifulsoup:
The code:
Code:
html = '<p id="nt3"><sup>[3]</sup> Note 1. <a href="../Text/Section0001.xhtml#nt3"><<</a></p>'
## BeautifulSoup parser
soup = BeautifulSoup(html, "html.parser")
orig_soup = str(soup)
original_tag = soup.p
dict_atributes = {"xml:lang" : "la"}
new_tag = soup.new_tag("i", attrs=dict_atributes)
new_tag.string = "Ibid"
original_tag.insert(1, " ")
original_tag.insert(2, new_tag)
original_tag.insert(3, ".")
print("OUT:\n" + str(original_tag))
Outside Sigil everything OK:
Code:
$ python test.py
OUT:
<p id="nt3"><sup>[3]</sup> <i xml:lang="la">Ibid</i>. Note 1. <a href="../Text/Section0001.xhtml#nt3"><<</a></p>
But from Sigil i get:
Code:
OUT:
<p id="nt3"><sup>[3]</sup> <i attrs="{'xml:lang': 'la'}">Ibid</i>. Note 1. <a href="../Text/Section0001.xhtml#nt3"><<</a></p>
Any ideas? I can't find info about Beautifulsoup Sigil's implementation.
Thanks!
PS: Using python 3.8 and Sigil 1.4.3