March 09, 2006 Archives

Thu Mar 9 21:44:44 NZDT 2006

Textile?

I don't like Markdown (at least, the way it's done through nanoblogger), not least because I can't see any difference between a code block that works, and one that doesn't.

Plus, by default, stars around a word don't translate to “bold” ;-)

So, I've installed RedCloth into Ruby, and after hacking a one-line filter I'm trying to get nanoblogger to use Textile instead of Markdown. I'll probably have to edit my old articles, but there aren't many!

Textile has “nice” quotes, … ellipsis, 2×4 dimensions, trademark(TM), registered(R), copyright(C) markers, en - em-dashes – and a few other goodies. RedCloth has a few bugs, but workarounds are not too onerous.

See Installing Textile for more info.


Posted by Jim Cheetham | Permanent Link

Thu Mar 9 11:31:32 NZDT 2006

The syntax battle ...

So much of the Rails tutorial stuff is based around the “simple” examples of scaffold, that subtleties in the language syntax are missed out …

Here's what scaffold in Rails 1.0 produces for a form :-

    <%= start_form_tag :action => 'create' %>

In text descriptions of “how to do form upload”, we're told to add :multipart ⇒ true to the start_form_tag.

If we look at the Rails API for start_form_tag, we see a couple of extra options – one of which is essential for file upload forms, the :multipart

    start_form_tag(url_for_options = {}, options = {}, *parameters_for_url)

What is very unclear at this stage, is that in order to add the :multipart option to the tag, you must now introduce () and {} syntax that was previously optional and therefore missing from the scaffold code generation.

    <% start_form_tag ({:action => 'create'}, {:multipart => true}) %>

This has recently been described on the Rails list as the “WTF!!” stage of grokking Ruby syntax.

Enjoy :-)


Posted by Jim Cheetham | Permanent Link