If you’re converting print publications to ePubs, you’ve probably come across this problem:

The print publication typesetter (or compositor, as they are also called) has used InDesign’s all-caps text property for some paragraph styles.

For instance, the chapter headings may have been set in all caps, as so:

CHAPTER 1: SLAVERY AND FREEDOM

However, when you export the book to ePub, the capital letters are missing (in some ePub readers at least). In some cases this may be okay, that is, if what you see in the ePub reader is:

Chapter 1: Slavery and Freedom

that may be okay.

However, in a book I’m working on converting to ePub now, what I’m getting is:

chapter 1: slavery and Freedom

i.e., a mix of uppercase and lowercase capitalization that makes no sense.

This strange mix of uppercase and lowercase is a reflection of how the chapter heading was typed in the first place. When the typesetter applied the all-caps property in InDesign, this erratic capitalization was hidden, and everything became capital letters. (Although this probably should not have been done this way, it happens a lot.)

When InDesign exports such a chapter heading to ePub, it does actually add the correct CSS tag to theoretically maintain the all-caps that the design used. Namely:

text-transform: uppercase

However, some ePub readers (including Adobe’s own Digital Editions) do not respect this tag.

So what you get is that weird mix of uppercase and lowercase showing in the ePub, and that is no good.

To solve the problem, there are two alternatives:

(1) Edit the entire book so that the lower case capitalization at least makes sense.

(2) Convert the chapter title to real uppercase letters, so that they display as intended in all ePub readers.

The disadvantage of (1) is that it can take a lot of time to go through a long book editing all the chapter titles (and any other headings that may use all-caps formatting). Also, you will probably need to consult the editor several times, because it is not always clear how to correctly capitalize headings (is it: Auto-Immune or Auto-immune, etc.)

Also, (1) means that the ePub will not look like the print edition, which may or may not be a problem.

The disadvantage of (2) is that InDesign offers no built-in way of converting text formatted with the all-caps property into real capital letters.

However, luckily that disadvantage is easily remedied with a little script.

The script below will convert all text formatted with a given paragraph style into true uppercase letters.

To use, place your text cursor in InDesign in some text with the paragraph style you’re interested in converting. Then run the script. All text with that selected paragraph style applied will be converted into proper uppercase letters.

As usual with these quick InDesign scripts that I write for myself in the course of work, there is zero error checking. This is meant to be a quick fix for a common problem.

Here’s the script:

// BS"D
// Convert parastyle to true uppercase
// By TAW (c) Id-Extras.com, 2014
myStyle = app.selection[0].appliedParagraphStyle;
app.findTextPreferences = null;
app.findTextPreferences.appliedParagraphStyle = myStyle;
myFinds = app.activeDocument.findText();
for (i = 0 ; i < myFinds.length; i++){
	myFinds[i].changecase(ChangecaseMode.UPPERCASE);
}

Edit (27 July 14): Changed the line in the loop to use InDesign’s changecase method instead of the built-in JavaScript one, because InDesign’s is more robust I believe when it comes to languages other than English.