From 8df24556124a7bcbf939179e59286ff69c758d00 Mon Sep 17 00:00:00 2001 From: Sven Knebel Date: Mon, 1 Oct 2018 21:38:45 +0200 Subject: [PATCH] Fix #127: Change backcompat rules to mf1 roots in properties 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. --- mf2py/backcompat-rules/hentry.json | 11 +++++------ mf2py/backcompat-rules/hproduct.json | 2 +- mf2py/backcompat-rules/hresume.json | 14 +++++++------- mf2py/backcompat-rules/hreview-aggregate.json | 2 +- mf2py/backcompat-rules/hreview.json | 4 ++-- mf2py/backcompat-rules/vcard.json | 6 ++---- mf2py/backcompat-rules/vevent.json | 2 +- test/test_parser.py | 5 +++-- 8 files changed, 22 insertions(+), 24 deletions(-) diff --git a/mf2py/backcompat-rules/hentry.json b/mf2py/backcompat-rules/hentry.json index 4eaa52d..d738cdf 100644 --- a/mf2py/backcompat-rules/hentry.json +++ b/mf2py/backcompat-rules/hentry.json @@ -19,13 +19,12 @@ "p-summary" ], "author": [ - "p-author", - "h-card" - ], + "p-author", + "vcard" + ], "geo": [ - "p-geo", - "h-geo" - ], + "p-geo" + ], "updated": [ "dt-updated" ] diff --git a/mf2py/backcompat-rules/hproduct.json b/mf2py/backcompat-rules/hproduct.json index 7b2aaab..e5e3244 100644 --- a/mf2py/backcompat-rules/hproduct.json +++ b/mf2py/backcompat-rules/hproduct.json @@ -26,7 +26,7 @@ ], "review": [ "p-review", - "h-review" + "hreview" ], "fn": [ "p-name" diff --git a/mf2py/backcompat-rules/hresume.json b/mf2py/backcompat-rules/hresume.json index 3e91066..8c15e9c 100644 --- a/mf2py/backcompat-rules/hresume.json +++ b/mf2py/backcompat-rules/hresume.json @@ -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" ] } } \ No newline at end of file diff --git a/mf2py/backcompat-rules/hreview-aggregate.json b/mf2py/backcompat-rules/hreview-aggregate.json index fe3d59f..0aa3896 100644 --- a/mf2py/backcompat-rules/hreview-aggregate.json +++ b/mf2py/backcompat-rules/hreview-aggregate.json @@ -18,7 +18,7 @@ "reviewer": [ "p-reviewer", "p-author", - "h-card" + "vcard" ], "best": [ "p-best" diff --git a/mf2py/backcompat-rules/hreview.json b/mf2py/backcompat-rules/hreview.json index d786cae..c9f7d97 100644 --- a/mf2py/backcompat-rules/hreview.json +++ b/mf2py/backcompat-rules/hreview.json @@ -14,11 +14,11 @@ ], "reviewer": [ "p-author", - "h-card" + "vcard" ], "url": [ "p-item", - "h-item", + "h-item", "u-url" ], "photo": [ diff --git a/mf2py/backcompat-rules/vcard.json b/mf2py/backcompat-rules/vcard.json index b731172..ef8d70f 100644 --- a/mf2py/backcompat-rules/vcard.json +++ b/mf2py/backcompat-rules/vcard.json @@ -31,8 +31,7 @@ "p-category" ], "adr": [ - "p-adr", - "h-adr" + "p-adr" ], "locality": [ "p-locality" @@ -80,8 +79,7 @@ "p-honorific-prefix" ], "geo": [ - "p-geo", - "h-geo" + "p-geo" ], "fn": [ "p-name" diff --git a/mf2py/backcompat-rules/vevent.json b/mf2py/backcompat-rules/vevent.json index 3f48353..7c15fec 100644 --- a/mf2py/backcompat-rules/vevent.json +++ b/mf2py/backcompat-rules/vevent.json @@ -19,7 +19,7 @@ "dt-start" ], "geo": [ - "p-location h-geo" + "p-location" ], "organizer": [ "p-organizer" diff --git a/test/test_parser.py b/test/test_parser.py index 505a4be..3bb5d10 100644 --- a/test/test_parser.py +++ b/test/test_parser.py @@ -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',