Subject: | <img> conversions do not leave space after inserting src |
Date: | Fri, 21 Sep 2012 06:18:57 -0500 |
To: | bug-HTML-WikiConverter-PmWiki [...] rt.cpan.org |
From: | Tamara Temple <tamara [...] tamaratemple.com> |
The conversion of img tags inserts the src attribute, but if the img
tag butts up against whatever comes before or after, no space is
inserted, which renders the image unusable without further editing.
Patch:
152c152
< return $node->attr('src') || '';
---
Show quoted text
> return ' ' . ($node->attr('src') || '') . ' ' ;
Example:
HTML input: testfiles/wctest.html:
<p>This is how the<img src="http://www.example.com/image.jpg">butts up
on both sides.</p>
<p>This is how the<img>butts up if no src attribute is given</p>
<p><img src="http://www.example.com/image.jpg">This is how it goes at
the beginning of the line.</p>
<p>This is how it goes at the end of the line<img
src="http://www.example.com/image.jpg"></p>
Before patch applied:
$ perl -MHTML::WikiConverter -e '@in = <STDIN>;$html =
join("",@in);$wc=new
HTML::WikiConverter(dialect=>"PmWiki2");printf("%s\n\n",
$wc->html2wiki($html));' < testfiles/wctest.html
This is how thehttp://www.example.com/image.jpg butts up on both sides.
This is how the butts up if no src attribute is given
http://www.example.com/image.jpg This is how it goes at the beginning
of the line.
This is how it goes at the end of the linehttp://www.example.com/image.jpg
After patch applied:
$ perl -MHTML::WikiConverter -e '@in = <STDIN>;$html =
join("",@in);$wc=new
HTML::WikiConverter(dialect=>"PmWiki2");printf("%s\n\n",
$wc->html2wiki($html));' < testfiles/wctest.html
This is how the http://www.example.com/image.jpg butts up on both sides.
This is how the butts up if no src attribute is given
http://www.example.com/image.jpg This is how it goes at the beginning
of the line.
This is how it goes at the end of the line http://www.example.com/image.jpg
Perl version: v5.10.1
Linux version: Linux caesar 2.6.38-15-generic #66-Ubuntu SMP Tue Aug
14 17:25:35 UTC 2012 i686 i686 i386 GNU/Linux
Module id = HTML::WikiConverter::PmWiki
CPAN_USERID DIBERRI (David Iberri <diberri@cpan.org>)
CPAN_VERSION 0.51
CPAN_FILE D/DI/DIBERRI/HTML-WikiConverter-PmWiki-0.51.tar.gz
MANPAGE HTML::WikiConverter::PmWiki - Convert HTML to PmWiki markup
INST_FILE /usr/local/share/perl/5.10.1/HTML/WikiConverter/PmWiki.pm
INST_VERSION 0.51
--
Tamara Temple
aka tamouse__
"May you never see a stranger's face in the mirror."