Skip to main content


Showing posts from February, 2011

What the hell is XML? And, how on earth do we use it in publishing?

This post is not a 'pure' programming guide, but instead the first post in a series designed as a practical way of getting XML working in publishing. If you are looking for the former, I'd recommend something like the w3schools guide as a good starting point. The focus here is to ask questions like (1) how can we integrate XML into a publishing workflow? and (2) why should we integrate XML into a production workflow? What the hell is XML? Put simply: <root> <tag>Some text.</tag> </root> Do we need to label elements root and tag? No, you can use whichever words you like, as long as they are paired with open and closing tags, e.g. <root> and </root> Now let's create an XML document that looks like something we'd face in publishing: <story> <h1>This is a top level heading</h1> <p>This is a paragraph with some <i>italic text</i> in it.</p> </story> If you type o

Beyond Consumption: The iPad as a Production, Development, Creative and Research Tool

I recently heard the well-worn words that Tablet devices are largely consumption devices; it was on BBC Click (watched 12 Feb 2011), and having lived with an iPad since the end of June 2010, I couldn't agree less. I will readily admit that I play games on the device, and that there are few Gameloft and EA titles that I don't own. I also listen to music and watch iPlayer on the iPad. These home-based activities along with an endless supply of recipes for the kitchen are very enjoyable and engage the whole family (from 1-36). As do the multitude of music applications from bongo drums to eight track music recording. However, these fun and home-life activities are only one side to the device. Working in publishing the iPad is essential for developing eBooks, since there is no simulator for iBooks on the desktop and since there is no replacement for learning how people will actually experience your books on the device, but this isn't the end of the device's usefulness for

Parse XML with Javascript in iBooks ePUB

Question: is it possible to parse XML with Javascript in ePUB for viewing in iBooks? Answer: yes A very basic example would consist of an xhtml file that contained for example two <div> tags. One with the id="title" and the other id="text". At the foot of which before the closing tag of the body text you would write: <script type="text/javascript"> xmlhttp=new XMLHttpRequest();"GET","document.xml",false); xmlhttp.send(); xmlDoc=xmlhttp.responseXML; t=xmlDoc.getElementsByTagName("title")[0].childNodes[0].nodeValue; x=xmlDoc.getElementsByTagName("text")[0].childNodes[0].nodeValue; document.getElementById("title").innerHTML=t; document.getElementById("text").innerHTML=x; </script> You would then in the content.opf file make sure that where the XML documents are listed that you insert in the spine listing linear="no". The corresponding

Taming Wildcards in Word (for eBook Text Tagging)

Previous posts concerning regular expressions have focused on Find and Replace in OpenOffice. But Word has its own flavour of regex/grep called wildcards. The advantages of which are that you can search styles applied to text (e.g. Heading 1, Heading 2, etc.) and also note markers. Roles for which OpenOffice is not perfect. Text indents are also possible to find, along with first line indents (both of which OpenOffice can handle too, but which I mention here for convenience). These make it possible to tag tricky things like blockquotes with accuracy. So where do you start? Open Find and Replace and tick the 'Use wildcards' check box. Then take a look at this list of codes . There are a couple of annoyances: (1) searching for italics across more than one word, like in a book title, it appears you can't instruct Word to find as many words as are italicized, so you need to italicize each word individually then search and delete each instance of </i> <i> afterwa

Formatting EPUB and Kindle Endnotes with Regular Expressions

Last week I described a method of adding note referents to text in OpenOffice and similar programs that allow the use of Regular Expressions in their Find and Replace. I also promised there to provide the code for formatting the notes section in the style of my earlier post on ' EPUB and Kindle Friendly Endnotes '. So here it is for the EPUB version: Find: ([:digit:]+)(\t)(.*) Replace: <li id="note$1">$3 <a href="#ref$1">[back]</a></li> And here is the KINDLE version: Find: ([:digit:]+)(\t)(.*) Replace: <p class="noind" height="30"><a id="note$1">$1</a> $3 <a href="#noteref$1">[back]</a></p> Note that the find remains exactly the same in both instances, and in order for this regular expression (regex) Find and Replace to work each note needs to be formatted with a number followed by a Tab followed by the text followed by a return, which is

Updating websites with your iPad: Gusto vs Textastic

This is a short blog post comparing the features of two iPad Apps designed for editing code and updating websites: Gusto and Textastic . The first thing to mention is that Textastic describes itself primarily as a text editor, while Gusto is promoted as a website management app. However, the functions available through both apps are fairly similar. You can link via FTP to your website and move files back and forth that can then be edited and previewed locally. To begin: the highly visual appearance of Gusto is appealing, and very intuitive, especially if you maintain multiple sites. It also allows remote viewing of websites within the app itself - important for server-side languages such as PHP, since there is no way to view these locally in either app. Textastic doesn't have remote viewing built in (and you'll have to flick to Safari in order to perform this task), but the app   is also capable of remote viewing and  is far more iOS 4.2   iOS 5 equipped. By which I mean