Forum Moderators: open

Message Too Old, No Replies

Is less markup always better?

Or should we not be afraid of adding a little structure here and there?

         

bedlam

7:12 am on Nov 3, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This question comes out of a recent thread [webmasterworld.com] about how to mark up poetry. At one point I suggested that it might sometimes be useful to mark up a stanza of poetry like this:

<div class="stanza">
<div class="line">In me thou see'st the glowing of such fire</div>
<div class="line">That on the ashes of his youth doth lie,</div>
<div class="line">As the death-bed whereon it must expire</div>
<div class="line">Consumed with that which it was nourish'd by.</div>
<div class="line">This thou perceivest, which makes thy love more strong,</div>
<div class="line">To love that well which thou must leave ere long.</div>
</div>

But that led to comments like this:

Adding 3 other tags just so you can play with them and change their function is something a mid-level programmer would do.

But I disagree. As I mentioned in that thread, I'm less inclined than I used to be to believe that minimal markup is always better -- though I will continue to recommend that approach in most circumstances!

Markup, after all, is about describing the marked-up content. But the uses of markup are a bit hard to nail down; why, for example, is it better to stick a street address in between two address tags than it is to enclose the address in a div element? Practically speaking, if you're not doing any DOM scripting, or xslt transformations, there is probably no difference at all. Nevertheless, a large proportion of pro html/css coders would probably insist that, in general, it's best practice to mark up content according to what it is -- even in the absence of any obvious benefit to doing so.

The case being discussed here -- poetry -- is a case where I can easily envision, for example, pedagogical situations where there would be a distinct benefit to marking-up poetry in what might otherwise seem to be truly hideous ways:

<div class="line">Now <span class="stress">is</span> the <span class="stress">win</span>ter <span class="stress">of</span> our <span class="stress">dis</span>con<span class="stress">tent</span></div>
<div class="line">Made <span class="stress">glo</span>ri<span class="stress">ous</span> sum<span class="stress">mer</span> by <span class="stress">this</span> sun <span class="stress">of</span> <span class="extraFoot">York</span>;</div>

There's no doubt in my mind that this markup would be unsuitable for many (or most!) circumstances, but I submit that for something like, say, an interactive online course, this markup could be much preferable to <pre> / </pre>. Other sorts of educational resources routinely indicate features of poetic texts such as stresses short / long / extra lines, caesura etc. What possible good reason is there let a puritanical approach to markup restrict the possibilities of an entire medium?

You wouldn't want to mark this up manually, you sure wouldn't want to have to edit it by hand, and I'm not even saying that this is the best markup that could be designed for the purpose, but if you had access to this type of content in a nice xml file, you could turn out html pages like this in a completely automated fashion. Given that it might be done with xslt, the inappropriateness of this particular markup to other user-agents is irrelevant; you'd presumably transform the content differently for pdas, phones and screenreaders.

Why not do it? Is there any good reason, or is it just that we're squeamish about lots of apparently 'extra' inline elements (you know, since we were burned so badly by the whole 90s <font> debacle...)

-B

rjohara

7:33 am on Nov 3, 2005 (gmt 0)

10+ Year Member



It's perfectly reasonable to use heavy markup if there is a purpose for doing so. In serious text work we all run into the semantic poverty of HTML very quickly. With respect to poetry (or addresses), future versions of HTML are expected to have a <line></line> element, which is what was missing from HTML from the beginning. (<br> is a vestige of typewriter days, and has no semantic content.)

If you're interested in heavy markup, you should do a search for the Text Encoding Initiative (TEI), which has been working on these sorts of issues since before HTML. Many academic text specialists use an markup system called TEI-Lite.

Robin_reala

9:48 am on Nov 3, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I always try and use the least amount of markup that fully captures the semantics of the text. In the original poetry question the semantics weren't being fully captured and so it needed pretty heavy markup. There's nothing wrong with that. The problem comes when people start doing stuff like titling every occurence of an abbreviation - it's valid, but actually just ends up increasing the noise.

JamieCon

2:11 pm on Nov 3, 2005 (gmt 0)

10+ Year Member




The problem comes when people start doing stuff like titling every occurence of an abbreviation - it's valid, but actually just ends up increasing the noise.

I'm inclined to agree with you here - it does seem very wasteful.

What would you suggest as an alternative?

Robin_reala

2:18 pm on Nov 3, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Title the first one and wrap the rest in <abbr> tags without titles?

JamieCon

2:24 pm on Nov 3, 2005 (gmt 0)

10+ Year Member



Ahh I didn't realise that would work :-)

I suppose that potentially part of the reason why this might not occur is that some websites might use a CMS that automatically converts acronyms.

A comedy occurance of this is on the eBuyer website where every occurance of IT is abbr'd to 'Information Technology' - hover of the it in "this product is so hot it steams!" and you'll get a tooltip saying "Information Technlogy"!

Robin_reala

3:20 pm on Nov 3, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Well, it doesn't work in the way I think you're thinking of (still produce tooltips when hovered on any). But if you put the same title on every occurence of an abbr then screen reader users will hear the full title on every occasion, which is more inaccessible than just putting it on the first one.