5

I work in a university program with around 30 units, each of which produces a learning guide of 80 to 120 pages. Currently we supply them as pdf files, but I want to move to an epub (HTML/CSS) based solution so that I can set the styles once and have more semantically structured, reflowing text.

Each guide has a lot of commonality, such as the styling, title page header, introduction pages, etc. I am looking for a workflow and tools that allow me to reuse this content in every guide without too much manual effort.

2
  • How do the units make the PDFs now? If they are currently directly generated from e.g. Word, then directly editing HTML will be a horror for editors. Or is the input already HTML or some other more structured text markup format?
    – Anthon
    Commented Feb 26, 2015 at 7:32
  • Currently we make the PDFs using Microsoft Word. I am considering converting them using Pandoc. In the future, I am thinking of using something like Markdown to produce the documents, and then turning them into different formats from there.
    – user12700
    Commented Feb 28, 2015 at 23:35

2 Answers 2

2

Assuming you're familiar with HTML and CSS, and given that your content has a lot of commonality to it, it would be fairly straightforward to set up a template file with all the parts you need for an ebook. You could, for example, have a template made of files like this:

cover.xhtml
title.xhtml
toc.xhtml
prologue.xhtml
intro.xhtml
chapter.xhtml
appendix.xhtml
index.xhtml
about_the_author.xhtml
style.css
content.opf
(toc.ncx)
images/cover.jpg

The toc.ncx is optional but suggested (as noted elsewhere on this site) to ensure usability on older reading systems. The content.opf and both toc files have specific requirements for the content, as they're epub-required navigational files. The other XHTML files must be valid, but otherwise are more flexible in terms of content. The content of those template files could look like:

<?xml version="1.0" encoding="utf-8"?>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops">
<head>
<title></title>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
 <body>

 </body>
</html>

The navigational files would have to have the information about the other files added to them each time, but that is fairly automateable with a minimum amount of scripting in a language like Ruby or Python.

In your CSS file, you could have default styles already built for the things you use all the time. You could even have default boilerplate styles at the top of the CSS file for all the basic element type (<p>, <li>, and so on) and then just add other CSS rules at the bottom of the file as needed—since the styles cascade, the ones at the bottom would overwrite the ones at the top if there were any conflicts.

All that's left from there is getting your document from whatever format the editors are using into HTML so that you can apply all the tags and then pass it along to the designers (unless you're doing ebook-last, in which case the issue is getting the file from whatever the designers use to HTML).

Hope that helps!

1
  • Thanks for taking the time to write such a detailed and helpful response.
    – user12700
    Commented Feb 28, 2015 at 23:33
1

If, you as you comment, consider going to a more structured input format than MicroSoft Word, then I recommend not wasting time in looking at HTML changes directly at all.

You should consider reStructuredText part of docutils. I have been using reStructuredText for years and it always had the advantage over other formats that I looked at (including Markdown) that one could generate HTML and PDF, without the need of setting up the whole LaTeX based toolchain for that (as is necessary with e.g. pandoc).

I am now using reStructuredText, within in the Sphinx documentation system, which can also generate EPUB files for you.

Depending on your experience and preferences you might also find it easier to tweak the tools mentioned (in Python) than e.g. pandoc (in Haskell).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.