{"id":269,"date":"2003-08-06T20:11:03-04:00","date_gmt":"2003-08-07T04:11:03+00:00","guid":{"rendered":"http:\/\/peterjanes.ca\/wordpress\/?p=269"},"modified":"2003-08-06T20:11:03-04:00","modified_gmt":"2003-08-07T04:11:03+00:00","slug":"semantic-html-lyrics-markup","status":"publish","type":"post","link":"https:\/\/peterjanes.ca\/blog\/2003\/08\/06\/semantic-html-lyrics-markup\/","title":{"rendered":"Semantic HTML lyrics&nbsp;markup"},"content":{"rendered":"<div class='e-content'><p>I&#8217;ve been trying to figure out the best way to mark up lyrics for the <a href=\"http:\/\/www.sirens3.com\/\">Sirens website<\/a> (and, tangentially, my <a href=\"\/LenniFan\/\">Lenni Jabour fan site<\/a>).  For my purposes, <cite>best<\/cite> means <cite>having the most flexibility for entry and layout while retaining as much semantic value as possible<\/cite>.  There are a few options:<\/p>\n\n<dl>\n<dt><samp>&lt;pre&gt;<\/samp><\/dt>\n<dd>Preformatted text is probably the simplest way to go, but it&#8217;s also semantically poor.  It also suffers from an apparent bug in IE (who&#8217;d&#8217;a thunk?) which doesn&#8217;t allow the font of a <samp>&lt;pre&gt;<\/samp> element to be styled.<\/dd>\n<dt><samp>&lt;p\/&gt;\/&lt;div\/&gt;<\/samp><\/dt>\n<dd><a href=\"http:\/\/www.piggin.net\/poetry1.htm\">Piggin.Net<\/a> suggests using a separate paragraph for each line.  This makes layout much easier, but drops the semantic idea of paragraphs being groups of sentences.  On the other hand, the <a href=\"http:\/\/www.piggin.net\/poetry5.htm\">stanzas<\/a> <a href=\"http:\/\/www.piggin.net\/poetryex\/growold.htm\">example<\/a> does group lines into verses using <samp>&lt;div\/&gt;<\/samp> elements.<\/dd>\n<dt><samp>&lt;p\/&gt;\/&lt;br\/&gt;<\/samp><\/dt>\n<dd>Paragraphs and line breaks are reasonable and commonly used, though they provide somewhat less-flexible layout options than simple &lt;p\/&gt; elements.  Classes can be applied directly to each paragraph, however, which allows things like <samp>&lt;p class=&#8221;chorus&#8221;&gt;&#8230;&lt;\/p&gt;<\/samp>.<\/dd>\n<dt><samp>&lt;p\/&gt;<\/samp> plus <samp>white-space: pre<\/samp><\/dt>\n<dd>Simple paragraphs are probably the most semantically correct, and applying the CSS <samp>white-space: pre<\/samp> property allows them to be laid out in lines.  Non-CSS2 browsers will see long lines of text for each verse, though, which isn&#8217;t the desired effect.<\/dd>\n<dt>All <samp>&lt;div\/&gt;<\/samp>, all the time<\/dt>\n<dd><samp>&lt;div\/&gt;<\/samp> throws out all the semantics and most of the style inherent in HTML entirely, leaving everything to CSS.  Non-CSS browsers will have a fit, and this isn&#8217;t much different otherwise from <samp>&lt;p\/&gt;\/&lt;div\/&gt;<\/samp> or <samp>&lt;p\/&gt;\/white-space: pre<\/samp>.<\/dd>\n<dt>XML markup<\/dt>\n<dd>Definitely the most semantic, but also the least usable for general browsing.  <abbr title=\"Text Encoding Initiative\">TEI<\/abbr>&#8216;s <a href=\"http:\/\/www.tei-c.org\/P4X\/VE.html\">Base Tag Set for Verse<\/a> seems to be the ultimate method; all of the <a href=\"http:\/\/xml.coverpages.org\/xmlMusic.html\">other XML music formats<\/a> (like <a href=\"http:\/\/www.4ml.org\/\">4ML<\/a>) are note-based, so it&#8217;s impossible to do <em>just<\/em> lyrics.  Layout-wise, if more browsers supported <a href=\"http:\/\/www.alistapart.com\/stories\/inlinexml\/\">styling inline XML<\/a> it might be worthwhile, but ultimately there&#8217;s nothing to see here.  Move along.<\/dd>\n<\/dl>\n\n<p><a href=\"http:\/\/diveintomark.org\/archives\/2002\/08\/06\/changes_in_xhtml_20.html\">Markupbation<\/a> aside, I&#8217;m thinking <samp>&lt;p\/&gt;\/&lt;br\/&gt;<\/samp> gives the biggest bang for the buck.  Add some classes (<cite>verse<\/cite> and <cite>chorus<\/cite>) and some CSS (<samp>.chorus:before { content: &#8216;Chorus:&#8217;; }<\/samp>) and I&#8217;m ready to go.<\/p>\n\n<p>As <a title=\"HTML and Foreign Languages\" href=\"http:\/\/www.mezzoblue.com\/cgi-bin\/mt\/mezzo\/archives\/000199.asp\">Dave Shea says<\/a>, <q>This is an article I needed to find myself&#8230;.  Feel free to link gratuitously with [appropriate search term phrases]&#8230; so that others may benefit from it.<\/q><\/p><\/div><div class=\"syndication-links\"><\/div>","protected":false},"excerpt":{"rendered":"I&#8217;ve been trying to figure out the best way to mark up lyrics for the Sirens website (and, tangentially, my Lenni Jabour fan site). For my purposes, best means having the most flexibility for entry and layout while retaining as much semantic value as possible. There are a few options: &lt;pre&gt; Preformatted text is probably&hellip;","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"mf2_syndication":[],"venue_id":0},"categories":[3],"tags":[],"kind":false,"_links":{"self":[{"href":"https:\/\/peterjanes.ca\/blog\/wp-json\/wp\/v2\/posts\/269"}],"collection":[{"href":"https:\/\/peterjanes.ca\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/peterjanes.ca\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/peterjanes.ca\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/peterjanes.ca\/blog\/wp-json\/wp\/v2\/comments?post=269"}],"version-history":[{"count":0,"href":"https:\/\/peterjanes.ca\/blog\/wp-json\/wp\/v2\/posts\/269\/revisions"}],"wp:attachment":[{"href":"https:\/\/peterjanes.ca\/blog\/wp-json\/wp\/v2\/media?parent=269"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/peterjanes.ca\/blog\/wp-json\/wp\/v2\/categories?post=269"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/peterjanes.ca\/blog\/wp-json\/wp\/v2\/tags?post=269"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}