lout-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to do Conditional Formatting?


From: Michael Koehmstedt, RenPet
Subject: Re: How to do Conditional Formatting?
Date: Fri, 1 Jun 2012 15:56:51 -0700

So here's the actual use that I plan to put this to so that we don't have to talk so vaguely about "slightly different text" and "floating things" :)

I'm using Lout to produce legal documents, for leasing. At the end of the first page there is a signature list. The signature list is a two-column table, the column on the left is for Lessor signatures, and the column on the right is for the Lessee's signature. The number of Lessors is variable, it can be one or it might be 15. Now, if the entire table can fit on the front page, I want to print it as-is. However, if it does not, I want to put "See attached page" in the left column but the right column still has the Lessee's signature line. Now, since the Lessee's signature is on the first page, the attached page would just be for the Lessor's signatures. That's why the table is "slightly different", it basically only has one column instead of two, and is formatted a bit differently.


Now for convenience sake, we'll call the original two-column table "Table1", the two-column table that has "See attached page" is "Table2", and the modified one column table on the attached page is "Table3".

Jeffrey, your suggestions are basically along the line of how I considered implementing this, but there's one part I can't figure out. Here's some pseudo-C code for what I'm imagining:

startPage = getCurrentPage( );
print( Table1 );
endPage = getCurrentPage( );

if ( startPage != endPage ) {
    unprint( Table1 );
    print( Table2 ); // Lessee's signature and "see attached page"
    print( Table3); // Lessor signatures only
}

The big question is, if I have to print Table1 to figure out what page it ends up on, how can I "unprint" it and print the alternate Table instead?


On Fri, Jun 1, 2012 at 3:15 PM, Jeff Kingston <address@hidden> wrote:
Certainly there is nothing packaged up and ready to go.

It's possible, using a @Case which compares the current
page number with the page number that the thing is on, and
returns "See attached page" if they differ.  That could be
packaged up so you could call

   tag.of.floating.thing @IfOnDifferentPage { See attached text }

which would be fairly convenient, or perhaps

   tag.of.floating.thing @OnThisPage
      yes { @Null }
      no { See attached text }


Convergence might be a problem, I can see it flipping back and
forth between its two results on alternating runs sometimes.

Writing and testing @OnThisPage would be a small, fun exercise.
If no-one else wants to do it, and Michael really really needs
it, then I will do it.

I haven't considered the difference between

  print( text );

and

  print( slightlyDifferentText );

You could probably do that in much the same way.

Jeff

On Fri, Jun 01, 2012 at 03:58:46PM +0200, Ludovic Court?s wrote:
> Hi,
>
> "Michael Koehmstedt, RenPet" <address@hidden> skribis:
>
> > if ( canFitOnTheCurrentPage( text ) )
> >      print( text );
> > else {
> >      print( "See attached page" );
> >      newLine( );
> >      print( slightlyDifferentText );
> > }
>
> I don???t think this can be achieved in pure Lout.
>
> There???s the @CNP symbol, which does a ???conditional page break???:
>
>     macro @CNP        { // 3.2v @High //0io //{}              }
>
> But it???s not as sophisticated as what you???re looking for.
>
> Thanks,
> Ludo???.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]