[ic] Textile filter tip

Joshua Lavin joshua at kingdomdesign.com
Fri Jun 25 13:50:55 EDT 2004


Textile allows shorthand for common HTML formatting. I am using it to 
allow easy entry of item details.

Example:
Entered into item's comment field >>>

The most _wonderful_ book ever written.

* 186 pages
* paperback

<<< becomes this when called with [filter textile][item-field 
comment][/filter]: >>>

The most <em>wonderful</em> book ever written.

<ul>
  <li>186 pages</li>
  <li>paperback</li>
</ul>

<<<

There are more shorthand tricks (see the Perl module's documentation). 
To add a Textile filter, follow these steps:

1. Install the Text::Textile CPAN module.
    ( http://search.cpan.org/~tomi/Text-Textile-0.6/ )

2. Add the following GlobalSub at the end of interchange.cfg:

# Textile filter:

GlobalSub <<EOR
sub textile {
     BEGIN {
         package Vend::Interpolate;
         use Text::Textile;
         $Filter{textile} = sub {
                                 my $textile = new Text::Textile;
                                 my $val = $textile->process(shift);
                                 return $val;
                                };
     }
}
EOR

3. Restart Interchange.

This is my first try at a new filter; comments welcome.

--
Josh Lavin
Kingdom Design   http://www.kdw.us/



More information about the interchange-users mailing list