Comments (2)
Thanks for the thoughtful response. I agree it's better not to break existing functionality, and great that there is way to override the defaults. I'll give that a try.
from pypub.
Apologies for the delay in response.
Thank you for your patience.
At the moment the library is very selective with what attributes and tags it allows since that was the logic carried over from the original before the fork and rewrite. I assumed this was because the epub standard was much more particular about what is allowed in xhtml than normal html. I've tried to do some research on the topic to discover what is allowed and what is not but I've yet to find anything specifically about this yet.
For the sake of backwards compatibility/cleanliness/control I hesitate to add support for any and all tags or try to reverse the behavior into a blacklist rather than the current whitelisted system, so for the time being I'm simply going to recommend either monkeypatching the library itself or finding alternatives by replacing the inline styles with standard css.
Inline styles are a bit tricky for me to determine how to handle because I can see wanting to keep those styles when importing html into an epub, but at the same time, being able to automatically remove inline styles and instead replace them with your own css seems valuable and like a good approach as well.
You can monkeypatch the library by doing something like the following:
from pypub.factory import SUPPORTED_TAGS
SUPPORTED_TAGS['p'] = (*SUPPORTED_TAGS['p'], 'style')
I'm happy to hear arguments or alternative opinions about what I've said here if you happen to know more about the epub standard or have suggestions about an alternative approach for implementation. PRs are always welcome as well :)
Hope that helps!
from pypub.
Related Issues (7)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pypub.