Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

semantic way of representing lines of a play in HTML

Take the most famous group of lines of them all:

Hamlet: To be, or not to be: that is
the question: Whether 'tis nobler in
the mind to suffer The slings and
arrows of outrageous fortune, Or to
take arms against a sea of troubles,
And by opposing end them? To die: to
sleep; No more; and by a sleep to say
we end The heart-ache and the thousand
natural shocks That flesh is heir to,
'tis a consummation Devoutly to be
wish'd. To die, to sleep; To sleep:
perchance to dream: ay, there's the
rub; For in that sleep of death what
dreams may come

How would you mark that up in a semantic way, preserving space for a) line number (e.g., 1.1.1), b) character name, and c) of course, the text?

like image 565
Aaron Yodaiken Avatar asked Jan 15 '11 05:01

Aaron Yodaiken


1 Answers

As the HTML 4 spec explicitly suggests using dl for dialogue, I think I'd use that.

Either:

<dl>
  <dt>Hamlet</dt>
  <dd id="line-1.1.1">To be, or not to be: that is</dd>
  <dd id="line-1.1.2">the question: Whether 'tis nobler in</dd>
  ...

...or, if contiguous prose is semantically important (it probably is):

<dl>
  <dt>Hamlet</dt>
  <dd>
    <span id="line-1.1.1">To be, or not to be: that is</span>
    <span id="line-1.1.2">the question: Whether 'tis nobler in</span>
    ...

The styling of this (leaving "space" for things) is separate from the semantic markup; however, the above gives you sufficient handles to likely achieve what you need, including possibly using generated CSS content.

like image 130
Phrogz Avatar answered Nov 15 '22 10:11

Phrogz