View Single Post
Old 10-15-2022, 04:31 PM   #16
Tex2002ans
Wizard
Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.
 
Posts: 2,306
Karma: 13057279
Join Date: Jul 2012
Device: Kobo Forma, Nook
Quote:
Originally Posted by Jellby View Post
Too often I encounter different pieces of poetry, in the same book, with varying indent amounts, I've become lazy now and called them simply "line2", "line3", etc.
Yep, exactly. There are sometimes 2 or 3 layers deep of indentation.

If you only have a basic <p>/<div> for each line... sure, that'll work for basic poems/lyrics, but then you'll get into a pickle later.

So I just tag every line with its own class:
  • <p class="poem">
    • Normal negative indent.
  • <p class="poem2">
    • Double negative indent.
  • <p class="poem3">
    • Triple negative indent.

Code:
The cat jumped over the fox.
   The fox jumped over the cow.
      The cow jumped over the moon.

The dog barked.
   The cat meowed.
      The wolf howled.

... and Tex laughed.
Guess how the HTML markup would look? :P

Spoiler:
Code:
  <div class="poem">
    <div class="stanza">
      <p class="poem">The cat jumped over the fox.</p>
      <p class="poem2">The fox jumped over the cow.</p>
      <p class="poem3">The cow jumped over the moon.</p>
    </div>

    <div class="stanza">
      <p class="poem">The dog barked.</p>
      <p class="poem2">The cat meowed.</p>
      <p class="poem3">The wolf howled.</p>
    </div>

    <div class="stanza">
      <p class="poem">... and Tex laughed.</p>
    </div>
  </div>


- - -

Or... another trick I use (mostly in Indexes), is:
  • I use class names + "two" or "three" on the end.

After you prettify, the HTML code naturally matches similar levels of indentation too:

Spoiler:
Code:
  <div class="poem">
    <div class="stanza">
      <p class="poem">The cat jumped over the fox.</p>
      <p class="poemtwo">The fox jumped over the cow.</p>
      <p class="poemthree">The cow jumped over the moon.</p>
    </div>

    <div class="stanza">
      <p class="poem">The dog barked.</p>
      <p class="poemtwo">The cat meowed.</p>
      <p class="poemthree">The wolf howled.</p>
    </div>

    <div class="stanza">
      <p class="poem">... and Tex laughed.</p>
    </div>
  </div>


See the Index out of the latest latest book I worked on:

Click image for larger version

Name:	Indentation.of.Index.and.Index.HTML.png
Views:	183
Size:	57.5 KB
ID:	197185

Wow, that code brings a tear to my eye, and look how easy it is to read.

- - -

Complete Side Note: That was also the first book I ever ran across where the Index's subentries were actually in page order... usually all books are in alphabetical order. I was scratching my head for a while until I noticed the pattern.

Last edited by Tex2002ans; 10-15-2022 at 05:07 PM.
Tex2002ans is offline   Reply With Quote