Front page | perl.perlpoint | Postings from March 2002

## Re: Bug Report (sublists in pp2latex)

From:
Robert Inder
Date:
March 19, 2002 05:55
Subject:
Re: Bug Report (sublists in pp2latex)
Message ID:
f511yegoe3p.fsf@auk.3lg.org

>>>>> lorenz  writes:
> Date: Tue, 19 Mar 2002 11:20:46 +0100
> To: perlpoint@perl.org
> Subject: Re: Bug Report (sublists in pp2latex)

:

> It works for simple lists, but you get into trouble with nested
> lists, especially if the last list item is not on top level, for
> example a list like

>    * Item 1 of outer list
>    * Item 2 of outer list
>      o  item one of inner list
>      o  item two of inner list (and that's it!)

> In HTML this woud be implemented as

>    <ul>
>    <li> Item 1 of outer list
>    <li> Item 2 of outer list
>      <ul>
>      <li>  item one of inner list
>      <li>  item two of inner list (and that's it!)
>      </ul>
>    </ul>

> The problem is, as you pointed out, that the parser does not allow
> a <  (shift back) at the end of a list.

I think that is only the SECONDARY problem.

The primary problem is that the parser reports an end-of-list
when it finds the ">", and everything after that is just trying
to minimise the consequences of this mistake!  So although
you give the HTML for how your example SHOULD be done in HTML,
it is ACTUALLY handled as....

<ul>
<li> Item 1 of outer list
<li> Item 2 of outer list
</ul>
<ul>
<ul>
<li>  item one of inner list
<li>  item two of inner list (and that's it!)
</ul>
</ul>

> In pp2latex the implementation is totally buggy (it just ignores
> sublists).

I've fudged pp2latex to deal with a single nested sublist, much
as pp2html does.  This is what I need right now...

:
:
> Probably the Parser should implement a stack of lists.

Indeed.  And expect backends to do so.  This will simplify both HTML
and LaTeX.

> Another problem is the continuation of numbered lists, which may be
> interrupted by an example (verbatim) block.

I think the opposite: if the parser expects back-ends to deal with
nested lists, the continuation will solve itself.  What you'll need is
a way to start a NEW numbered list right after the old one!

But maybe that is best solved by a way of setting the list counter.
#=<1>
This would then allow you to continue numbered lists across
a number of slides...

> I will discuss this further with Jochen, who knows the details about
> the parser. Hopefully we will soon come up with a solution.

I've attached the diffs for what I've done.

I've also made another change.  pp2latex starts a new slide
with a standard LaTeX sectioning command.  This may not be
what is wanted.  So I have added a new option, "newslide",
which is the name of the LaTeX command to be called.  If the
option is set, the named latex command is called with two
arguments: the depth of nesting (an integer), and the
title.  So putting

--newslide=slidestart

makes

==Foo Bar Wub

generate

\slidestart{2}{Foo Bar Wub}

((As I write this, I realise that some way of choosing
whether to include the depth argument would make things like
--newslide=subsection
work as expected....))

> Reards,

>   Lorenz

Robert.

------------------------------------------------------------------------
Robert Inder   Interactive Information Limited,           07770 30 40 52
3, Lauriston Gardens,    Edinburgh    EH3 9HH    SCOTLAND
------------------------------------------------------------------------

THE DIFFS

50a51,52
> my $insublist = 0; > 102a105 > "newslide=s", 388c391,393 < if ($_[2] == 0){
---
>     if (defined $OPT{newslide}) { >$section=$OPT{newslide} . "{$_[2]}";
>     } elsif ($_[2] == 0){ 405a411 >$insublist=0;
466c472,479
<     push_page $page_ref, "\n"; --- > if ($insublist) {
> 	  push_page $page_ref, "\n\\end{quote}\n"; >$insublist=0;
>       }
>       else {
> 	  push_page $page_ref, "\n"; > } > 483c496,497 < push_page$page_ref, "\n\% Shift <\n";
---
>       $insublist--; > push_page$page_ref, "\n\\end{quote}\n\% Shift < ($insublist)\n"; 490c504,505 < push_page$page_ref, "\n\% Shift >\n";
---
>       $insublist++; > push_page$page_ref, "\n\% Shift > (\$insublist)\n\\begin{quote}\n";