Open JKingweb opened 1 year ago
Since the parser has already recursed and parsed the child element at that point, I wonder if these lines should be changed to use the parsed properties from the child.
This line:
if it's a p- property element, use the first p-name of the h- child
Could become:
if it's a p- property element, use the parsed
name
property of the h- child
- If the parsed
name
property is a { } structure, use itsvalue
property- Else use the first value in the
name
array
And so on for the other prefixes.
I think this is what php-mf2 does in practice. I wonder what the other parsers do.
A php-mf2 example with odd usage of e-name
to demonstrate the above:
<div class="h-feed">
<article class="p-x-articles h-entry">
<h1 class="e-name"><b>Lorem ipsum</b></h1>
</article>
</div>
"type": [
"h-feed"
],
"properties": {
"x-articles": [
{
"type": [
"h-entry"
],
"properties": {
"name": [
{
"html": "<b>Lorem ipsum</b>",
"value": "Lorem ipsum"
}
]
},
"value": "Lorem ipsum"
}
]
}
Since the parser has already recursed and parsed the child element at that point, I wonder if these lines should be changed to use the parsed properties from the child.
This line:
if it's a p- property element, use the first p-name of the h- child
Could become:
if it's a p- property element, use the parsed
name
property of the h- child
- If the parsed
name
property is a { } structure, use itsvalue
property- Else use the first value in the
name
arrayAnd so on for the other prefixes.
I think this is what php-mf2 does in practice.
This seems pretty sensible to me, though I think your text is incorrect. I suspect you meant something more like this:
if it's a p- property element and the element's microformat has at least one
name
property, use the firstname
property of the h- child as follows:
- If the first
name
property is a { } structure, use itsvalue
property- Else use the first
name
property as parsed
The language is a bit tortured, unfortunately, but I think it expresses the spirit of your proposal accurately.
I wonder what the other parsers do.
Modifying the test so that it is instead:
<div class="h-feed">
<article class="p-x-articles h-entry">
Fall through <h1 class="e-name"><b>Lorem ipsum</b></h1>
</article>
</div>
name
structure of the childname
structure into the child microformat so that it has both value
and html
keys as siblings of properties
The general parsing rules state:
A strict reading excludes implied
name
andurl
(they are not p- or u- properties, technically) despite their being suitable values, such that the parent'sname
property here has a value ofABBA
rather thanC
as the child does:Current parser behaviour:
C
: PHP, JavaScript, Go, Rust, Haskell, RubyABBA
: Python