better twitter feed display
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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'
|
||||
|
||||
+317
-805
File diff suppressed because it is too large
Load Diff
@@ -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
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user