Skip to content

Commit

Permalink
microformats2.render_content(): add <p> to location
Browse files Browse the repository at this point in the history
  • Loading branch information
snarfed committed Mar 20, 2017
1 parent 419a445 commit 4d41c1f
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 5 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,8 @@ Changelog
* Bug fix for creating replies, favorites, or retweets of video URLs, e.g. https://twitter.com/name/status/123/video/1 .
* Instagram:
* Update scraping to handle new home page (ie news feed) JSON schema, which changed sometime around 2017-02-27. (Profile pages and individual photo/video permalinks still haven't changed yet.)
* microformats2:
* Minor whitespace change (added <p>) when rendering locations as HTML.

### 1.7 - 2017-02-27
* microformats2:
Expand Down
2 changes: 1 addition & 1 deletion granary/microformats2.py
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,7 @@ def render_content(obj, include_location=True, synthesize_content=True):
# location
loc = obj.get('location')
if include_location and loc:
content += '\n' + hcard_to_html(
content += '\n<p>%s</p>' % hcard_to_html(
object_to_json(loc, default_object_type='place'),
parent_props=['p-location'])

Expand Down
3 changes: 2 additions & 1 deletion granary/test/test_facebook.py
Original file line number Diff line number Diff line change
Expand Up @@ -944,10 +944,11 @@ def tag_uri(name):
</a>
<span class="summary">my link caption</span>
</p>
<span class="p-location h-card">
<p> <span class="p-location h-card">
<a class="p-name u-url" href="https://www.facebook.com/113785468632283">Lake Merced</a>
</span>
</p>
</div>
</content>
Expand Down
3 changes: 2 additions & 1 deletion granary/test/test_instagram.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,10 +402,11 @@ def tag_uri(name):
<img class="thumbnail" src="http://attach/image/big" alt="" />
</a>
</p>
<span class="p-location h-card">
<p> <span class="p-location h-card">
<a class="p-name u-url" href="https://instagram.com/explore/locations/520640/">Le Truc</a>
</span>
</p>
</div>
</content>
Expand Down
3 changes: 2 additions & 1 deletion granary/test/test_microformats2.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,10 +222,11 @@ def test_render_content_omits_tags_without_urls(self):
def test_render_content_location(self):
self.assert_equals("""\
foo
<span class="p-location h-card">
<p> <span class="p-location h-card">
<a class="p-name u-url" href="http://my/place">My place</a>
</span>
</p>
""", microformats2.render_content({
'content': 'foo',
'location': {
Expand Down
3 changes: 2 additions & 1 deletion granary/test/test_twitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -609,10 +609,11 @@ def tag_uri(name):
<img class="thumbnail" src="http://p.twimg.com/picture3" alt="" />
</a>
</p>
<span class="p-location h-card">
<p> <span class="p-location h-card">
<a class="p-name u-url" href="https://maps.google.com/maps?q=32.4004416,-98.9852672">Carcassonne, Aude</a>
</span>
</p>
</div>
</content>
Expand Down

0 comments on commit 4d41c1f

Please sign in to comment.