Created
March 17, 2010 18:09
-
-
Save cgrand/335527 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; CREATE HTML PAGE | |
(deftemplate tweet-template "html/template.html" [tweets date] :lockstep | |
{[:title] (content date) | |
[:div.tweet-div] | |
(clone-for [tweet tweets] :lockstep | |
{[:div] (set-attr :id (str "div-" (:id tweet))) | |
[:td.tweet-text] | |
(transformation :lockstep | |
{[:span.tweet-from] (content (:from-user tweet)) | |
[:span.tweet-created-at] (content (.format date-formatter (:created-at tweet))) | |
[:span.tweet-rts] (when (seq (:duplicates tweet)) | |
(content (str "RT: " (count (:duplicates tweet))))) | |
[:a] (do-> | |
(content (:translated-text tweet)) | |
(set-attr :href (make-tweet-url tweet)))}) | |
[:table.retweets-table :tr] | |
(clone-for [tweet (:duplicates tweet)] :lockstep | |
{[:span.rt-from] (content (:from-user tweet)) | |
[:span.rt-text] (content (:text tweet)) | |
[:span.rt-time] (content (.format date-formatter (:created-at tweet)))})})}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> | |
<head> | |
<meta http-equiv="content-type" content="text/html; charset=UTF=8"/> | |
<link rel="stylesheet" type="text/css" href="tweet-search.css"/> | |
<title> Search Results for {search term} </title> | |
</head> | |
<body> | |
<div id="div-{tweet-id}" class="tweet-div"> | |
<table class="main-tweet-table"> | |
<tr> | |
<td id="text-{tweet-id}" class="tweet-text"> | |
<span class="tweet-from">{from}</span> | |
<a>{text}</a> | |
<span class="tweet-created-at">{hh:mm dd/mm}</span> | |
<span class="tweet-rts">RT: n</span> | |
</td> | |
</tr> | |
</table> | |
<table class="retweets-table"> | |
<tr> | |
<td class="rt-from"></td> | |
<td> | |
<span class="rt-from">RT {from}</span> | |
<span class="rt-text">{text}</span> | |
<span class="rt-time">{hh:mm dd/mm}</span> | |
</tr> | |
</table> | |
</body> | |
</html> |
Good catch, Toni! It should reead [:> :tr :> :td :> :span.rt-from] or wrap the clone-for body in a transform-content
heh... now it makes sense. I totally missed the TR while trying to figure out why it doesn't work. Nevertheless, the latest build of elive is wicked fast, even without using this faster selector :)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey, in this version it does not really transform the contents of the retweets. It looks like the [:> :td :> :span.rt-from] style of selectors don't work, but this does [:span.rt-from]... this is in relation to https://gist.github.com/335527/7f6efc031b14b8054384c22e8239a7aced90d407