HTML5 Suggestions for Marking up Conversations and Footnotes
Common Idioms without Dedicated Elements – Part 2
Foreword: In this part of the series I give you HTML5 suggestions for marking up conversations and footnotes.
By: Chrysanthus Date Published: 5 Aug 2015
Conversation for a web page refers to meeting minutes, chat transcripts, dialogues in screenplays, instant message logs, and other situations where different players take turns in discourse.
Footnote means an extra piece of information that is printed at the bottom of a page in a book. It also means, something that is not important but may be remembered.
HTML5 suggests you mark up conversations using p elements and punctuation. Authors who need to mark the speaker for styling purposes are encouraged to use the span or b elements. Paragraphs with their text wrapped in the i element can be used for marking up stage directions.
The following code is dialogue between John and Peter:
<p> John: Look, you gotta first baseman?</p>
<p> Peter: Certainly.</p>
<p> John: Who's playing first?</p>
<p> Peter: That's right.</p>
<p> John becomes exasperated.</p>
<p> John: When you pay off the first baseman every month, who gets the money?</p>
<p> Peter: Every dollar of it.</p>
Note that quotation marks have not been used. The name of the speaker and his sentence have been separated by a colon. The fifth paragraph is of the narrator (author).
All the following text and example code is copied from the HTML5 specification:
The following extract shows how an IM conversation log could be marked up, using the data element to provide Unix timestamps for each line. Note that the timestamps are provided in a format that the time element does not support, so the data element is used instead (namely, Unix time_t timestamps). Had the author wished to mark up the data using one of the date and time formats supported by the time element, that element could have been used instead of data. This could be advantageous as it would allow data analysis tools to detect the timestamps unambiguously, without coordination with the page author.
<p> <data value="1319898155">14:22</data> <b>egof</b> I'm not that nerdy, I've only seen 30% of the star trek episodes</p>
<p> <data value="1319898192">14:23</data> <b>kaj</b> if you know what percentage of the star trek episodes you have seen, you are inarguably nerdy</p>
<p> <data value="1319898200">14:23</data> <b>egof</b> it's unarguably</p>
<p> <data value="1319898228">14:23</data> <i>* kaj blinks</i></p>
<p> <data value="1319898260">14:24</data> <b>kaj</b> you are not helping your case</p>
The fourth paragraph is of the narrator.
HTML does not have a good way to mark up graphs, so descriptions of interactive conversations from games are more difficult to mark up. This example shows one possible convention using dl elements to list the possible responses at each point in the conversation. Another option to consider is describing the conversation in the form of a DOT file, and outputting the result as an SVG image to place in the document.
<p> Next, you meet a fisherman. You can say one of several greetings:
<dt> "Hello there!"
<p> He responds with "Hello, how may I help you?"; you can respond with:
<dt> "I would like to buy a fish."
<dd> <p> He sells you a fish and the conversation finishes.
<dt> "Can I borrow your boat?"
<p> He is surprised and asks "What are you offering in return?".
<dt> "Five gold." (if you have enough)
<dt> "Ten gold." (if you have enough)
<dt> "Fifteen gold." (if you have enough)
<dd> <p> He lends you his boat. The conversation ends.
<dt> "A fish." (if you have one)
<dt> "A newspaper." (if you have one)
<dt> "A pebble." (if you have one)
<dd> <p> "No thanks", he replies. Your conversation options
at this point are the same as they were after asking to borrow
his boat, minus any options you've suggested before.
<dt> "Vote for me in the next election!"
<dd> <p> He turns away. The conversation finishes.
<dt> "Sir, are you aware that your fish are running away?"
<p> He looks at you skeptically and says "Fish cannot run, sir".
<dt> "You got me!"
<dd> <p> The fisherman sighs and the conversation ends.
<dt> "Only kidding."
<dd> <p> "Good one!" he retorts. Your conversation options at this
point are the same as those following "Hello there!" above.
<dt> "Oh, then what are they doing?"
<dd> <p> He looks at his fish, giving you an opportunity to steal
his boat, which you do. The conversation ends.
In some games, conversations are simpler: each character merely has a fixed set of lines that they say. In this example, a game FAQ/walkthrough lists some of the known possible responses for each character:
<p><small>Some characters repeat their lines in order each time you interact
with them, others randomly pick from amongst their lines. Those who respond in
order have numbered entries in the lists below.</small>
<li>How may I help you?
<li>A loaf of bread for madam?
<p>Before the accident:
</li>I'm about to fly out, sorry!
</li>Sorry, I'm just waiting for flight clearance and then I'll be off!
<p>After the accident:
<li>I'm about to fly out, sorry!
<li>Ok, I'm not leaving right now, my plane is being cleaned.
<li>Ok, it's not being cleaned, it needs a minor repair first.
<li>Ok, ok, stop bothering me! Truth is, I had a crash.
<p>During the first clan meeting:
<li>Hey, have you seen my daughter? I bet she's up to something nefarious again...
<li>Nice weather we're having today, eh?
<li>The name is Bailey, Jeff Bailey. How can I help you today?
<li>A glass of water? Fresh from the well!
<p>After the earthquake:
<li>Everyone is safe in the shelter, we just have to put out the fire!
<li>I'll go and tell the fire brigade, you keep hosing it down!
Annotate means to add notes to a book or text, giving explanations and comments. For annotations, the a element should be used, pointing to an element later in the document. The convention is that the contents of the link be a number in square brackets. The following text and example are copied from the HTML5 specification:
In this example, a footnote in the dialogue links to a paragraph below the dialogue. The paragraph then reciprocally links back to the dialogue, allowing the user to return to the location of the footnote.
<p> Announcer: Number 16: The <i>hand</i>.
<p> Interviewer: Good evening. I have with me in the studio tonight
Mr Norman St John Polevaulter, who for the past few years has been
contradicting people. Mr Polevaulter, why <em>do</em> you
<p> Norman: I don't. <sup><a href="#fn1" id="r1"></a></sup>
<p> Interviewer: You told me you did!
<p id="fn1"><a href="#r1"></a> This is, naturally, a lie,
but paradoxically if it were true he could not say so without
contradicting the interviewer and thus making it false.</p>
For side notes, longer annotations that apply to entire sections of the text rather than just specific words or sentences, the aside element should be used. The following text and example code are copied from theHTML5 manual:
In this example, a sidebar is given after a dialogue, giving it some context.
<p> <span class="speaker">Customer</span>: I will not buy this record, it is scratched.
<p> <span class="speaker">Shopkeeper</span>: I'm sorry?
<p> <span class="speaker">Customer</span>: I will not buy this record, it is scratched.
<p> <span class="speaker">Shopkeeper</span>: No no no, this's'a tobacconist's.
<p>In 1970, the British Empire lay in ruins, and foreign
nationalists frequented the streets — many of them Hungarians
(not the streets — the foreign nationals). Sadly, Alexander
Yalt has been publishing incompetently-written phrase books.
For figures or tables, footnotes can be included in the relevant figcaption or caption element, or in surrounding prose. The following text and example code are copied from the HTML5 specification:
In this example, a table has cells with footnotes that are given in prose. A figure element is used to give a single legend to the combination of the table and its footnotes.
<figcaption>Table 1. Alternative activities for knights.</figcaption>
<td> Wherever possible
<td> £0<sup><a href="#fn1">1</a></sup>
<td> Routines, chorus scenes<sup><a href="#fn2">2</a></sup>
<td> Dining<sup><a href="#fn3">3</a></sup>
<td> Cost of ham, jam, and spam<sup><a href="#fn4">4</a></sup>
<p id="fn1">1. Assumed.</p>
<p id="fn2">2. Footwork impeccable.</p>
<p id="fn3">3. Quality described as "well".</p>
<p id="fn4">4. A lot.</p>
That is it for this part of the series.
Related LinksBasics of HTML 5
Basics of ECMAScript
HTML DOM Basics
Text Elements in HTML
Microsyntax Dates and Times in HTML
Common Idioms without Dedicated Elements
HTML Embedded Content
HTML Insecurities and Prevention
Presentation Mathematical Markup Language
More Related Links
PurePerl MySQL API
Major in Website Design
Perl Course - Optimized
Web Development Course