tweetwall 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +1 -1
- data/lib/tweetwall.rb +8 -2
- data/lib/tweetwall/version.rb +1 -1
- metadata +1 -1
data/README.md
CHANGED
@@ -23,7 +23,7 @@ The print_tweets method returns an HTML division of Tweets.
|
|
23
23
|
Simply call the print_tweets method like so:
|
24
24
|
Tweetwall.print_tweets("oceancucumber")
|
25
25
|
|
26
|
-
Optionally, you can specify
|
26
|
+
Optionally, you can specify the number of tweets:
|
27
27
|
Tweetwall.print_tweets("oceancucumber", 10)
|
28
28
|
|
29
29
|
## Contributing
|
data/lib/tweetwall.rb
CHANGED
@@ -17,18 +17,24 @@ module Tweetwall
|
|
17
17
|
|
18
18
|
tweet_wall_html = tweet_wall_html + '<div id="tweet_wall">'
|
19
19
|
twitter_feed.each do |tweet|
|
20
|
+
# Process the tweet
|
20
21
|
tweet_html = tweet.text
|
21
22
|
|
22
|
-
# if there's a hyperlink, make it clickable
|
23
23
|
words = tweet_html.split(" ")
|
24
24
|
words.each do |word|
|
25
|
+
# if there's a hyperlink, make it clickable
|
25
26
|
if word.start_with?("http://") or word.start_with?("https://")
|
26
27
|
tweet_html = tweet_html.gsub(word, '<a href="' + word + '" target="_blank">' + word + '</a>')
|
27
28
|
end
|
29
|
+
|
30
|
+
# if someone has been mentioned, make that clickable
|
31
|
+
if word.start_with?("@")
|
32
|
+
tweet_html = tweet_html.gsub(word, '<a href="http://www.twitter.com/#!/' + word.gsub(/\W$/, "").gsub("@", "") + '" target="_blank">' + word + '</a>')
|
33
|
+
end
|
28
34
|
end
|
29
35
|
|
30
36
|
tweet_wall_html = tweet_wall_html + '<div class="tweet_line">'
|
31
|
-
tweet_wall_html = tweet_wall_html + '<img src="' + twitter_image + '" alt="" class="tweet_image"
|
37
|
+
tweet_wall_html = tweet_wall_html + '<a href="http://www.twitter.com/#!/' + twitter_user + '" target="_blank"><img src="' + twitter_image + '" alt="" class="tweet_image" /></a> '
|
32
38
|
tweet_wall_html = tweet_wall_html + '<span class="tweet_text">' + tweet_html + '</span><br />'
|
33
39
|
tweet_wall_html = tweet_wall_html + '</div>'
|
34
40
|
end
|
data/lib/tweetwall/version.rb
CHANGED