lout-users
[Top][All Lists]
Advanced

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

Additional formatting inside @CP


From: Valeriy E. Ushakov
Subject: Additional formatting inside @CP
Date: Thu, 24 Jan 2013 01:44:38 +0400
User-agent: Mutt/1.4.2.3i

While we are on this topic...  I recently needed to highlight bits of
code inside @CP without manual editing of prg2lout output and without
additional filtering (corporate laptop with windows, so @Filter is a
problem). 

I came up with the following quick hack that someone might also find
useful (or at least it's archived for my own future reference :).

@CP @Begin
...
      do_stuff();
/*@@ShowBackground { @ASTRUT# */
#ifdef SPECIAL
      do_special_stuff();
#endif/address@hidden
@ZSTRUT}*/
      do_more_stuff();
...
@End @CP

Where

macro @ASTRUT { 0.8w @VShift 1f @High {} //0io "" }
macro @ZSTRUT { 0.3w @VShift 1f @High {} }

and @ShowBackground is bog standard @Graphics to fill background:

def @ShowBackground
  named @BG { 0.90 }
  right x
{
  { 0 0 moveto xsize 0 lineto xsize ysize lineto 0 ysize lineto
    closepath @BG setgray fill
  } @Graphic x
}

The /*@ comments should be used *exactly* as shown, with embedded lout
comments (to deal with "lines" @Break vs. leading whitespace) and the
closing /*@ comment split.

It's sort of nasty, but keeps the source code in the main document in
the form pretty close to original.

-uwe



reply via email to

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