Editing EPUB using Sigil and Calibre in Linux Part 2
Getting started with Sigil is pretty much the same as using any WYSIWYG application. Thankfully, it focuses mostly on creating/editing the EPUB file rather than overwhelming you with XML add-ons - it's more of LyX than Adobe Dreamweaver in this regard. More importantly, however, Sigil also allows writers to edit the XML markup, CSS, and XHTML code without leaving the application.
As an example, this article will focus on creating an EPUB file from a Wordpress blog. Wordpress blogs are exported in XML and a few steps are required to transform the text to convenient, readable format. For the sake of brevity, we will be using raw, unedited text rather than formatted text and we'll be adding images later.
The advantage of using unformatted text in Sigil is consistency and a cleaner code - you can apply a new CSS without worrying too much about previously applied formatting. The disadvantage is that you may have to do quite a bit of proofreading and formatting especially if your text features plenty of headings, bold, and underlined words and statements. If your original book or article is already in HTML or XHTML then you're halfway done since Sigil accepts them natively.
The raw text can be simply copied and pasted on to the first .xhtml file. In this scenario, we'll be working on one long block of unformatted text.
Organizing your text
We will now split the text into different sections. This has nothing to do with the Table of Contents (unless you want it to), but more about organizing your text. Sigil, by default, can generate an EPUB TOC based on the text you format using the Heading styles. Forget about the number of .xhtml files splitting the text will create! Only one EPUB file will be created at the end of the process.
To split the text:1. Place the insertion point in the text.2. Click Edit then Split Chapter.
Since you'll be doing this quite a bit. The shortcut CTRL+Return becomes very handy. In fact, most users will probably create sections as they proofread and edit their text.
Proofread, Edit, and Format text
Proofreading and formatting text isn't the most exciting of tasks, but if you want the text to look right on an iPad or Android tablet, this is even more important than the code itself. Sigil opens each XHTML file on a separate tab so moving the text across chapters and rearranging text is easy. If you're dealing with text riddled with leftover code, Find/Replace will be one of the more useful tools for deleting characters and excess markup.
As for formatting text, there are three ways to go about it:
1. Use Sigil's basic formatting features. If you're creating a novel, then very, very minimal formatting is needed. Sigil has all the tools you need: Heading styles, bold, formatting, Lists, Bullets, and Indents. The less formatting, the better it looks on an ereader. Moreover, as a writer, you want readers to focus on your writing and not on the formatting, right? Again, keep in mind that the Heading Styles will determine your TOC entries.2. Edit the XHTML. If you're writing a more technical book or require a lot of visual cues or structure, then by all means edit the XHTML manually. Click View then Code View or Split View to take a look at the markup. XHTML gurus can go berserk with their tables and lines because EPUB's underlying structure is based on XML and XHTML. Take note, however, that not all XHTML tags are recommended for presenting an ebook. Again, this is a book not a web page so fancy dynamic HTML is not only wasted but unnecessary. Moreover, Sigil is not a fully-featured code editor, so you may get error messages which may cause you to lose text. Avoid using the code editor unless you really know what you're doing.3. Use CSS. You're not creating a web page, but if you want your own style of presenting your text/book/manual, then it's time to write some very frugal CSS.
You don't need to use all three ways to format text. In fact, keeping the code simple is the best way to go about it. When formatting text for an EPUB, sample free EPUBs available on the Internet to find out what best suits your document/book. Gutenberg.org has some EPUBs with very poor layout and formatting. Free EPUBs from iTunes, like "Weird Tales from Northern Seas", are optimized for an iPod Touch or iPad. Some publicly released EPUBs, like "The Best of Smashing Magazine", are professionally designed and looks fantastic on both iOS and Android devices.
Part 3: Importing HTML and using CSS with Sigil