A semantic way to represent play strings in HTML

Take the most famous group of lines from them:

Hamlet: To be or not to be: this
the question is: is it worth suffering slings in the mind and
arrows of an outrageous state, or take weapons against a sea of ​​trouble,
And confront them end? To die: to sleep; No more; and sleep say | we end Heartache and a thousand natural shocks This flesh is the heiress,
"This is unsurpassed devotion" wish'd. To die, sleep; Sleep:
it is possible to dream: ay, there the rub; For in that dream of death that dreams can come

How would you label this in a semantic way, saving space for a) line numbers (e.g. 1.1.1), b) symbol name and c) of course text?

+7
source share
3 answers

I am going to disappoint you, but it is impossible. See the A List Apart article for more information.

To summarize, since HTML is a markup language designed specifically for a specific type of document, not all documents can be represented by a limited set of HTML elements:

Some documents cannot be published using HTML. In many cases, we should not even try to try. In other cases, we must radically change the appearance and structure of the document.

They even used the script as an example of one such document. I will recommend that you read the entire article in full to see the rationale, as well as other methods for marking up documents.

+1
source

Since the HTML 4 specification explicitly suggests using dl for dialogue , I think I will use this.

Or:

 <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 continuous prose is semantically important (maybe it 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 style of this (leaving "space" for things) is separate from semantic markup; however, the above gives you ample opportunity to achieve what you need, including possibly using the generated CSS content.

+4
source

“HTML” and “semantic markup” in the same sentence seems a bit contradictory in terms. Unless, of course, you think that designating things as <span class="line-of-poetry"> .

If you want to do it right, you need to think about a coincidence: in the game, splitting the text into lines of poetry gives different / overlapping borders, as if you are dividing it by whoever is speaking. There is extensive literature on how to handle overlapping markup - but I don't think it mentions HTML!

0
source

All Articles