Showing posts with label GREP. Show all posts
Showing posts with label GREP. Show all posts

Tuesday, May 1, 2012

Using GREP to eliminate warnings—and reveal errors—in BBEdit

If you're making changes directly to your XHTML documents, it's a good idea to check their syntax before compiling and finishing your EPUB files. This helps weed out the most common and difficult-to-find errors: typos.

In BBEdit, choose Markup > Check > Document Syntax to see if your XHTML file is valid. BBEdit will quickly sift through and alert you to any problems.

If you export EPUB from InDesign, you may get a lot of warnings about spaces being recommended before trailing spaces.

spaceWarnings

They're quite right: if you have a all-in-one element like the img element or link element, you are allowed to write this:

<img src="image.jpg" alt="image description"/>

But it's recommended that you add a space before that trailing slash (after the last attribute and value):

space before a closing bracket

The problem, and it's minor but annoying, is that all those warnings hide the real problems. (The errors are there, but you have to scroll down to find them. And you don't get that satisfying "No errors were found" message.) One temporary solution is to uncheck the Warnings box as shown in the above screenshot.

The other, more permanent, solution is to add the missing space so you don't get any warnings. I use GREP for this:

Search for (\S)/> (that is, any instance of a closing slash and closing bracket without a preceding space. Another way to interpret that GREP would be that you're finding anything that's NOT a space followed by a closing slash and closing bracket.)

And replace it with \1 /> (whatever came before the closing slash and bracket, a space, and the closing slash and bracket)

Now when you check syntax, you'll only see the real errors (here, a classic one for me: mismatched p's and div's):

errorsonly



I know this is a tiny and minor thing, but I hope it will be helpful to a few, and maybe even get folks who are interested in but scared of GREP to start with something small.

Thursday, February 2, 2012

Using InDesign to adapt plain text for EPUB

coveradapt_optThere was a chapter that I ultimately decided to leave out of “EPUB Straight to the Point” that I've been wanting to publish for a long time. It explains how to use GREP in InDesign to massage a plain text file so that it's easier to format. It shows how to get rid of extra line breaks, extra spaces, and how to convert special plain text formatting (underscores and carats) into their modern day counterparts, bold and small caps.

You can download it here in EPUB format or in Mobi format, and soon, from the iBookstore. I hope you find it useful. The example files can be found on my website and are the same ones I used for “EPUB Straight to the Point”.

I have a whole collection of EPUB and Kindle related books now. Here's a quick rundown:

EPUB Straight to the PointEPUB Straight to the Point, which explains how to create ebooks in EPUB format using Word, InDesign or from scratch. It gives a thorough description of the ins and outs of the EPUB file format as well as many HTML and CSS tips for formatting your ebooks so that they look their best in whatever ereader your audience has. It also contains instructions for converting to Kindle format. $20, direct from my website. Includes EPUB and PDF editions.

From InDesign CS 5.5 to EPUB and KindleFrom InDesign CS 5.5 to EPUB and Kindle, explains the new EPUB related features in InDesign CS 5.5. I start by explaining just what EPUB related affects you can and cannot achieve with InDesign and then explain how to get the most out of InDesign when creating EPUB and Kindle files. $10, direct from my website, includes EPUB, Kindle/mobi, and PDF editions. Also available in Spanish.

Fixed Layout MiniguideFixed Layout Miniguide, explains Apple's "subformat" for creating fixed layout ebooks. Fixed layout ebooks are great for children's books, photography books, travel guides, cookbooks, and any other book in which you wish to maintain the same layout as the print edition. I would caution publishers not to use fixed layout as a way of avoiding redesigning for e-publication. I am not at all fond of fixed layout books with tiny, illegible text. $4, direct from my website, includes EPUB and PDF editions and example files.

Audio and Video in EPUBAudio and Video in EPUB shows how to incorporate both audio and video files in "enhanced" ebooks. The techniques described in this miniguide work for both iBooks and NOOK, though only Apple will let you upload audio and video-enhanced ebooks to its store. $5, direct from my website. Includes EPUB and PDF editions, and example files.

Read Aloud EPUB for iBooksRead Aloud EPUB explains how to add an overlay so that the ereader (either iBooks or Kobo Vox) can read the story out loud while simultaneously highlighting the corresponding words. Again, this is an advanced subformat (read: not part of EPUB standard) developed by Apple, but that already works in Kobo Vox. $5, direct from my website, includes EPUB and PDF versions, and example files.

Barcelona Beyond Gaudí coverBarcelona Beyond Gaudí is an example of a fixed layout photo book that contains Javascript interactivity and geolocation. It works only on iBooks (better on iPad than iPhone). $3, direct from my website, contains EPUB version for iBooks only.

Using Zapf Dingbats in EPUB in iBooksUsing Zapf Dingbats in EPUB is a free EPUB minibook that contains tables of symbols that can be inserted into EPUB on iBooks. Free.

There are also several money-saving bundles available.

More of my books