<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Schadenfreude &#187; liquid</title>
	<atom:link href="http://www.ralree.com/tag/liquid/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ralree.com</link>
	<description>Malicious enjoyment derived from observing someone else's misfortune</description>
	<lastBuildDate>Sun, 28 Feb 2010 04:18:37 +0000</lastBuildDate>
	
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Mephisto Tag Cloud Plugin</title>
		<link>http://www.ralree.com/2007/02/25/mephisto-tag-cloud-plugin/</link>
		<comments>http://www.ralree.com/2007/02/25/mephisto-tag-cloud-plugin/#comments</comments>
		<pubDate>Sun, 25 Feb 2007 11:15:00 +0000</pubDate>
		<dc:creator>Erik</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[liquid]]></category>
		<category><![CDATA[mephisto]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://www.ralree.info/2007/10/20/mephisto-tag-cloud-plugin</guid>
		<description><![CDATA[Because the French one disappeared off the face of the earth, I took it upon myself to make a tag cloud Liquid plugin.  Here&#8217;s the scoop.  I downloaded Rick&#8217;s MeasureMap Plugin and went to town converting it.
Add this to your sidebar in your liquid template of choice:

{% for tag in site.tags %}
  [...]]]></description>
			<content:encoded><![CDATA[<p>Because the French one disappeared off the face of the earth, I took it upon myself to make a tag cloud Liquid plugin.  Here&#8217;s the scoop.  I downloaded <a href="http://mephisto.stikipad.com/help/show/Liquid+Plugins">Rick&#8217;s MeasureMap Plugin</a> and went to town converting it.</p>
<p>Add this to your sidebar in your liquid template of choice:</p>
<pre><code>
{% for tag in site.tags %}
  {{ tag | size_tag }}
{% endfor %}
</code></pre>
<p>And you should have some awesome tag_cloud action.  You can specify an upper limit as well:</p>
<pre><code>
{{ tag | size_tag: 3 }}
</code></pre>
<p>That code allows for up to <strong>4em</strong> font size.  I don&#8217;t recommend this because it&#8217;s ludicrous.  The default upper limit is <strong>2em</strong>, which makes the font size range between <strong>1em</strong> and <strong>2em</strong>.  Suggestions are welcome.</p>
<p>Get it here:</p>
<pre><code>
svn co https://modzer0.cs.uaf.edu/repos/hank/code/rails/mephisto/mephisto_tag_cloud
</code></pre>
<p>Or install it like this:</p>
<pre><code>
./script/plugin install https://modzer0.cs.uaf.edu/repos/hank/code/rails/mephisto/mephisto_tag_cloud
</code></pre>
<p>Works for me &#8211; let me know if you have any difficulties.</p>
<h2>Update: French one re-appears!</h2>
<p>Well, <a href="http://boldr.stikipad.com/notes/show/HomePage">he&#8217;s back</a>.  It was down a while back.  You can see his version <a href="http://svn.boldr.net/mephisto/plugins/trunk/mephisto_tag_cloud/">here</a>.  I like mine better. :P</p>
<h2>Update: Better <code>SELECT</code> Statement</h2>
<p>Thanks to <a href="http://seaofclouds.com/">Todd</a> for pointing out that the tags were applying to not only published articles, but drafts as well, which produced false tag counts.  He also pointed out that they were applying to revisions, which was unacceptable.  I think I fixed the problems using some straight up SQL:</p>
<div class="CodeRay">
<div class="code">
<pre><code>
    <span class="r">def</span> <span class="fu">size_tag</span>(tag, largest = <span class="i">2</span>, smallest = <span class="fl">0.5</span>)
      number = <span class="co">ActiveRecord</span>::<span class="co">Base</span>.count_by_sql(
        [<span class="s"><span class="dl">&quot;</span><span class="k">SELECT COUNT(*) FROM taggings,
            tags, contents WHERE
            tags.name = ? AND taggings.tag_id = tags.id
            AND contents.id = taggings.taggable_id
            AND contents.published_at IS NOT NULL;</span><span class="dl">&quot;</span></span>, tag])
      size = sprintf(<span class="s"><span class="dl">&quot;</span><span class="k">%0.2f</span><span class="dl">&quot;</span></span>, number.to_f / <span class="i">5</span>)
      size = size.to_f &gt; largest ? largest : size.to_f &lt; smallest ? smallest : size
</code></pre>
</div>
</div>
<p>This is simple &#8211; I&#8217;m just adding some conditions that filter unpublished articles and revisions (which I don&#8217;t think actually appear in the <strong>contents</strong> table anyway).  In a test, the <strong>linux</strong> tag returned <b>35</b> results the old way, <b>34</b> without the checking of <strong>published_id</strong>, and <b>33</b> as it is above.  I think it&#8217;s filtering, but Todd will have to confirm this.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ralree.com/2007/02/25/mephisto-tag-cloud-plugin/feed/</wfw:commentRss>
		<slash:comments>37</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.303 seconds -->
