Subject: | spaces before X<> in title and X<> in para are not ignored |
Date: | Sun, 4 Aug 2013 11:59:13 +0200 |
To: | bug-Pod-Simple [...] rt.cpan.org |
From: | Patrice Dumas <pertusus [...] free.fr> |
Hello,
Here are 2 reports in one, with a fix for one report, but an issue still
remaining, with proposals for that issue.
First issue. get_title on:
=head1 NAME
X<Some entry>
Foo Bar - foobar manual
Do not return 'Foo Bar - foobar manual', because $head1_text_content is
'NAME '. If there are more X<> with spaces interspeded, as in
X<entry> X<other> more spaces accumulate.
There is more than one way to handle that issue:
* mark in some way spaces before X<> such that they are easy to ignore,
which means doing some changes in the pod simple parser
* l. 378, relax
if($head1_text_content eq $titlename
to something along
if($head1_text_content =~ /^$titlename_re\s*$/
* remove trailing spaces from $head1_text_content when
$token->is_tagname('X') and $token->is_start. For instance, line 374:
$head1_text_content =~ s/\s*$/ if $skipX;
Other issue. get_title on
=head1 NAME
X<Some I<entry>>
Foo Bar - foobar manual
X<Other entry>
do not return 'Foo Bar - foobar manual', as it does not ignore the X<>.
I have proposed a patch for that, simply reusing the code that ignores
X<> in head1. The result is not perfect, though, for the same reason as
above. Indeed, what is returned is 'Foo Bar - foobar manual ' with a
trailing space and not the expected 'Foo Bar - foobar manual'.
Similarly as above, I think that this could be solved in more than one
way.
* remove spaces at end of $para_text_content if $token->is_tagname('X')
and $token->is_start
* remove spaces at the end of the title
* do not care about those spaces
In the patch I attach, I have added test cases and ignoring X<> in title
para. If deemed useful, with further instructions on how to handle the
trailing spaces before X<> issue, I could propose an enhanced patch.
--
Pat
Message body is not shown because sender requested not to inline it.