[uf-discuss] hRecipe - one suggestion, a lot of comments

Thomas Loertsch loertsch.thomas at guj.de
Thu Sep 25 06:24:10 PDT 2008


On 24.09.08 23:07, "Toby A Inkster" <mail at tobyinkster.co.uk> wrote:
> I've put together slightly better documentation of Cognition's
> support for it here:
> http://buzzword.org.uk/cognition/uf-plus.html#hrecipe

slightly ;-) Very impressive work, btw!

>> * Suggestion: idle period / off-time / rest period / unattended time
> Perhaps preparation-time could be made into a plural type+value
> property (like "tel" in hCard).
> <span class="preparation-time">
>    <span class="type">Preparation</span>:
>    <abbr class="value" title="PT5M">10 mins</abbr>
> </span>
> <span class="preparation-time">
>    <span class="type">Waiting</span>:
>    <abbr class="value" title="PT25M">25 mins</abbr>
> </span>
> <span class="preparation-time">
>    <span class="type">Cooking</span>:
>    <abbr class="value" title="PT35M">35 mins</abbr>
> </span>

That's an idea. Would it mean that we have to develop a vocabulary of types
or would that be freeform? In the latter case and to avoid developing
another sub-vocabulary respectively how about this:

* preparation-time (optional, plural)
** preparation-time-note (optional, singular)

In prose: there can be more then one preparation-time element and each can
have a note inline.
That way it would be clear that we don't develop a sub-vocabulary. Editing
would be easy (just leave it out if you don't need it). Parsing is easy too.

I would prefer that solution as a middle ground, but let's at least make
preparation-time plural. Anything else might as well fall outside the 80/20.

>> TobyInk proposes an optimization for Ingredient which makes sense,
>> but...
>> first I wonder how much harder the optimization makes it to develop
>> parsers.
> It's very little effort to implement, but saves a lot of typing when
> publishing recipes, especially when there are a lot of ingredients.
> Implementation is easy by just performing a tiny pre-processing step.
> (Code below in Javascript, assumes that the hRecipe root element is
> "hroot". Should be very easy to port to other DOM-compatible languages.)
> var nodes = hroot.getElementsByClassName('ingredients');
> for (var i=0; nodes[i]; i++)
> {
>  var kids = nodes[i].getChildrenByTagName('*');
>  for (var j=0; kids[j]; j++)
>    { kids[j].className += " ingredient"; }
> }
> Pretty easy. And if you think it's a bit messy to change the DOM tree
> prior to parsing, you should realise that most parsers make a lot of
> DOM changes prior to the proper parsing stage in order to implement
> the include pattern.

Okay, parsing indeed seems to not be an issue, but I'm still not convinced
that it's wise to introduce variations in the syntax for the single most
important element (beside the title). Also the case seems very rare to me. I
just checked a couple of our recipes to be sure and I couldn't find any case
where there was an item without some quantity or note attached. We might be
overly pedantic though ;-) Can you give some examples?


Thomas Lörtsch
Business Development

Living at Home Multi Media GmbH
Redaktion Online

Stubbenhuk 5
20459 Hamburg
Postanschrift: 20444 Hamburg

Telefon +49 (0) 40 / 37 03 - 43 14
Telefax +49 (0) 40 / 37 03 - 42 12
E-Mail  loertsch.thomas at guj.de

  Living at Home Multi Media GmbH | Sitz: Hamburg, Amtsgericht Hamburg HRB
75612 |
Geschäftsführer: Thomas Lindner, Nadja Stavenhagen | Ein Unternehmen von
Gruner + Jahr

More information about the microformats-discuss mailing list