Package: igal Version: 1.4-14 Severity: wishlist Tags: patch Today I detected that HTML is allowed in the .captions file. That's nice (for the captions beneath the slides at large) but I stumbled over two problems: * s/&/&/ breaks any HTML entitites used in the captions. * the captions are used for the page <TITLE>, for the alt/title attributes of <IMG>, <LINK>, the next/prev-links etc. - HTML makes no sense there or even contradicts HTML standards. Find attached my patch that * comments out the &-substitutions. * introduces @captions_stripped containing captions without HTML tags by using a function called striphtml.
For the latter I used HTML::Scrubber; if you adopt the patch, the package must therefore Depends: on libhtml-scrubber-perl. Greetings, gregor -- System Information: Debian Release: testing/unstable APT prefers testing APT policy: (990, 'testing'), (500, 'unstable'), (500, 'stable') Architecture: i386 (i686) Shell: /bin/sh linked to /bin/bash Kernel: Linux 2.4.31.20050730 Locale: LANG=C, [EMAIL PROTECTED] (charmap=ISO-8859-15) Versions of packages igal depends on: ii imagemagick 6:6.2.4.5-0.2 Image manipulation programs ii libimage-size-perl 2.992-2 determine the size of images in se ii liburi-perl 1.35-1 Manipulates and accesses URI strin ii perl 5.8.7-9 Larry Wall's Practical Extraction igal recommends no packages. -- no debconf information
--- /usr/bin/igal.orig 2005-11-01 13:28:53.000000000 +0100 +++ /usr/bin/igal 2006-01-06 02:00:22.000000000 +0100 @@ -57,2 +57,7 @@ +# updated by gregor herrmann <[EMAIL PROTECTED]> 2006 +# * comment out substition of & by & (breaks HTML entities in captions) +# * stripped HTML from $title, $altname, etc. (taking the unmodified captions is +# not useful or not allowed if HTML is used in captions; using HTML::Scrubber) + # this is az's local RCS version info: $Id: igal,v 1.24 2005/11/01 12:26:53 az Exp $ @@ -63,2 +68,3 @@ use URI::Escape; +use HTML::Scrubber; @@ -223,3 +229,3 @@ # Store image extensions, fix problematic filenames and complain [EMAIL PROTECTED] = (); @captions = (); [EMAIL PROTECTED] = (); @captions = (); @captions_stripped = (); my @safenames; @@ -247,2 +253,3 @@ push(@captions, $1); + push(@captions_stripped, striphtml($1)); push(@imgnames, $1); @@ -274,3 +281,3 @@ @safenames = (); - @captions = (); @imgext = (); $njpg = 0; + @captions = (); @captions_stripped = (); @imgext = (); $njpg = 0; print "Reading the $captionfile file ... "; @@ -289,2 +296,3 @@ push(@captions,$arr[1]); + push(@captions_stripped,striphtml($arr[1])); $njpg++ if ($arr[0] =~ m/jpe?g/i); @@ -478,3 +486,3 @@ if ($opt_k) { # use image caption for the HTML slide title - $title = $captions[$i]; + $title = $captions_stripped[$i]; } else { # otherwise use the image name (strip suffix) @@ -483,3 +491,4 @@ } - $title=~s/&/&/g; $title=~s/"/&\#34;/g; # " make this attribute-safe + # $title=~s/&/&/g; + $title=~s/"/&\#34;/g; # " make this attribute-safe my @[EMAIL PROTECTED]; # don't touch the original template @@ -527,4 +536,4 @@ { - $prev=$captions[$i-1]; - $next=$captions[($i==$nfiles-1?0:$i+1)]; + $prev=$captions_stripped[$i-1]; + $next=$captions_stripped[($i==$nfiles-1?0:$i+1)]; } @@ -536,4 +545,6 @@ - $prev=~s/&/&/g; $prev=~s/"/&\#34;/g; # " make this attribute-safe - $next=~s/&/&/g; $next=~s/"/&\#34;/g; # " make this attribute-safe + # $prev=~s/&/&/g; + $prev=~s/"/&\#34;/g; # " make this attribute-safe + # $next=~s/&/&/g; + $next=~s/"/&\#34;/g; # " make this attribute-safe } @@ -647,3 +658,3 @@ if ($opt_k) { # use image caption for the alt attribute - $altname = $captions[$i+$j]; + $altname = $captions_stripped[$i+$j]; } else { # otherwise use the image name (strip suffix) @@ -653,3 +664,4 @@ - $altname=~s/&/&/g; $altname=~s/"/&\#34;/g; # " make this attribute-safe + #$altname=~s/&/&/g; + $altname=~s/"/&\#34;/g; # " make this attribute-safe $thumb = $thumbprefix . $safenames[$i+$j]; @@ -746 +758,7 @@ } + +sub striphtml { + local($html) = @_; + my $scrubber = HTML::Scrubber->new(default=>0); + return $scrubber->scrub($html); +}