cuberat / Pod-POM-View-Restructured

CPAN module Pod::POM::View::Restructured
1 stars 2 forks source link

B<foo>\nbar is converted incorrectly #13

Open ole-tange opened 3 years ago

ole-tange commented 3 years ago
B<foo>                              
bar

This eats the space between foo and bar.

alexm commented 3 years ago

Okay, I think I figured out why is this happening: the code, bold, italic and file sequences are always adding a quoted space before and after the RST markup in order to assure that it can be used inside words. Like these examples:

=pod

fooB<bar>

B<foo>bar

foB<ob>ar

B<foo>
bar

=cut

But in the last example, it does not work as expected because the RST parser eats also the LF following the quoted space, .i.e. currently the code produces this RST:


foo\ **bar**\ 

\ **foo**\ bar

fo\ **ob**\ ar

\ **foo**\ 
bar

Which does not work as expected in the last example. The rst2html command produces:

...
<p>foo<strong>bar</strong></p>
<p><strong>foo</strong>bar</p>
<p>fo<strong>ob</strong>ar</p>
<p><strong>foo</strong>bar</p>
...

However, if the code could produce this RST output, it would work fine:

\ **foo**
bar

Would render:

<p><strong>foo</strong>
bar</p>

Now the challenge is to find a way to skip adding the quoted spaces after a sequence unless necessary. And given the way the parser works, it does not seem an easy task.