• Do not register here on develop.twiki.org, login with your twiki.org account.
• Use View topic Item7848 for generic doc work for TWiki-6.1.1. Use View topic Item7851 for doc work on extensions that are not part of a release. More... Close
• Anything you create or change in standard webs (Main, TWiki, Sandbox etc) will be automatically reverted on every SVN update.
Does this site look broken?. Use the LitterTray web for test cases.

Item6157: GenPDF doesn't output all images

Item Form Data

AppliesTo: Component: Priority: CurrentState: WaitingFor: TargetRelease ReleasedIn
Extension GenPDFAddOn Normal New   n/a  

Edit Form Data

Summary:
Reported By:
Codebase:
Applies To:
Component:
Priority:
Current State:
Waiting For:
Target Release:
Released In:
 

Detail

GenPDF doesn't output images - sometimes.

Turns out that it doesn't tolerate src and href with single quotes. Other things don't tolerate them with double.

Fix is in GenPDF.pm

--- GenPDF.pm.base      2008-10-31 15:53:43.000000000 -0400
+++ GenPDF.pm   2008-12-23 17:41:49.000000000 -0500
@@ -288,14 +288,14 @@
    # certificates.
    # Fully qualify any unqualified URLs (to make it portable to another host)
    my $url = TWiki::Func::getUrlHost();
    my $pdir = TWiki::Func::getPubDir();
    my $purlp = TWiki::Func::getPubUrlPath();
-   $text =~ s!<img(.*?) src="($url)?$purlp!<img$1 src="$pdir\/!sgi;
-   $text =~ s/<a(.*?) href="(?!#)\//<a$1 href="$url\//sgi;
+   $text =~ s!<img(.*?) src=(["'])($url)?$purlp!<img$1 src=$2$pdir\/!sgi;
+   $text =~ s/<a(.*?) href=(['"])(?!#)\//<a$1 href=$2$url\//sgi;
    # Save it to a file
    my ($fh, $name) = tempfile('GenPDFAddOnXXXXXXXXXX',
                                DIR => File::Spec->tmpdir(),
                               SUFFIX => '.html');
    open $fh, ">$name";
@@ -411,14 +411,14 @@
    # images.  Needed if wiki requires authentication like SSL client certifcates.
    # Fully qualify any unqualified URLs (to make it portable to another host)
    my $url = TWiki::Func::getUrlHost();
    my $pdir = TWiki::Func::getPubDir();
    my $purlp = TWiki::Func::getPubUrlPath();
-   $html =~ s!<img(.*?) src="($url)?$purlp!<img$1 src="$pdir\/!gi;
-   $html =~ s/<a(.*?) href="\//<a$1 href="$url\//gi;
+   $html =~ s!<img(.*?) src=(["'])($url)?$purlp!<img$1 src=$2$pdir\/!gi;
+   $html =~ s/<a(.*?) href=(['"])\//<a$1 href=$2$url\//gi;
    # link internally if we include the topic
    for my $wikiword (@$refTopics) {
       $url = TWiki::Func::getScriptUrl($webName, $wikiword, 'view');
       $html =~ s/([\'\"])$url/$1#$wikiword/g; # not anchored
       $html =~ s/$url(#\w*)/$1/g; # anchored
    }

-- TWiki:Main/TimotheLitt - 23 Dec 2008

ItemTemplate
Summary GenPDF doesn't output all images
ReportedBy TWiki:Main.TimotheLitt
Codebase

SVN Range TWiki-5.0.0, Wed, 22 Oct 2008, build 17677
AppliesTo Extension
Component GenPDFAddOn
Priority Normal
CurrentState New
WaitingFor

Checkins

TargetRelease n/a
ReleasedIn

Topic revision: r1 - 2008-12-23 - TimotheLitt
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2018 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback