[uf-discuss] Standardized Representation of Microformats in JSON / was: (no subject) & hCardMapper v0.96

Gordon gordon at onlinehome.de
Wed Apr 2 14:36:17 PST 2008


Dan Brickley schrieb: 
> +1 ...keeping the naming the same (minus punctuation fixes for .js 
> syntax) makes sense.
>
Ok. New Diagram and Zip are online now.

To sum it up:

1. A jCard has the same properties as any hCard/vCard.

2. Hyphenated properties from hCard/vCard drop the hyphen and use 
camel-case instead.
Correct: given-name becomes givenName.

So much for naming conventions. On to structure.

3. All singular instance properties use only their correspong datatype 
for value.

Correct:
n = { givenName: 'John', familyName: 'Doe'}
fn = 'John Doe'

Wrong:
n = [ {givenName: 'John'}, {familyName: 'Doe'} ]
fn = {value: 'John Doe'}

4. All properties that may have multiple instances use an Array of their 
corresponding datatype.
Correct: nickname = ['Rio Demonhog', 'Gogo Fiasco']

5. Properties that are not set must be omitted.
Example: email = [
    {type: ['pref'], value: 'foo at example.com'},
    {value: 'bar at example.com'}
]

I am undecided on disallowing or forcing reduction of Arrays and 
Objects, when they only hold a single value. There is definitely an 
advantage in disallowing reduction, as it reduces authoring choices and 
thus complexity. So if we want to keep it simple, I guess disallowing is 
the right choice. On the other hand, JavaScript is loosely typed and we 
could come up with a much more compact jCard if we force reduction. This 
would also make sense in conjunction with 5. The only thing that doesn't 
make sense to me is allowing both.

Would you want either

6a. Enclosing Arrays or Objects must NOT be reduced.
Wrong: email = 'bar at example.com'
Correct: email = [{value: 'bar at example.com'}]

or

6b. Enclosing Arrays or Objects MUST be reduced
Wrong: email = [{value: 'bar at example.com'}]
Correct: email = 'bar at example.com'

and

Correct: email = [
    {type: ['pref'], value: 'foo at example.com'},
    'foobar at example.com'
]

and

Wrong: nickname = ['Gogo Fiasco']
Correct: nickname = 'Gogo Fiasco'

and last rule

7. A type property must not be the only property of an Object.
Wrong: email = [{type: 'pref'}]

This would be it. So, what do you say?
Cheers, Gordon


More information about the microformats-discuss mailing list