[uf-new] Pattern: Presence of Property
lists at ben-ward.co.uk
Tue Oct 9 05:43:49 PDT 2007
Out of the Recipe format development happening on uf-new I came
across an interested concept that hasn't come up yet in previous
Quoting Andy Mabbett, then myself:
>> Whether an ingredients is optional or required is important (again,
>> consider the "ingredients to hand" use case).
> Agreed, that's a very good use-case. Needs to be included in a
> language-agnostic manner but writing ‘3 sprigs of parsley
> (optional)’ is familiar. I would think that ‘Required’ is implied
> by the absence of ‘Optional’.
In this case, we have a property established for the format which is
either present or absence. An ingredient is either optional or not.
So, lets say you have this in English:
<span class="ingredient">3 Strawberries <span class="optional">
Or this in French:
<span class="ingredient" lang="fr">3 Le Strawberries <span
From a parsing POV, we're only interested in whether ‘optional’ is
present or not. If it's absent, we'd be assuming ‘required’. We'd be
using a pattern whereby the property value is determined from
presence or absence of the element, not by the value of it.
Now of course this application is early days and we may yet find
further requirements or different ways of doing it, but I like the
idea of the pattern as it's language agnostic. Also, I think
‘Presence of Property’ is a pretty snappy name.
What would people think about this sort of parsing rule being added
to the microformats cannon?
More information about the microformats-new