View Single Post
Old 09-16-2015, 04:55 PM   #93
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 8,893
Karma: 6120478
Join Date: Nov 2009
Device: many
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 View Post
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?

Last edited by KevinH; 09-16-2015 at 04:57 PM.
KevinH is offline   Reply With Quote