Category Archives: Code Samples

Let’s Split Up but Stay Friends

Just a book should (must?) have multiple pages, an E-book should have multiple .html files.

Having one big .html file for the interior of our E-book has its advantages. After all, what’s the expression we use when we talk about keeping a project organized? “Let’s make sure we’re all on the same page.” But we’re (almost) done with the HTML and CSS portions of our book, and there are good reasons to split our .html file into smaller .html files:

splitting .html file into smaller files

  • Compatibility with older E-readers. Some of the early E-books couldn’t load a file larger than 128K or 256K. Splitting our book into segments helps us keep early-adopters in the game.
  • Easier navigation on some devices. Some devices, again, often older ones, allow the reader to “blip” ahead by section. If your anthology is all one big section, then the only “blips” allowed will be the very beginning and end of the book.
  • Guaranteed page breaks. Sometimes, you just need to be certain that a certain line will appear at the top of a new page. Start with a fresh .html file and know that it will have a fresh page all to itself.
  • Alternate cascading style sheets. YBR uses one CSS, but it might be that part of your book (a prose section, perhaps) will refer to a different .css file. Put that part on its own .html file and you’re good to go!
  • Reuse of “evergreen” sections. Okay, look, the back 10 pages of every Bicycle Comics poetry E-book thus far has been 8 pages of advertising for our other E-books. We don’t want to re-write or re-code that section; we just want to pop it in.

To be clear, we are making one E-book poetry anthology; an E-book can contain multiple .html and .css files. For the Tandem anthologies, we made each month its own chapter, so each month got its own .html file, as did the frontmatter and backmatter. But we combined those .html files into one EPUB file for each of our E-books. Here are the steps: Continue reading

Leave a comment

Filed under Code Samples, Organization and Data

How to Format…the Format?

If an HTML formatting blog asks for advice regarding the formatting of the blog, will the universe explode?

The whole point of Yellow Buick Review is to help editors format their poetry E-books. I’ve been posting code samples here as plain preformatted text using the <pre> tag. It’s simple, clear, takes me all of five seconds in WordPress. Normally, I call out line numbers beforehand, if I think they’ll matter. Here are lines 167-172 of the Yellow Buick Review:

 <h3><a id="whatBarn"></a>What the Barn Owl Saw</h3>
 <h4>Nancy Kilroy</h4>
 <p class="PoemDedication">for Sally Samples, 1980-2011</p>
 <p class="PoemStanza">in fermentum leo ut urna</p>
 <p class="PoemLine">hendrerit commodo.</p>
 <p class="PoemLine">vestibulum posuere,</p>

However, I just learned about the WordPress shortcode to offer much richer code snippets on the blog. Sounds useful, right? For example, here again are lines 167-172 of the Yellow Buick Review:

<h3><a id="whatBarn"></a>What the Barn Owl Saw</h3>
<h4>Nancy Kilroy</h4>
<p class="PoemDedication">for Sally Samples, 1980-2011</p>
<p class="PoemStanza">in fermentum leo ut urna</p>
<p class="PoemLine">hendrerit commodo.</p>
<p class="PoemLine">vestibulum posuere,</p>

What do you think? It takes just a little longer on my end. Is it helpful to have the lines numbered and the syntax highlit? Or are the colors garishly distracting? Let me know.

2 Comments

Filed under Code Samples, Issues

Moving Out: Making Your Cascading Style Sheet External

Everything we’ve done so far has used an internal cascading style sheet (CSS). Now we’ll move it outside our .html files.

Remember: an .html file is a document full of code such as HTML, CSS, and JavaScript. A .css file is a page full of CSS code. An .html file can have HTML and CSS code inside it, but a .css file should have only CSS code. Bicycle Comics doesn’t use JavaScript in most of our E-books, so for these tutorials, we’ve been working with one big .html file that has both HTML and CSS inside it. With this tutorial, we’re moving 99% of our CSS into an external .css file .

External CSSThere are dozens, maybe hundreds, of tutorials that do a fine job explaining how you can move an internal cascading style sheet to an external .css file. I’ll give you just the basics, and then I’ll spend a little more time on the why, as pertains to E-book production.

In the previous post, we streamlined the CSS so that it is smaller and more elegant. Let’s pick up right there with the file “YBR_7_StreamlinedCSS.html .” (You can download all source code files for YBR for free.)

In short, we’re going to do three things:

  1. Remove the complete CSS info from our .html file with the “cut” command.
  2. “Paste” that CSS info into a separate, new document, which we’ll save as a .css file.
  3. Tell our .html file where the .css file is, so that our HTML can find our CSS whenever it needs it.

Continue reading

4 Comments

Filed under Code Samples, Look and Feel

Streamlining CSS: Chicken Sandwiches, Simplified

Let’s order lunch and streamline our code classes.

We’ve already nuked and simplified The Yellow Buick Review’s HTML/CSS. Before we make it external, let’s streamline our CSS (cascading style sheet) even more. What’s that? You don’t know how to streamline CSS code for a poetry anthology E-book? That’s no problem. Do you at least know how to order lunch? Cool! Let’s start with that. There’s an amazing fried chicken place around the corner from the office. I’ll go around and get everyone’s order: Continue reading

3 Comments

Filed under Code Samples, Look and Feel

Simplify, Simplify (CSS Portion)

Dump the needless CSS you’ve inherited from prose-oriented programs, and replace it with CSS that understands poetry’s unique needs.

illustration of HTML with internal CSS

Pardon the mess; MS Word was visiting.

Through this whole tutorial, we’ve been using cascading style sheet information that we inherited from the original MS Word save-to-HTML operation. Here’s where we set ourselves free. The CSS we have in our sample file is an inline cascading style sheet: it occupies the top third of our HTML. (Quick clarification: an .html file can hold all kinds of code—CSS, HTML, XML, javascript, php, and so forth. HTML is just one kind of information that can sit in an .html file.) There are two problems with this approach.

  • It’s inside our .html file, which is not as useful/easy as giving it its own document.
  • It’s terrible, terrible code anyway.

Just look at my highly technical illustration of the HTML file. See all the “junk” in there? That’s no good. Most poetry anthologies have enough junk as it is; let’s not put junk CSS in there, too. So, here’s what we’ll do about it:

Continue reading

5 Comments

Filed under Code Samples, Look and Feel

Simplify, Simplify (HTML portion)

If your E-book’s .html file has too much junk in it, take Thoreau’s advice and “simplify, simplify.”

Here’s what we’ll do.

  1. Make multiple backup copies.
  2. Change our HTML file to HTML5.
  3. Tidy up our HTML code automatically.
  4. Tidy up our HTML code manually.
  5. We’ll tidy up the CSS part next.

1. Make multiple copies of our .html (or .htm) file

Do it. We’ll be performing major surgery on these files. E-mail one to yourself. Put one on a USB thumb drive. Put one on DropBox. Redundancy defines our age. I’m starting with the file “YBR_1_MSWord_Style_Formatted.htm“. All Yellow Buick Review source files are free to download.

Continue reading

1 Comment

Filed under Code Samples, Look and Feel