このブログの更新は Twitterアカウント @m_hiyama で通知されます。
Follow @m_hiyama

メールでのご連絡は hiyama{at}chimaira{dot}org まで。

はじめてのメールはスパムと判定されることがあります。最初は、信頼されているドメインから差し障りのない文面を送っていただけると、スパムと判定されにくいと思います。

参照用 記事

Microformatsと多重マークアップ

yoheiさんのブログにおいて、「Microformats とは何か」「Microformats の夢」と、Microformatsが取り上げられたのは随分と前です。

比較的最近また、Microformatsの事例(hReview)が、「Amazon Web サービス ブログ」で話題にされています(ということを、トラックバックをたどったnaoyaさんのエントリーで知った)。hReviewのサンプルを孫引き(簡略化している)してみます。

<div class="hreview">
 <a class="item url" href="http://www.amazon.com/exec/obidos/ASIN/B000089CJI/">
  <span class="fn">The Postal Service: Give Up</span></a>
 <blockquote class="description"><p>
    "The people thought they were just being rewarded for treating others 
     as they like to be treated, for obeying stop signs and curing diseases, 
     for mailing letters with the address of the sender... Don't wake me, 
     I plan on sleeping in..."
   </p><p>
   "Nothing Better" is a great track on this album, too... 
   </p>
 </blockquote>
</div>

これを見ると、「いつか来た道」というデジャブを感じますね。上のサンプルの要素タグ名とclass属性値をひっくり返してみましょう。つまり、class属性値をタグ名にして、HTMLのタグ名はhtmlという属性値に待避します。するとこうなります:

<hreview html="div">
 <item html="a href" url="http://www.amazon.com/exec/obidos/ASIN/B000089CJI/">
  <fn html="span">The Postal Service: Give Up</fn>
 </item>
 <description html="blockquote"><p>
    "The people thought they were just being rewarded for treating others 
     as they like to be treated, for obeying stop signs and curing diseases, 
     for mailing letters with the address of the sender... Don't wake me, 
     I plan on sleeping in..."
   </p><p>
   "Nothing Better" is a great track on this album, too... 
   </p>
 </description>
</hreview>

つまりですね、hReviewなどで(無意識かもしれないが)使っている技法は多重マークアップです。同一の文書インスタンスに、“見た目と意味”とか“人間可読内容と機械処理指令”のような、異なる観点の情報が重ね合わさって含まれるとき、2種類以上のマークアップ・ボキャブラリを混在させてマークアップしなくてはなりません。昔、こういうのを並行文書構造と呼んだりもしました。

一般論としては、多重マークアップなんて、うまくいくわけないのですが、2つ以上のボキャブラリが同一の木構造を共有する(つまり、オーバラップ・レンジは生じない)前提なら、なんとかなります。

先のhReviewサンプルが多重(二重)マークアップであることを、もっと端的に示すために、次のように書いてみましょう(思い付きインチキ構文です)。太字が二重マークアップ部分です。

{hrev="hreview" html="div"}
 {hrev="item" html="a"}
  {hrev="@url" html="@href"}http://www.amazon.com/exec/obidos/ASIN/B000089CJI/{/}
  {hrev="fn" html="span"}The Postal Service: Give Up{/}
 {/}
 {hrev="description" html="blockquote"}
   <p>
    "The people thought they were just being rewarded for treating others 
     as they like to be treated, for obeying stop signs and curing diseases, 
     for mailing letters with the address of the sender... Don't wake me, 
     I plan on sleeping in..."
   </p><p>
   "Nothing Better" is a great track on this album, too... 
   </p>
 {/}
{/}

この二重マークアップから、HTML部分とhReview部分を切り出して再現するのは容易でしょう。

これとまったく同じ多重マークアップ方式で、野望より無謀とも言える構想を提示したのが、時代を先駆けすぎて自滅した仕様「HyTime」です。

僕は、HyTimeには、ちょっと複雑な感情を抱いています -- 興味があればコチラをどうぞ。