Raku / old-issue-tracker

Tickets from RT
https://github.com/Raku/old-issue-tracker/issues
2 stars 1 forks source link

empty strings in .contents with single formatting code #4891

Open p6rt opened 8 years ago

p6rt commented 8 years ago

Migrated from rt.perl.org#126966 (status was 'open')

Searchable as RT126966$

p6rt commented 8 years ago

From @LLFourn

=pod C\

say $=pod[0].contents[0].contents.perl;

["", Pod​::FormattingCode.new(type => "C", meta => [], config => {}, contents => ["foo"]), ""]

It should be a single FormattingCode. This is a non-trivial bug to me because it makes pod introspection more arduous. If you want to check for a single special formatting code you have to make sure there are "" either side of it.

for example, we do this in perl6/doc already​: https://github.com/perl6/doc/blob/master/htmlify.p6#L379

I think we should fix it to avoid more things depending on this behaviour.

There are a couple of tests that seem to spec the incorrect behaviour​: https://github.com/perl6/roast/blob/master/S26-documentation/08-formattingcodes.t#L9

I am going to try and fix this one unless there are any objections?

p6rt commented 8 years ago

From @lizmat

On 19 Dec 2015, at 13​:38, Lloyd Fournier (via RT) \perl6\-bugs\-followup@​perl\.org wrote​:

# New Ticket Created by Lloyd Fournier # Please include the string​: [perl #​126966] # in the subject line of all future correspondence about this issue. # \<URL​: https://rt-archive.perl.org/perl6/Ticket/Display.html?id=126966 >

=pod C\

say $=pod[0].contents[0].contents.perl;

["", Pod​::FormattingCode.new(type => "C", meta => [], config => {}, contents => ["foo"]), ""]

It should be a single FormattingCode. This is a non-trivial bug to me because it makes pod introspection more arduous. If you want to check for a single special formatting code you have to make sure there are "" either side of it.

for example, we do this in perl6/doc already​: https://github.com/perl6/doc/blob/master/htmlify.p6#L379

I think we should fix it to avoid more things depending on this behaviour.

There are a couple of tests that seem to spec the incorrect behaviour​: https://github.com/perl6/roast/blob/master/S26-documentation/08-formattingcodes.t#L9

I am going to try and fix this one unless there are any objections?

Looking forward to the PR :-)

Liz

p6rt commented 8 years ago

The RT System itself - Status changed from 'new' to 'open'

p6rt commented 8 years ago

From @LLFourn

Looks like Pod​::To​::HTML also has to deal with this bug/feature. Looking at it maybe the "twine" implementor thought that this was a good optimization as you can pair iterate. If it's a massive speed saver then I guess I reconsider this.

https://github.com/perl6/Pod-To-HTML/blob/master/lib/Pod/To/HTML.pm#L246

On Sat, Dec 19, 2015 at 11​:51 PM Elizabeth Mattijsen via RT \< perl6-bugs-followup@​perl.org> wrote​:

On 19 Dec 2015, at 13​:38, Lloyd Fournier (via RT) \< perl6-bugs-followup@​perl.org> wrote​:

# New Ticket Created by Lloyd Fournier # Please include the string​: [perl #​126966] # in the subject line of all future correspondence about this issue. # \<URL​: https://rt-archive.perl.org/perl6/Ticket/Display.html?id=126966 >

=pod C\

say $=pod[0].contents[0].contents.perl;

["", Pod​::FormattingCode.new(type => "C", meta => [], config => {}, contents => ["foo"]), ""]

It should be a single FormattingCode. This is a non-trivial bug to me because it makes pod introspection more arduous. If you want to check for a single special formatting code you have to make sure there are "" either side of it.

for example, we do this in perl6/doc already​: https://github.com/perl6/doc/blob/master/htmlify.p6#L379

I think we should fix it to avoid more things depending on this behaviour.

There are a couple of tests that seem to spec the incorrect behaviour​:

https://github.com/perl6/roast/blob/master/S26-documentation/08-formattingcodes.t#L9

I am going to try and fix this one unless there are any objections?

Looking forward to the PR :-)

Liz