MIA: Volunteer: Create eBooks
Creating an eBook from MIA web files using Calibre
NB Please ensure the web book is complete and proofed before you create the ebook – any changes needed in one must be replicated by hand in the other.
Calibre is an open source ebook manager which includes a very effective editor. It is available for Windows, Mac and Linux. There is general guidance for using Calibre here. We here create an ebook in epub format, which is the open standard, and then convert it to mobi (for Kindle) and pdf.
1 Create Empty Book
Click on: Toolbar → Add Books → Add Empty Book
Set Author and Title, leave Format as EPUB
2 Set Metadata
2.1 Edit metadata
Click on: Toolbar → Edit Metadata
- Set tags – eg Non-fiction, Politics – and IDs, Comments, publication date etc. as appropriate.
- It's good to add a cover, but beware of copyright. You can create a cover yourself as a jpeg or png file using any graphics editor, eg Gimp or Paint. Wikipedia and Wikimedia Commons are good sources for copyright-free photos.
- Save your changes.
2.2 Polish book
Click on: Toolbar → Polish Books
In the Polish Book dialog check 'Update Metadata in the book files' and 'Update the cover in the book files', then click OK.
NOTE: Once it is polished Calibre will normally have created an 'Original_epub' format version. It is essential that you delete this otherwise you risk losing all your work on the book if you 'polish' again at any time in the future. Delete it by right-clicking on ORIGINAL_EPUB on Formats at the right bar and select 'Delete ORIGINAL_EPUB format' – or use the Remove Books menu list option. You can stop Calibre creating the ORIGINAL_EPUB file by clicking on Preferences → Change Calibre Behaviour → Tweaks, search for polish and change the setting to: save_original_format_when_polishing = False
3 Add Content to Book
Click on: Toolbar → Edit Book
3.1 Create stylesheet
- Import the original .css stylesheet with File → Import files into book. To find it on the MIA website, its address will be in the header of each file. Unfortunately some MIA books use different css files on different chapters: you could replicate this, but it is bad practice, so you should really pick the most commonly used one and if there is a missing class then put it into the one css file.
- Import a stylesheet which you like or create a new stylesheet with File → New file – call it eg styles.css and click OK. Either way you'll need to make sure all the class= entries throughout the html files are correct, and possibly change many of them, so it could be a lot more work.
3.2 Create a sample html file
- Create a sample html file so you can use the header in the imported files. Use File → New file. Call it test.html and click OK.
- Make any changes to the header so it complies with MIA's eBook Production Guidelines.
3.3 Add html files
- Use File → Import files into book to import the files singly or in a batch.
- Re-order the files into the right order, by dragging them up or down the list.
- Smarten the code up with Tools → Beautify all files. You can also beautify files individually.
- In each html file replace the header from the start up to and including the <body...> tag with the header from test.html.
- In each html file you will probably need to remove quite a bit of material at the top of the page – typically html 'breadcrumbs' and the author and book name. You may be able to combine this with stage 4 – ie replace not just the html header but also the visible page headings.
Also remove any extraneous material at the bottom of the page, eg a 'top of page' link or 'last updated' info.
3.4 Web addresses
Web addresses need checking and correcting.
1 Relative addresses outside this book
Relative addresses to other MIA content need to have the full address given, ie starting with www.marxists.org.
Footnotes in html in an online page may have links with the web address. If so then the web address element needs to be deleted from the footnote links, both in the text and the footnote, just leaving the '#' reference (plus the local html file if the footnote reference is to/from a different file in the ebook).
<a href="../../history/somebook/chap3.htm#f52" name="n52">52.</a>
<a href="../chap3.htm#f52" name="n52">52.</a>
might be replaced with
<a href="#f52" name="n52">52.</a>
3 Other internal links
Most other internal links can be removed, eg to the next chapter, top of page etc. Those which need to be kept will need amending as per Footnotes above, ie to point to a file within the book. Calibre will help you by suggesting possible files/references when you start typing the href.
4 Edit Book
4.1 Correct the layout
Go through the book a file at a time correcting layout issues – typically removing excess headings etc which are needed in the web pages (because people can jump straight there from anywhere on the web), rather than each page being part of a book, as here.
4.2 Fix any code errors
Click Run check at the right of the Check Book section at the top of the editor.
Click on each of the errors shown at the left to correct them.
4.3 Create a Table of Contents, and Contents page
- Click on: Tools → Table of Contents → Edit Table of Contents
- Auto-generate a table of contents with one of the options at the right. Generate ToC from major headings is the one to try first. If that doesn't work well try one of the others. You can then edit it as you wish.
- Auto-generate a Contents page with Tools → Table of Contents → Insert inline Table of Contents. This creates a toc.xhtml file as the first file. Drag it to the correct place for the Contents page, and edit it as you wish. You will need to replace the header with the standard header (which you used for all the other files in 3.3.4 above).
5 Proof-read the Book
Proof read the book, ideally on a PC/Mac and also an eBook reader/tablet/phone, so you can see how it looks in large and mobile format. You may well need to make quite a few formatting changes as the requirements for a well laid out eBook are not necessarily the same as for a web book.
NB If you need to make any text corrections then these should be replicated in the MIA web pages – contact the MIA Admin Committee.
6 Create Other Formats and Upload to MIA
Once you are happy with the book, create mobi (for Kindle) and pdf versions of it with the toolbar Convert books button.
They should then be uploaded to MIA – contact the MIA Admin Committee.
If you have the necessary permissions yourself then you need to:
- Upload the books to the ebook library at mia/ebooks/..., creating an author folder there if there isn't one already.
- Reference the book in index.htm in the eBook page, adding an author entry if necessary.
- Put a reference to the ebook in the front page (index.htm) of the web book.
Contact the Marxists Internet Archive Admin Committee for further information