Skip to content

Commit 66c982c

Browse files
committed
5326d48 review feedback: p-location instead of h-geo
1 parent d628898 commit 66c982c

10 files changed

+12
-13
lines changed

granary/microformats2.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ def object_to_json(obj, trim_nulls=True, entry_class='h-entry',
133133
# TODO: more tags. most will be p-category?
134134
ret = {
135135
'type': (['h-card'] if obj_type == 'person'
136-
else ['h-card', 'h-geo'] if obj_type == 'place'
136+
else ['h-card', 'p-location'] if obj_type == 'place'
137137
else [entry_class]),
138138
'properties': {
139139
'uid': [obj.get('id', '')],
@@ -243,8 +243,7 @@ def json_to_object(mf2):
243243
}
244244

245245
mf2_types = mf2.get('type') or []
246-
mf2_type = ('location' if 'h-geo' in mf2_types
247-
else 'person' if 'h-card' in mf2_types
246+
mf2_type = ('location' if 'h-geo' in mf2_types or 'p-location' in mf2_types
248247
else mf2util.post_type_discovery(mf2))
249248
as_type, as_verb = mf2_type_to_as_type.get(mf2_type, (None, None))
250249

@@ -505,7 +504,7 @@ def hcard_to_html(hcard, parent_props=[]):
505504
photo = prop.get('photo')
506505
return HCARD.substitute(
507506
prop,
508-
types=' '.join(parent_props + hcard['type']),
507+
types=' '.join(util.uniquify(parent_props + hcard['type'])),
509508
photo=img(photo, 'u-photo', '') if photo else '',
510509
linked_name=maybe_linked_name(hcard['properties']))
511510

granary/test/test_facebook.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -831,7 +831,7 @@ def tag_uri(name):
831831
</a>
832832
<span class="summary">my link caption</span>
833833
</p>
834-
<span class="p-location h-card h-geo">
834+
<span class="p-location h-card">
835835
<a class="p-name u-url" href="https://www.facebook.com/113785468632283">Lake Merced</a>
836836
837837
</span>

granary/test/test_instagram.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ def tag_uri(name):
394394
<img class="thumbnail" src="http://attach/image/big" alt="" />
395395
</a>
396396
</p>
397-
<span class="p-location h-card h-geo">
397+
<span class="p-location h-card">
398398
<a class="p-name u-url" href="https://instagram.com/explore/locations/520640/">Le Truc</a>
399399
400400
</span>

granary/test/test_microformats2.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ def test_render_content_omits_tags_without_urls(self):
221221
def test_render_content_location(self):
222222
self.assert_equals("""\
223223
foo
224-
<span class="p-location h-card h-geo">
224+
<span class="p-location h-card">
225225
<a class="p-name u-url" href="http://my/place">My place</a>
226226
227227
</span>

granary/test/test_twitter.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,7 @@ def tag_uri(name):
527527
<img class="thumbnail" src="http://p.twimg.com/picture3" alt="" />
528528
</a>
529529
</p>
530-
<span class="p-location h-card h-geo">
530+
<span class="p-location h-card">
531531
<a class="p-name u-url" href="https://maps.google.com/maps?q=32.4004416,-98.9852672">Carcassonne, Aude</a>
532532
533533
</span>

granary/test/testdata/comment.mf2.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
foo bar baz
1010
</div>
1111

12-
<span class="p-location h-card h-geo">
12+
<span class="p-location h-card">
1313
<a class="p-name u-url" href="https://maps.google.com/maps?q=32.4004416,-98.9852672">Carcassonne, Aude</a>
1414

1515
</span>

granary/test/testdata/comment.mf2.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"content": [{"value": "foo bar baz", "html": "foo bar baz"}],
88
"in-reply-to": ["http://example.com/original/post"],
99
"location": [{
10-
"type": ["h-card", "h-geo"],
10+
"type": ["h-card", "p-location"],
1111
"properties": {
1212
"uid": ["31cb9e7ed29dbe52"],
1313
"name": ["Carcassonne, Aude"],

granary/test/testdata/note.mf2.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
</div>
1818

1919
<img class="u-photo" src="http://example.com/blog-post-123/image" alt="attachment" />
20-
<span class="p-location h-card h-geo">
20+
<span class="p-location h-card">
2121
<a class="p-name u-url" href="https://maps.google.com/maps?q=32.4004416,-98.9852672">Carcassonne, Aude</a>
2222

2323
</span>

granary/test/testdata/note.mf2.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
}],
2626

2727
"location": [{
28-
"type": ["h-card", "h-geo"],
28+
"type": ["h-card", "p-location"],
2929
"properties": {
3030
"uid": ["31cb9e7ed29dbe52"],
3131
"name": ["Carcassonne, Aude"],

granary/test/testdata/note_with_person_tag.mf2.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
</div>
77

8-
<span class="u-category h-card h-card">
8+
<span class="u-category h-card">
99
<a class="p-name u-url" href="https://alice">Alice</a>
1010

1111
</span>

0 commit comments

Comments
 (0)