Skip to content

Commit

Permalink
Fix microformats#127: Change backcompat rules to mf1 roots in properties
Browse files Browse the repository at this point in the history
Changes the implied roots to mf1 root to properly cause nested backcompat parsing.
In cases where property == mf1 root name, no class for it is added.
  • Loading branch information
sknebel committed Oct 1, 2018
1 parent f0a97dc commit 8df2455
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 24 deletions.
11 changes: 5 additions & 6 deletions mf2py/backcompat-rules/hentry.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,12 @@
"p-summary"
],
"author": [
"p-author",
"h-card"
],
"p-author",
"vcard"
],
"geo": [
"p-geo",
"h-geo"
],
"p-geo"
],
"updated": [
"dt-updated"
]
Expand Down
2 changes: 1 addition & 1 deletion mf2py/backcompat-rules/hproduct.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
],
"review": [
"p-review",
"h-review"
"hreview"
],
"fn": [
"p-name"
Expand Down
14 changes: 7 additions & 7 deletions mf2py/backcompat-rules/hresume.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,26 @@
],
"properties": {
"experience": [
"h-event",
"p-experience"
"p-experience",
"vevent"
],
"summary": [
"p-summary"
],
"affiliation": [
"p-affiliation",
"h-card"
"vcard"
],
"contact": [
"h-card",
"p-contact"
"p-contact",
"vcard"
],
"skill": [
"p-skill"
],
"education": [
"h-event",
"p-education"
"p-education",
"vevent"
]
}
}
2 changes: 1 addition & 1 deletion mf2py/backcompat-rules/hreview-aggregate.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"reviewer": [
"p-reviewer",
"p-author",
"h-card"
"vcard"
],
"best": [
"p-best"
Expand Down
4 changes: 2 additions & 2 deletions mf2py/backcompat-rules/hreview.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
],
"reviewer": [
"p-author",
"h-card"
"vcard"
],
"url": [
"p-item",
"h-item",
"h-item",
"u-url"
],
"photo": [
Expand Down
6 changes: 2 additions & 4 deletions mf2py/backcompat-rules/vcard.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@
"p-category"
],
"adr": [
"p-adr",
"h-adr"
"p-adr"
],
"locality": [
"p-locality"
Expand Down Expand Up @@ -80,8 +79,7 @@
"p-honorific-prefix"
],
"geo": [
"p-geo",
"h-geo"
"p-geo"
],
"fn": [
"p-name"
Expand Down
2 changes: 1 addition & 1 deletion mf2py/backcompat-rules/vevent.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"dt-start"
],
"geo": [
"p-location h-geo"
"p-location"
],
"organizer": [
"p-organizer"
Expand Down
5 changes: 3 additions & 2 deletions test/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -606,9 +606,10 @@ def test_value_name_whitespace():
def test_backcompat_hentry():
result = parse_fixture("backcompat/hentry.html")
assert_true('h-entry' in result['items'][0]['type'])
assert_equal({},
result['items'][0]['properties']['author'][0]['properties'])
assert_equal('Tom Morris',
result['items'][0]['properties']
['author'][0]['properties']['name'][0])
result['items'][0]['properties']['author'][0]['value'])
assert_equal('A Title',
result['items'][0]['properties']['name'][0])
assert_equal('Some Content',
Expand Down

0 comments on commit 8df2455

Please sign in to comment.