Re-arrange how properties will be parsed
This commit is contained in:
parent
dcfc319c9e
commit
9d49a6d17c
1 changed files with 8 additions and 5 deletions
|
@ -254,14 +254,14 @@ class Parser {
|
|||
if ($backcompat) {
|
||||
$classes = $this->mapClassesBackcompat($classes, $out['type']);
|
||||
}
|
||||
$properties = $this->matchPropsMf2($classes);
|
||||
$properties = $this->parseProperties($node, $classes, $backcompat, $types);
|
||||
# if such class(es) are found, it is a property element
|
||||
# add properties found to current microformat's properties: { } structure
|
||||
foreach ($properties as [$pType, $pName]) {
|
||||
if (!isset($out['properties'][$pName])) {
|
||||
$out['properties'][$pName] = [];
|
||||
foreach ($properties as $k => $v) {
|
||||
if (!isset($out['properties'][$k])) {
|
||||
$out['properties'][$k] = [];
|
||||
}
|
||||
$out['properties'][$pName][] = $this->parseProperty($node, $pType, $pName);
|
||||
array_push($out['properties'][$k], ...$v);
|
||||
}
|
||||
# parse a child element for microformats (recurse)
|
||||
$child = null;
|
||||
|
@ -276,6 +276,9 @@ class Parser {
|
|||
}
|
||||
}
|
||||
|
||||
protected function parseProperties(\DOMElement $node, array $classes, bool $backcompat, array $types): array {
|
||||
}
|
||||
|
||||
protected function matchPropsMf2(array $classes): array {
|
||||
$out = [];
|
||||
foreach ($classes as $c) {
|
||||
|
|
Loading…
Reference in a new issue