[WM] Text::Textile and WebMake

Matt Okeson-Harlow mharlow at grephead.com
Thu Nov 20 22:19:01 GMT 2003


actually... not sure if it is bugs or "undocumented featuers"

the Text::Textile CPAN module is based on the module written by Brad Choate
http://www.bradchoate.com/tools/textile/

it could also be that my understanding of some of the rules for Textile are a little off...
(there is not THAT much documentation for it)

i have just found that the behavior between the CPAN Text::Textile, BC Text::Textile and
http://textism.com/tools/textile on the same sample text is not consistant.

i installed the Text::Textile plugin from CPAN and then switched to using the one from Brad Choate, it seemed to work
a bit better.

also, it appears that Text::Textile wants you to already have done any header information, as the first thing it does
is stick a <p> in the output, while this has not caused any problems for me yet, it does bother me a bit...

appears to be working ok with me, let me know if you have any questions...

On Thu, Nov 20, 2003 at 04:06:13PM -0800, Wes Meltzer wrote:
> Thanks, everybody! I wish I could have done this myself. Since I don't really want to send two replies, Matt, what kind of bugs are there in Text::Textile?
> 
> Thanks again!
> 
> --Wes :wm
> 
> Justin Mason wrote, on Thursday, November 20, 2003 at 11:47 AM -0800:
> 
> >-----BEGIN PGP SIGNED MESSAGE-----
> >Hash: SHA1
> >
> >
> >webmake at technomage.net writes:
> >>+  $self->add_converter ('text/tt', 'text/html',
> >>+                       'Text::Textile', \&tt_to_html);
> >
> >Thanks everyone ;) who added support for it -- that's now in CVS.
> >I made a minor change to ensure that it'd work OK for folks who
> >don't have Text::Textile installed, by putting the module 'require'
> >into an eval { } block.  Updated patch below...
> >
> >- --j.
> >
> >diff -u -3 -p -r1.17 FormatConvert.pm
> >- --- lib/HTML/WebMake/FormatConvert.pm   26 Nov 2001 07:01:38 -0000      1.17
> >+++ lib/HTML/WebMake/FormatConvert.pm   20 Nov 2003 19:45:48 -0000
> >@@ -23,6 +23,9 @@ package HTML::WebMake::FormatConvert;
> > sub set_converters {
> >   my $self = shift;
> > 
> >+  $self->add_converter ('text/tt', 'text/html',
> >+                       'Text::Textile', \&tt_to_html);
> >+
> >   $self->add_converter ('text/et', 'text/html',
> >                        'Text::EtText::EtText2HTML', \&et_to_html);
> > 
> >@@ -189,6 +192,26 @@ sub et_to_html {
> > 
> >   $self->{ettext}->text2html ($txt);
> > }
> > }
> >+
> >+# -------------------------------------------------------------------------
> >+# textile stuff
> >+
> >+sub tt_to_html
> >+{
> >+  my ($self,$contobj,$txt) = @_;
> >+
> >+  if (!defined $self->{textile}) {
> >+    eval {
> >+      require Text::Textile;
> >+      $self->{textile} = new Text::Textile;
> >+      1;
> >+    } or die "FormatConvert: cannot create Text::Textile object: $!";
> >+  }
> >+
> >+  $self = $self->{textile}->process($txt);
> >+  return $self;
> >+}
> >+
> > 
> > # -------------------------------------------------------------------------
> > 
> >
> >-----BEGIN PGP SIGNATURE-----
> >Version: GnuPG v1.2.2 (GNU/Linux)
> >Comment: Exmh CVS
> >
> >iD8DBQE/vRpeQTcbUG5Y7woRAodTAKDdCNJoBitAAzxZOf/ivnst4ecs5QCg6vFV
> >/q3Ro/MDCGF15SwHx02SwJg=
> >=ukzb
> >-----END PGP SIGNATURE-----
> >
> >_______________________________________________
> >Webmake-talk mailing list
> >Webmake-talk at taint.org
> >http://webmake.taint.org/mailman/listinfo/webmake-talk
> --
> Wes Meltzer <ithildin at teleport.com>
> http://www.magnesium.net/~gregsamsa/
> "Even the smallest person can change the course of the future."
> _______________________________________________
> Webmake-talk mailing list
> Webmake-talk at taint.org
> http://webmake.taint.org/mailman/listinfo/webmake-talk

-- 
matt okeson-harlow
mharlow at grephead dot com



More information about the Webmake-talk mailing list