better twitter feed display

This commit is contained in:
mdipierro
2013-03-10 09:10:30 -05:00
parent b853f72e0c
commit 25ab6f9a07
5 changed files with 332 additions and 811 deletions
+1 -1
View File
@@ -1 +1 @@
Version 2.4.2-stable+timestamp.2013.03.10.08.25.15
Version 2.4.2-stable+timestamp.2013.03.10.09.09.48
+1 -1
View File
@@ -1663,7 +1663,7 @@ def twitter():
d = dict()
for e in data:
d[e["id"]] = e
r = reversed(sorted(d))
r = reversed(sorted(d))
return dict(tweets=[d[k] for k in r])
else:
return 'disabled'
File diff suppressed because it is too large Load Diff
+12 -3
View File
@@ -27,8 +27,17 @@ Tweet attributes
"""
}}
{{import re}}
{{hashtag = re.compile('([#@])(\w+)')}}
{{link = re.compile('(?!<")https?\:\/\/[\w\./?&]+')}}
<table class="twitter">
{{ for t in tweets: }}
{{ =DIV(H5(t["from_user_name"])) }}
{{ =DIV(t["text"]) }}
{{ =BR() }}
<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"])),sanitize=True)}}
</td>
</tr>
{{ pass }}
</table>
+1 -1
View File
@@ -26,7 +26,7 @@ data = re.compile('\*/\s+/\*').sub(' ', data)
data = re.compile('[ ]+\n').sub('\n', data)
data = re.compile('\n\s*/[\*]+(?P<a>.*?)[\*]+/', re.DOTALL).sub(
'\n/*\g<a>*/\n', data)
data = re.compile('[ \t]+(?P<a>\S.+?){').sub('\g<a>{', data)
data = re.compile('[ \t]+(?P<a>\S.+?){').sub(' \g<a>{', data)
data = data.replace('}', '}\n')
print data