View Single Post
Old 03-29-2017, 08:42 AM   #35
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 28,675
Karma: 205039118
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Quote:
Originally Posted by roger64 View Post
Hi

Out of curiosity, I tried your nice plugin with a complex .docx file. It produces quite a clean output. I added a custom epub.css file without any problem.
I have some questions.
It DOES produce clean output. But I feel compelled to remind users that without a custom style map, Mammoth will drop all formatting that is applied via predefined Word/libreOffice styles. Only the styling directly applied using the Bold, Italics, (and possibly the Underline) buttons will be honored.

Quote:
Originally Posted by roger64 View Post
1. - About structure
I missed probably something, but I got only one .xhtml file for a 1.6MB ebook. Is there a recommended way to control spllitting into small .xhtml files?
Mammoth (and consequently this plugin) relies on formatting info being supplied by the docx document. There is no chapter- or file-break indicator in a docx document, hence the plugin doesn't split the input into individual files.

What you can do however is "mark" your split points in your source docx document with something like a horizontal line (or any empty named style paragraph, actually). That way, you can map (by creating a Mammoth style map) the horizontal line (or whatever you used) to Sigil's special split marker. My sample document and style map include this very technique ("p.HorizontalLine => hr.sigil_split_marker" ... meaning a Word paragraph of the style HorizontalLine will be converted to an hr tag with the class name "sigil_split_marker"). That way, the user can split the epub into "chapters" immediately after the plugin is done.

I suppose I could have the plugin perform the file-splitting at those markers as its final step. But quite frankly ... I have no desire to port Sigil's complex, pre-existing C++ chapter-splitting routines to Python when a quick menu-item or keyboard shortcut can split the file after the new epub as been created.

Quote:
Originally Posted by roger64 View Post
2. - About metadata
A lot were missing. Same question: is there a recommended place in the docx (or outside) to set metadata?
See BetterRed's response. Mammoth uses the docx's metadata.

Quote:
Originally Posted by roger64 View Post
3. - About images
All images were cleanly processed. But if I wish to set all (or most) of them in their own .xhtml page with margin 0, is there a way?

Sorry for many questions and thanks for a nice plugin.
Same answer as for point #1: add an indicator to the source document that can then be mapped to Sigil's special split marker (<hr class="sigil_split_marker" />) upon conversion, to get images on their own "page.". There's currently no way to generate a style attribute for images (or even a class name for that matter). I can certainly investigate the possibility of doing so, but there's no guarantees. I'm not willing to rewrite large chunks of Mammoth's underlying code to accomplish it.

Hope that answers your questions. I'm certainly no Mammoth expert, so I encourage users to read their documentation on creating style maps (there's a link in the first post). I just wrapped their work into a Sigil plugin.

Last edited by DiapDealer; 03-29-2017 at 08:44 AM.
DiapDealer is offline   Reply With Quote