43 lines
947 B
Fish
43 lines
947 B
Fish
{{response.headers['web2py-response-flash']=response.flash}}
|
|
|
|
{{
|
|
"""
|
|
Tweet attributes
|
|
|
|
'iso_language_code',
|
|
'to_user_name',
|
|
'to_user_id_str',
|
|
'profile_image_url_https',
|
|
'from_user_id_str',
|
|
'text',
|
|
'from_user_name',
|
|
'in_reply_to_status_id_str',
|
|
'profile_image_url',
|
|
'id',
|
|
'to_user',
|
|
'source',
|
|
'in_reply_to_status_id',
|
|
'id_str',
|
|
'from_user',
|
|
'from_user_id',
|
|
'to_user_id',
|
|
'geo',
|
|
'created_at',
|
|
'metadata'
|
|
"""
|
|
}}
|
|
|
|
{{import re}}
|
|
{{hashtag = re.compile('([#@])(\w+)')}}
|
|
{{link = re.compile('(?!<")https?\:\/\/[\w\./?&]+')}}
|
|
<table class="twitter">
|
|
{{ for t in tweets: }}
|
|
<tr class="tweet">
|
|
<td><img src="{{=t['profile_image_url_https']}}"/></td>
|
|
<td>
|
|
<a href="http://twitter.com/{{=t['from_user']}}">{{=t["from_user_name"]}}</a>:
|
|
{{=XML(hashtag.sub('<a href="http://twitter.com/\\g<2>">\\g<1>\\g<2></a>',link.sub('<a href="\\g<0>">\\g<0></a>',t["text"].encode('utf8'))),sanitize=True)}}
|
|
</td>
|
|
</tr>
|
|
{{ pass }}
|
|
</table> |