skoji / gepub

a generic EPUB library for Ruby : supports EPUB 3
Other
240 stars 42 forks source link

Smart autofix features #49

Open 127 opened 10 years ago

127 commented 10 years ago

What about some «clever features»: 1) auto add xml declaration if does not exist <?xml version="1.0" encoding="utf-8"?> 2) auto fix if <html> to valid <html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xml:lang="ru-RU" lang="en-EN"> 3) set valid xml notation via applying nokogiri preparsing to enpacked xhtml (will quickfix forgotten /> etc)

skoji commented 10 years ago

Thanks. These features look good for me.

But gepub still have some important but missing features (e.g. API to traverse EPUB) to be implemented, so I can not work on this feature request yet. Maybe after release of version 1.0.

Pull request for these features are welcome.

127 commented 10 years ago

Ok, I'll try to implement. How do you see it (as far as I don't want to intrude your architecture :-) )? As a parametric feature on setting up constructor or just a couple of methods respectively?

skoji commented 10 years ago

How about API like this?

book = GEPUB::Book.new {
  |book|
  # add resources
}

book.normalize_content_xhtml
book.generate_epub('path_to_epub.epub')
127 commented 10 years ago

Ok, will try )