Semantics, Code and Circumstance
April 10, 2010: This afternoon I recieved a visit from a plushy black cat. I've never seen her before and since she has a collar she may be moved in with her owner in the last days.
Read more about project 365 ...In the past days, the Topic Maps Lab has moved in different ways. First of all, we had to leave our own 9th floor offices in downtown and moved to the ground floor of the computer science department building. The new offices have a sgnificant lack of look-out but give us much shorter paths to the rest of the department. Fotos will follow, but don’t expect something spectacular.
Aside from moving geographically, we constantly move forward to TMRA 2009. With only ten days to go, the conference organization and proceedings are moving towards completion. I, for my part, finished the proceedings on last thursday and will rouse the print office on tuesday, so you all will have a freshly printed proceedings book in your conference package.
NB: If you are coming to TMRA 2009 and are in need of getting something to eat (beyond the great conference catering), I strongly recommend a visit at the newly opened Vapiano Restaurant in downtown Leipzig. They serve great italian food, freshly made before your eyes with fair prizes.
A demanding cat goes to great lengths in order to warm up and become the centre of attention.
The cat is back. Simon Tofields lates masterpiece pictures a scene that every cat owner is familiar with. A playful cat and an agile fly is always good for some wrecking.
On my crusade on gaining more insight into mephisto, I felt it would be helpful to see how this plugin thingy works. I found, that writing your own mephisto plugin is not as hard as you would think. In fact, it is real easy. Start with generating the plugin skeleton.
# ruby script/generate plugin NameOfYourPlugin
Now, define your method inside lib/name_of_your_plugin.rb.
module NameOfYourPlugin
def link_to_something_strange(object_to_yield)
url = 'http://example.com/api?'
url += "id=#{object_to_yield['some_attribute']}"
content_tag :a, 'foobar', :href => url
end
end
After that, open init.rb and paste in the following:
require 'name_of_your_plugin'
Liquid::Template.register_filter NameOfYourPlugin
The first line is the standard registration you need for every rails plugin. The second line registers whatever method you defined as a global liquid filter. If you like to add another filter, just put the method inside lib/name_of_your_plugin.rb and it will be automagically registered.
The last step is to include your fresh filter into the liquid template.
{{ object_to_yield | link_to_something_strange }}
That’s all folks. Really. Be sure to check the first fruit of this new gained insights.
Although the mephisto blog system contains a possibility to display a gravatar for a specific comment, I decided to do my own gravatar plugin, because I wanted to display gravatars not just on comments. You can download the first version from GitHub.
Installation is real simple. Just download it and put it into your vendor/plugins folder. After that, restart your server.
You may configure the following options in lib/mephisto_gravatar_plugin.rb:
default = 'identicon'
The guys at gravatar.com offer you three default avatars, in case there is no gravatar associated with that email address. Correct values for would be identicon, monsterid and wavatar.
rating = 'pg'
As you may know, all gravatars include a rating, done by the holder of the email. This rating may be one of the following: g, pg, r or x. To get only the gravatars you want, set the correct rating.
You can stuff any email into the filter, in order to get its gravatar. Sample usages:
{{ article.author.email | get_gravatar }}
{{ comment.author_email | get_gravatar, 30 }}
Note the object independence. An email address is all you need. You may deliver the desired size as an option to the filter. Leaving that out brings up the standard size of 80×80px.
There is still work to do. I think about pre-caching all gravatars for the registered bloggers. But that is subject to later exploration.