microformats2-parsing-faq: Difference between revisions

From Microformats Wiki
Jump to navigation Jump to search
(sample Q&A to make the TOC show up)
(checking for explicit properties before implying)
Line 11: Line 11:


A: Normalizing u-* property values occurs exactly where necessary and no more. In particular, normalizing only when present in URL attributes follows the semantics of those attributes (normalization to absolute URLs) per the [[HTML5]] specification, whereas when the value is present in a title attribute or in text, the expectation, in both normal usage and in the browser, is that such values are displayed and used as is without any normalization.
A: Normalizing u-* property values occurs exactly where necessary and no more. In particular, normalizing only when present in URL attributes follows the semantics of those attributes (normalization to absolute URLs) per the [[HTML5]] specification, whereas when the value is present in a title attribute or in text, the expectation, in both normal usage and in the browser, is that such values are displayed and used as is without any normalization.
=== checking for explicit properties before implying ===
Q: When checking for whether or not to look for implied properties, should the parser look for an explicit "p-name" in particular or "*-name" in the list of parsed property names?
A: Before implying a "name" property, look for the unprefixed property, e.g. "name", not "p-name" nor "*-name".
In the JSON set of parsed property names, there are no prefixes (e.g. see the "Parsed JSON" examples in [[microformats2]]).
The order of operations in the parsing algorithm is explicit about this: parsers only imply properties ''after'' parsing an element for all explicit properties, per [[microformats2-parsing#parse_an_element_for_microformats|parse an element for microformats]].
Parsing for implied properties specifically refers to "name", "photo", and "url": [[microformats2-parsing#parsing_for_implied_properties|parsing for implied properties]] - all unprefixed versions of the property names.
The p- u- dt- e- prefixes are basically parse-time directives that are dropped once parsing is done and you collect the properties/values into your JSON parse tree.


=== add another question topic here ===
=== add another question topic here ===

Revision as of 20:12, 23 October 2012

<entry-title>microformats2-parsing-faq</entry-title>

This page documents answers to frequently (or expected to be) asked questions about microformats2-parsing.

For questions about microformats2 in general, see microformats2-faq.

questions

normalizing u-* property values

Q: In the Parsing u-* section, shouldn't item 5 (if there is a gotten value…) be at the end of the section? Shouldn't normalizing apply wherever the value comes from? (question from IRC, 2012-296).

A: Normalizing u-* property values occurs exactly where necessary and no more. In particular, normalizing only when present in URL attributes follows the semantics of those attributes (normalization to absolute URLs) per the HTML5 specification, whereas when the value is present in a title attribute or in text, the expectation, in both normal usage and in the browser, is that such values are displayed and used as is without any normalization.

checking for explicit properties before implying

Q: When checking for whether or not to look for implied properties, should the parser look for an explicit "p-name" in particular or "*-name" in the list of parsed property names?

A: Before implying a "name" property, look for the unprefixed property, e.g. "name", not "p-name" nor "*-name".

In the JSON set of parsed property names, there are no prefixes (e.g. see the "Parsed JSON" examples in microformats2).

The order of operations in the parsing algorithm is explicit about this: parsers only imply properties after parsing an element for all explicit properties, per parse an element for microformats.

Parsing for implied properties specifically refers to "name", "photo", and "url": parsing for implied properties - all unprefixed versions of the property names.

The p- u- dt- e- prefixes are basically parse-time directives that are dropped once parsing is done and you collect the properties/values into your JSON parse tree.

add another question topic here

Q: What's the question?

A: We have an answer.

see also