On Mon, Jan 31, 2005 at 12:09:45PM -0800, Randal L. Schwartz wrote:
> No, *you* need to worry about it. If your filename is
>
> face of "fred".gif
>
> Then you need to URI-encode that to get
>
> face%20of%20"fred".gif
>
> and then *that* needs to be HTMLized to get:
>
> face%20of%20"fred".gif
I was wondering about that, as I was only calling the uri filter as it
seems like uri deals with the quotes:
use Template;
Template->new->process(\*DATA, {});
__DATA__
[% 'face of "fred".gif' | uri %]
$ perl t.pl
face%20of%20%22fred%22.gif
I'm actually working with Pod::POM
The code below takes this:
<Text|fre d%20flin"tst"one.txt/"REQUIREMENTS">
And generates:
<a href="fre%20d%2520flin%22tst%22one.txt.html#REQUIREMENTS">Text</a>
#!/usr/bin/perl -w
use strict;
use Pod::POM;
use Pod::POM::View::HTML;
use Template::Filters;
my $text = <<EOF;
=head HEAD TEXT
this text L<Text|fre d%20flin"tst"one.txt/"REQUIREMENTS">
EOF
my $pom = Pod::POM->new->parse_text( $text );
print My::Pod::View::HTML->print( $pom );
package My::Pod::View::HTML;
use strict;
use warnings;
use base 'Pod::POM::View::HTML';
sub view_seq_link_transform_path {
my ( $self, $link ) = @_;
return $self->escape_uri($link) . '.html';
}
# Returns $text as uri-escaped string
sub escape_uri {
my ($self, $text) = @_;
$text =~ s/\n/ /g;
return Template::Filters::uri_filter( $text );
}
1;
--
Bill Moseley
[EMAIL PROTECTED]
_______________________________________________
templates mailing list
[email protected]
http://lists.template-toolkit.org/mailman/listinfo/templates