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()
|
d = dict()
|
||||||
for e in data:
|
for e in data:
|
||||||
d[e["id"]] = e
|
d[e["id"]] = e
|
||||||
r = reversed(sorted(d))
|
r = reversed(sorted(d))
|
||||||
return dict(tweets=[d[k] for k in r])
|
return dict(tweets=[d[k] for k in r])
|
||||||
else:
|
else:
|
||||||
return 'disabled'
|
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: }}
|
{{ for t in tweets: }}
|
||||||
{{ =DIV(H5(t["from_user_name"])) }}
|
<tr class="tweet">
|
||||||
{{ =DIV(t["text"]) }}
|
<td><img src="{{=t['profile_image_url_https']}}"/></td>
|
||||||
{{ =BR() }}
|
<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 }}
|
{{ 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').sub('\n', data)
|
||||||
data = re.compile('\n\s*/[\*]+(?P<a>.*?)[\*]+/', re.DOTALL).sub(
|
data = re.compile('\n\s*/[\*]+(?P<a>.*?)[\*]+/', re.DOTALL).sub(
|
||||||
'\n/*\g<a>*/\n', data)
|
'\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')
|
data = data.replace('}', '}\n')
|
||||||
|
|
||||||
print data
|
print data
|
||||||
|
|||||||
Reference in New Issue
Block a user