Skip Menu |

This queue is for tickets about the Tree-Simple-View CPAN distribution.

Report information
The Basics
Id: 121099
Status: resolved
Priority: 0/
Queue: Tree-Simple-View

People
Owner: Nobody in particular
Requestors: e.plicht [...] wimo.com
Cc: EKKIP [...] cpan.org
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Incorrect nesting of HTML list
Date: Thu, 13 Apr 2017 11:17:23 +0200
To: <bug-Tree-Simple-View [...] rt.cpan.org>
From: "Ekkehard Plicht" <e.plicht [...] wimo.com>
Hello, many thanks for providing the Tree::Simple::View::HTML module! Unfortunately it produces incorrectly nested output, not conforming to HTML5: <UL> <LI>1</LI> <UL> <LI>1.1</LI> <LI>1.2</LI> </UL> <LI>2</LI> <UL> <LI>2.1</LI> </UL> <LI>3</LI> </UL> Correct would be: <UL> <LI>1 <UL> <LI>1.1</LI> <LI>1.2</LI> </UL> </LI> <LI>2 <UL> <LI>2.1</LI> </UL> </LI> <LI>3</LI> </UL> see https://www.w3.org/wiki/HTML_lists#Nesting_lists Any chance of having a 'html5' option which changes the nesting to the correct form? Many thanks. Kind regards, Ekki
Subject: Re: [rt.cpan.org #121099] Incorrect nesting of HTML list
Date: Fri, 14 Apr 2017 10:05:57 +1000
To: bug-Tree-Simple-View [...] rt.cpan.org
From: Ron Savage <ron [...] savage.net.au>
Hi Ekki That should be fairly easy. I've made a note to do it this (long) weekend. On 13/04/17 19:25, Ekkehard Plicht via RT wrote: Show quoted text
> Thu Apr 13 05:25:57 2017: Request 121099 was acted upon. > Transaction: Ticket created by e.plicht@wimo.com > Queue: Tree-Simple-View > Subject: Incorrect nesting of HTML list > Broken in: (no value) > Severity: (no value) > Owner: Nobody > Requestors: e.plicht@wimo.com > Status: new > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=121099 > > > > Hello, > many thanks for providing the Tree::Simple::View::HTML module! > > Unfortunately it produces incorrectly nested output, not conforming to > HTML5: > > <UL> > <LI>1</LI> > <UL> > <LI>1.1</LI> > <LI>1.2</LI> > </UL> > <LI>2</LI> > <UL> > <LI>2.1</LI> > </UL> > <LI>3</LI> > </UL> > > > Correct would be: > > <UL> > <LI>1 > <UL> > <LI>1.1</LI> > <LI>1.2</LI> > </UL> > </LI> > <LI>2 > <UL> > <LI>2.1</LI> > </UL> > </LI> > <LI>3</LI> > </UL> > > see https://www.w3.org/wiki/HTML_lists#Nesting_lists > > > Any chance of having a 'html5' option which changes the nesting to the > correct form? > > Many thanks. > > Kind regards, > Ekki >
-- Ron Savage - savage.net.au
Subject: Re: [rt.cpan.org #121099] Incorrect nesting of HTML list
Date: Fri, 14 Apr 2017 11:57:15 +1000
To: bug-Tree-Simple-View [...] rt.cpan.org
From: Ron Savage <ron [...] savage.net.au>
Hi Ekki I've forked the repo from Mario Zieschang and modernized it. Now for the issue you've raised. On 14/04/17 10:06, ron@savage.net.au via RT wrote: Show quoted text
> Queue: Tree-Simple-View > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=121099 > > > Hi Ekki > > That should be fairly easy. I've made a note to do it this (long) weekend. > > On 13/04/17 19:25, Ekkehard Plicht via RT wrote:
>> Thu Apr 13 05:25:57 2017: Request 121099 was acted upon. >> Transaction: Ticket created by e.plicht@wimo.com >> Queue: Tree-Simple-View >> Subject: Incorrect nesting of HTML list >> Broken in: (no value) >> Severity: (no value) >> Owner: Nobody >> Requestors: e.plicht@wimo.com >> Status: new >> Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=121099 > >> >> >> Hello, >> many thanks for providing the Tree::Simple::View::HTML module! >> >> Unfortunately it produces incorrectly nested output, not conforming to >> HTML5: >> >> <UL> >> <LI>1</LI> >> <UL> >> <LI>1.1</LI> >> <LI>1.2</LI> >> </UL> >> <LI>2</LI> >> <UL> >> <LI>2.1</LI> >> </UL> >> <LI>3</LI> >> </UL> >> >> >> Correct would be: >> >> <UL> >> <LI>1 >> <UL> >> <LI>1.1</LI> >> <LI>1.2</LI> >> </UL> >> </LI> >> <LI>2 >> <UL> >> <LI>2.1</LI> >> </UL> >> </LI> >> <LI>3</LI> >> </UL> >> >> see https://www.w3.org/wiki/HTML_lists#Nesting_lists >> >> >> Any chance of having a 'html5' option which changes the nesting to the >> correct form? >> >> Many thanks. >> >> Kind regards, >> Ekki >>
>
-- Ron Savage - savage.net.au
Subject: Re: [rt.cpan.org #121099] Incorrect nesting of HTML list
Date: Sun, 16 Apr 2017 09:13:06 +1000
To: bug-Tree-Simple-View [...] rt.cpan.org
From: Ron Savage <ron [...] savage.net.au>
Hi Ekki Hmmm. Much more difficult than I was hoping. Still trying.... On 14/04/17 10:06, ron@savage.net.au via RT wrote: Show quoted text
> Queue: Tree-Simple-View > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=121099 > > > Hi Ekki > > That should be fairly easy. I've made a note to do it this (long) weekend. > > On 13/04/17 19:25, Ekkehard Plicht via RT wrote:
>> Thu Apr 13 05:25:57 2017: Request 121099 was acted upon. >> Transaction: Ticket created by e.plicht@wimo.com >> Queue: Tree-Simple-View >> Subject: Incorrect nesting of HTML list >> Broken in: (no value) >> Severity: (no value) >> Owner: Nobody >> Requestors: e.plicht@wimo.com >> Status: new >> Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=121099 > >> >> >> Hello, >> many thanks for providing the Tree::Simple::View::HTML module! >> >> Unfortunately it produces incorrectly nested output, not conforming to >> HTML5: >> >> <UL> >> <LI>1</LI> >> <UL> >> <LI>1.1</LI> >> <LI>1.2</LI> >> </UL> >> <LI>2</LI> >> <UL> >> <LI>2.1</LI> >> </UL> >> <LI>3</LI> >> </UL> >> >> >> Correct would be: >> >> <UL> >> <LI>1 >> <UL> >> <LI>1.1</LI> >> <LI>1.2</LI> >> </UL> >> </LI> >> <LI>2 >> <UL> >> <LI>2.1</LI> >> </UL> >> </LI> >> <LI>3</LI> >> </UL> >> >> see https://www.w3.org/wiki/HTML_lists#Nesting_lists >> >> >> Any chance of having a 'html5' option which changes the nesting to the >> correct form? >> >> Many thanks. >> >> Kind regards, >> Ekki >>
>
-- Ron Savage - savage.net.au
Subject: RE: [rt.cpan.org #121099] Incorrect nesting of HTML list
Date: Sun, 16 Apr 2017 09:22:21 +0200
To: <bug-Tree-Simple-View [...] rt.cpan.org>
From: "Ekkehard Plicht" <e.plicht [...] wimo.com>
Hello Ron, thanks for the information. Here is how I helped myself until you will come up with a proper solution. Maybe it is helpful in some way. Unfortunately I do not know how to correctly submit a patch, and I don't think it's production ready code quality anyways. Kind regards, Ekki 1. I extended Tree::Simple with three more predicate methods, which might be handy in other situations as well: sub getSiblingsCount { my $siblings; return scalar( @{ $siblings = $_[0]->getAllSiblings } ); }; sub isFirstChild { $_[0]->getIndex == 0 }; sub isLastChild { my $self = shift; if ( $self->getIndex == ($self->getSiblingsCount -1) ) { return 1; } else { return 0; } }; 2. With that the traverse to generate a correctly nested <ul> list becomes: my $treestring; $tree->traverse( sub { my $t = shift; if ($t->isFirstChild) { $treestring .= "\n" . ' ' x $t->getDepth() . "<ul>\n"; }; $treestring .= ' ' x $t->getDepth(); $treestring .= '<li>' . $t->getNodeValue(); }, sub { my $t = shift; $treestring .= "</li>\n"; if ($t->isLastChild) { $treestring .= ' ' x $t->getDepth() . "</ul>\n"; }; } ); Show quoted text
> -----Original Message----- > From: ron@savage.net.au via RT [mailto:bug-Tree-Simple-View@rt.cpan.org] > Sent: Sunday, April 16, 2017 1:13 AM > To: e.plicht@wimo.com > Cc: EKKIP@cpan.org > Subject: Re: [rt.cpan.org #121099] Incorrect nesting of HTML list > > > <URL: https://rt.cpan.org/Ticket/Display.html?id=121099 > > > Hi Ekki > > Hmmm. Much more difficult than I was hoping. Still trying.... > > On 14/04/17 10:06, ron@savage.net.au via RT wrote:
> > Queue: Tree-Simple-View > > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=121099 > > > > > Hi Ekki > > > > That should be fairly easy. I've made a note to do it this
> (long) weekend.
> > > > On 13/04/17 19:25, Ekkehard Plicht via RT wrote:
> >> Thu Apr 13 05:25:57 2017: Request 121099 was acted upon. > >> Transaction: Ticket created by e.plicht@wimo.com > >> Queue: Tree-Simple-View > >> Subject: Incorrect nesting of HTML list > >> Broken in: (no value) > >> Severity: (no value) > >> Owner: Nobody > >> Requestors: e.plicht@wimo.com > >> Status: new > >> Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=121099 > > >> > >> > >> Hello, > >> many thanks for providing the Tree::Simple::View::HTML module! > >> > >> Unfortunately it produces incorrectly nested output, not conforming to > >> HTML5: > >> > >> <UL> > >> <LI>1</LI> > >> <UL> > >> <LI>1.1</LI> > >> <LI>1.2</LI> > >> </UL> > >> <LI>2</LI> > >> <UL> > >> <LI>2.1</LI> > >> </UL> > >> <LI>3</LI> > >> </UL> > >> > >> > >> Correct would be: > >> > >> <UL> > >> <LI>1 > >> <UL> > >> <LI>1.1</LI> > >> <LI>1.2</LI> > >> </UL> > >> </LI> > >> <LI>2 > >> <UL> > >> <LI>2.1</LI> > >> </UL> > >> </LI> > >> <LI>3</LI> > >> </UL> > >> > >> see https://www.w3.org/wiki/HTML_lists#Nesting_lists > >> > >> > >> Any chance of having a 'html5' option which changes the nesting to the > >> correct form? > >> > >> Many thanks. > >> > >> Kind regards, > >> Ekki > >>
> >
> > -- > Ron Savage - savage.net.au >
Subject: Re: [rt.cpan.org #121099] Incorrect nesting of HTML list
Date: Sun, 16 Apr 2017 18:18:06 +1000
To: bug-Tree-Simple-View [...] rt.cpan.org
From: Ron Savage <ron [...] savage.net.au>
Hi Ekki Very clever. I did not think of that. I'm trying to use a stack. Tomorrow (it's 18:18 here now in Mebourne) I'll study your code more deeply. Thanx! On 16/04/17 17:22, Ekkehard Plicht via RT wrote: Show quoted text
> Queue: Tree-Simple-View > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=121099 > > > Hello Ron, > thanks for the information. > > Here is how I helped myself until you will come up with a proper solution. Maybe it is helpful in some way. Unfortunately I do not know how to correctly submit a patch, and I don't think it's production ready code quality anyways. > > Kind regards, > Ekki > > > > > 1. I extended Tree::Simple with three more predicate methods, which might be handy in other situations as well: > > > sub getSiblingsCount { > my $siblings; > return scalar( @{ $siblings = $_[0]->getAllSiblings } ); > }; > > sub isFirstChild { > $_[0]->getIndex == 0 > }; > > sub isLastChild { > my $self = shift; > if ( $self->getIndex == ($self->getSiblingsCount -1) ) { > return 1; > } > else { > return 0; > } > }; > > > 2. With that the traverse to generate a correctly nested <ul> list becomes: > > my $treestring; > $tree->traverse( > sub { > my $t = shift; > if ($t->isFirstChild) { > $treestring .= "\n" . ' ' x $t->getDepth() . "<ul>\n"; > }; > $treestring .= ' ' x $t->getDepth(); > $treestring .= '<li>' . $t->getNodeValue(); > }, > sub { > my $t = shift; > $treestring .= "</li>\n"; > if ($t->isLastChild) { > $treestring .= ' ' x $t->getDepth() . "</ul>\n"; > }; > > } > ); > > > > >
>> -----Original Message----- >> From: ron@savage.net.au via RT [mailto:bug-Tree-Simple-View@rt.cpan.org] >> Sent: Sunday, April 16, 2017 1:13 AM >> To: e.plicht@wimo.com >> Cc: EKKIP@cpan.org >> Subject: Re: [rt.cpan.org #121099] Incorrect nesting of HTML list >> >> >> <URL: https://rt.cpan.org/Ticket/Display.html?id=121099 > >> >> Hi Ekki >> >> Hmmm. Much more difficult than I was hoping. Still trying.... >> >> On 14/04/17 10:06, ron@savage.net.au via RT wrote:
>>> Queue: Tree-Simple-View >>> Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=121099 > >>> >>> Hi Ekki >>> >>> That should be fairly easy. I've made a note to do it this
>> (long) weekend.
>>> >>> On 13/04/17 19:25, Ekkehard Plicht via RT wrote:
>>>> Thu Apr 13 05:25:57 2017: Request 121099 was acted upon. >>>> Transaction: Ticket created by e.plicht@wimo.com >>>> Queue: Tree-Simple-View >>>> Subject: Incorrect nesting of HTML list >>>> Broken in: (no value) >>>> Severity: (no value) >>>> Owner: Nobody >>>> Requestors: e.plicht@wimo.com >>>> Status: new >>>> Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=121099 > >>>> >>>> >>>> Hello, >>>> many thanks for providing the Tree::Simple::View::HTML module! >>>> >>>> Unfortunately it produces incorrectly nested output, not conforming to >>>> HTML5: >>>> >>>> <UL> >>>> <LI>1</LI> >>>> <UL> >>>> <LI>1.1</LI> >>>> <LI>1.2</LI> >>>> </UL> >>>> <LI>2</LI> >>>> <UL> >>>> <LI>2.1</LI> >>>> </UL> >>>> <LI>3</LI> >>>> </UL> >>>> >>>> >>>> Correct would be: >>>> >>>> <UL> >>>> <LI>1 >>>> <UL> >>>> <LI>1.1</LI> >>>> <LI>1.2</LI> >>>> </UL> >>>> </LI> >>>> <LI>2 >>>> <UL> >>>> <LI>2.1</LI> >>>> </UL> >>>> </LI> >>>> <LI>3</LI> >>>> </UL> >>>> >>>> see https://www.w3.org/wiki/HTML_lists#Nesting_lists >>>> >>>> >>>> Any chance of having a 'html5' option which changes the nesting to the >>>> correct form? >>>> >>>> Many thanks. >>>> >>>> Kind regards, >>>> Ekki >>>>
>>>
>> >> -- >> Ron Savage - savage.net.au >>
-- Ron Savage - savage.net.au
See V 0.19, which is now on CPAN. Note: This version requires Tree::Simple V 1.31.