Ae-Mc/FB2

Adding already formatted text to chapters

Closed this issue · 6 comments

Hi @Ae-Mc !

First of all I need to say: Thank you for such a usefull package! It, literally, saved me a week of life =)

Thing, I suppose, might be usefull as a feature:

I have some texts, that already formatted with html and I want to convert them to fb2
But there's no method that can just take such text as Element Tree, and for example, set it to Body.

What are you thinking about it ?

Ae-Mc commented

It's interesting idea. I will try to add it soon.
Do you have text divided into paragraphs?

Ae-Mc commented

I add support for list of ET.Element to chapters.

Could you, please, provide an example of how to use this?

Ae-Mc commented

Sorry, I don't remember)
Looks like you can just use xml.etree.ElementTree as paragraph instead of str

Hello, yes, thanks, figured it out already, this works

import xml.etree.ElementTree as ET
paragraph = ET.fromstring(str(html))

The rest is the same.