Skip to main content.
home | support | download

Back to List Archive

Re: Proposed changes to pp2html.pm and XLtoHTML.pm

From: Peter Karman <peter(at)not-real.peknet.com>
Date: Wed May 11 2005 - 15:21:17 GMT
Thanks, Nick.

I updated pp2html.pm.

However, I notice in XLtoHTML.pm that the title is being set explicitly in
the get_xls_content_ref() method.

Maybe should do something like this instead there:

      # Here we gather up all the workbook metadata
-    my $ExcelFilename = encode_entities($oBook->{File});
+
+    my ($vol,$dirs,$filename) = File::Spec->splitpath( $oBook->{File} );
+    my $ExcelFilename = encode_entities( $filename );


I notice also that the pp2html.pm filter doesn't always encode entites properly, 
like XLtoHTML.pm does, but I don't see a clean way to do that, without writing 
some kind of get_pp_content() method to handle all the xlhtml output (yuck).

pek

Nick scribbled on 5/11/05 8:56 AM:
> I tried this in pp2html.pm and XLtoHTML.pm, and it appears to work just
> fine.  I would think it would be a good idea to provide this fix in the
> next release.
> 
> 
>>
>>Michael Peters scribbled on 5/10/05 7:49 PM:
>>
>>
>>>use File::Spec::splitpath() it's portable across OS'es, comes with Perl,
>>>and much better than trying to figure this out on your with a regex.
>>>
>>
>>thanks, Michael. I always forget about File::Spec.
>>
>>    my ( $self, $doc ) = @_;
>>    my $content = $self->run_ppthtml( $doc->fetch_filename ) || return;
>>
>># use just the file name as title with no path
>>    my ($title) = ( $content =~ m!<title>(.*?)</title>!io );
>>    my ($volume,$directories,$file) = File::Spec->splitpath( $title );
>>    $content =~ s,<title>.*?</title>,<title>$file</title>,i;
>>
>>    # update the document's content type
>>    $doc->set_content_type( 'text/html' );
>>    return \$content;
>>
>>
>>--
>>Peter Karman  .  http://peknet.com/  .  peter(at)not-real.peknet.com
>>

-- 
Peter Karman  .  http://peknet.com/  .  peter(at)not-real.peknet.com
Received on Wed May 11 08:21:18 2005