Microformat Design Pattern

December 15, 2005

Filed under: Uncategorized — Tags: — Tim @ 3:12 pm

Building a complete citation microformat from the ground up is a daunting task; and one that may not actually need to be done. Brian Suda and I have shot emails back and forth for the past couple of months discussing such a microformat.

In addition to a greater understanding of microformats for me, we believe that we have come up with a starting point: instead of addressing a full citation microformat, we have a couple of design patterns that address what people have been asking for.

For my concern, that means starting with how to format a book title.

The design pattern that Brian floated is the schema class=”title-*”. The beauty is that it is simple and extensible — i.e. title-movie, title-poem, title-novel, title-song — providing a semantic hook on which to hang our css:

I was reading <cite class="title-book">The Stars My Destination</cite>, which was originally titled <cite class="title-book">Tiger! Tiger!</cite> after William Blake's poem <span class="title-poem">The Tyger!</span>. You can find more information in <span class="title-reference">Science Fiction Writers</span>.


.title-book { font-style: italic; }
.title-poem:before { content: open-quote; }
.title-poem:after { content: close-quote; }
.title-reference { text-decoration: underline; }

Resulting in:

I was reading The Stars My Destination, which was originally titled Tiger! Tiger! after William Blake’s poem The Tyger!. You can find more information in Science Fiction Writers.

[This is, of course, just a sample of how the titles could be styled. Also note that the use of :before and :after is ignored by Internet Explorer.]

Now that the human quotient is taken care of, we have something for machines as well. Since I’m not a programmer, I’ll just excerpt from one of Brian’s emails:

When we convert this to BibTeX we have to use X2C-bibtex.xsl, since a bibtext reference can only handle one title it looks for class=”title”and would ignore title-alternative and alt-title, so there is no +/- for which style to use (the general title-* or the specific name like alt-title, producer, editor, etc.)

The next format we choose is something like Z39.80. When we transform that we use X2C-z39.80.xsl, since there is a specific place for alternate title and regular title, when populating that citation the xslt looks for class=”title” for the title and class=”title-alternative” or class=”alt-title” for the alternate title, so no +/- for general or specific because it is looking for specific instances anyway.

Now the third possibility (and this is a mythical format, but I’m sure one exists, we’ll call it FOOBAR). In foobar you can have multiple title elements:
<foobar>
<title></title>
<title></title>
</foobar>

Now when we use X2C-foobar, it will look for class=”title-*”, so it will find title and title-alternate and apply them BOTH to just the <title> element in the output. It will ever actually find the class=”alternative-title” unless we specifically are searching for that.

The title-* (i think) make things more extensible, so this year we have title, title-alternate, title-translated. But next year or in the future there might be a need for title-webversion, or title-trailer. Formats like bibtext and z39.80 are not effected because they never had a place to stick these things anyway, but foobar does, and instead of ‘rewriting’ the X2C code for each now title-XXXX that appears (or in the specific case adding a class=”webversion-title”) and account for that, we can just fall back on the title-* wildcard.

Brian wants to apply the same design pattern to date-time: . class=”dt-published”, dt-created, dt-modified, dt-revision-2, dt-release-us, dt-release-uk, etc.

Now, this is not to say that I’m completely abandoning a full bibliographic microformat. In fact, we need something fairly quickly at work, so I’m going to forge ahead with something, probably along the lines of:
Note: this isn’t meant to be a Microformat, just a format for use at work

<span class="citation">
    <span class="title-article">"FROG."</span>
    <span class="title-">Acronyms, Initialisms and Abbreviations Dictionary</span>.
    <span class="editor">Ed. Kathleen Edgar</span>.
    <span class="volume">Vol. 2</span>.
    <span class="edition">34th ed.</span>
    <span class="publisher">Detroit: Gale</span>,
    <abbr class="dt-published" title="2005">2005</abbr>.
    <span class="title-publication">Gale Virtual Reference Library</span>.
    <span class="publisher">Thomson Gale</span>.
    <span class="user">Gale Internal User</span>.
    <abbr class="dt-accessed" title="2005-12-14">14 December 2005</abbr>
</span>

“FROG.” Acronyms, Initialisms and Abbreviations Dictionary. Ed. Kathleen Edgar. Vol. 2. 34th ed. Detroit: Gale, 2005. Gale Virtual Reference Library. Thomson Gale. Gale Internal User. 14 December 2005

No Comments

No comments yet.

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.

flickr » Petco Park