Hi Doitsu,
We have our own version of BeautifulSoup4 we call sigil_bs4. It will always be available to both Python 2.7 plugins and Python 3.4 plugins once Sigil 0.8.900 is out.
To use it in place of any local or system specific version of official BS4, you do exactly what you noted:
change "import bs4" to "import sigil_bs4" or use the changes you stated below.
And go from there. This will give you the Sigil version of bs4 which runs on both python 2.7 and 3.4 with the same codebase and which has prettyprint_xhtml() and serialize_xhtml() methods as well as bug fixes for using lxml with bs4.
It will work just like bs4 does for other projects, it is just that our gumbo interface requires it.
Hope that explains things.
KevinH
Quote:
Originally Posted by Doitsu
I had a quick look at the examples and noticed that you used sigil_bs4 in conjunction with the gumbo parser. Does this mean that sigil_bs4 will only work with the gumbo parser or could I import sigil_bs4 like the vanilla version?
For example, would I only have to change:
Code:
from bs4 import BeautifulSoup
to:
Code:
from sigil_bs4 import BeautifulSoup
to make existing plugins compatible with the next Sigil version?
|