Quote:
Originally Posted by sbin
A minor glitch: it looks like the plugin added unwanted spaces around some inline tags (like <em>, <strong> and <span>, but not around <a>).
|
I haven't been able to reproduce this issue with the Windows version of Sigil 0.9.1 even when I selected an external interpreter. It looks like the plugin doesn't find the Sigil version of BS4, because the behavior matches that of Sigil 0.8.6.
Did you tick the Use Bundled Python check box? If so, can you please open the AddIDs plugin.py file and add the lines marked in Magenta with TextWrangler or a similar programmer's editor.
Code:
try:
from sigil_bs4 import BeautifulSoup
print('Sigil BS4 imported.')
except:
from bs4 import BeautifulSoup
print('regular BS4 imported.')
(Make sure to match the indentation of the preceding line or Python will display an annoying error message.)
Then re-run your test. You should get a message telling you which BS4 library was imported.
(You can find the plugin.py location via Edit > Preferences > Open Preferences Location > plugins > AddIDs.)
Quote:
Originally Posted by KevinH
If it instead used Sigil's own version of BeautifulSoup, sigil_bs4, it could use serialize_xhtml() or prettyprint_xhtml() which would prevent the introduction of newlines after inline tags.
|
Theoretically it should use the Sigil BS4 package whenever possible. The relevant code is the above-mentioned import declaration and the following, somewhat ugly code:
Spoiler:
Code:
# update html if the code was changed
if str(soup) != orig_soup:
if sys.version_info[0] == 2:
try:
bk.writefile(html_id, str(soup.prettyprint_xhtml(indent_level=0, eventual_encoding="utf-8", formatter="minimal", indent_chars=" ").encode('utf-8')))
except:
bk.writefile(html_id, str(soup.prettify().encode('utf-8')))
else:
try:
bk.writefile(html_id, str(soup.prettyprint_xhtml(indent_level=0, eventual_encoding="utf-8", formatter="minimal", indent_chars=" ")))
except:
bk.writefile(html_id, str(soup.prettify()))
print(bk.id_to_href(html_id) + ' updated')
Could you please test on your Mac which library is actually imported and whether selecting an external interpreter, e.g. Python 2.7, will cause the issues that the OP reported?
Thanks!