[WM] Text::Textile and WebMake
Wes Meltzer
ithildin at teleport.com
Thu Nov 20 22:02:01 GMT 2003
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."
More information about the Webmake-talk
mailing list