Subject: | Tag attributes with a value of "0" are discarded |
Date: | Thu, 13 Sep 2007 18:29:11 +0200 |
To: | bug-HTML-WikiConverter [...] rt.cpan.org |
From: | Thierry Valentin <valentin [...] paradigmgeo.com> |
Dear maintainer,
I've got a the following problem with HTML-WikiConverter 0.61:
The following HTML text:
<table cellspacing="0" cellpadding="3" border="1">
<tr><td>Hello</td><td>Workd</td></tr>
</table>
Gives the following Mediawiki output:
{| border="1" cellpadding="3"
| Hello
| Workd
|}
=> The cellspacing attribute has been discarded.
I guess that the problem is the same with all attribute values that
evaluate to false in Perl.
The problem is in function HTML::WikiConverter::get_attr_str.
sub get_attr_str {
...
my $str = join ' ', map { $_.'="'.encode_entities($attrs{$_}).'"' }
grep { $attrs{$_} } @attrs;
...
}
The expression $attrs{$_} in the call to grep evaluates to false when
$attrs{$_} is "0",
and the attibute is discarded from the list.
The body of the grep should instead test if the value is defined(), as
shown below:
sub get_attr_str {
...
my $str = join ' ', map { $_.'="'.encode_entities($attrs{$_}).'"' }
grep { defined($attrs{$_}) } @attrs;
...
}
Thanks in advance to incorporate that fix in a next version.
--
Thierry Valentin
Engineering Support Team Lead
PARADIGM
78, Avenue du XXeme Corps
54000 Nancy
FRANCE
Phone: +33 (0)3-83-67-66-29
Fax: +33 (0)3-83-67-66-34
valentin@paradigmgeo.com
www.paradigmgeo.com
www.earthdecision.com
---------------------------------------------------------------------------------------------------------------
This e-mail, including any attached files, may contain confidential and privileged information for the sole use of the intended recipient. Any review, use, distribution, or disclosure by others is strictly prohibited. If you are not the intended recipient (or authorized to receive information for the intended recipient), please contact the sender by reply e-mail and delete all copies of this message.