Re: Adding a custom symbol

"Valeriy E. Ushakov" <[email protected]>
Newsgroups gmane.comp.type-setting.lout
Message-ID <[email protected]>
On Fri, Jan 13, 2012 at 17:33:17 +0000, Mark Summerfield wrote:

> On Fri, 13 Jan 2012 16:20:47 +0400
> "Valeriy E. Ushakov" <[email protected]> wrote:
> > On Fri, Jan 13, 2012 at 10:45:38 +0000, Mark Summerfield wrote:
> > 
> > > I need to generate 2 different versions of a document. I'd like to
> > > do this:
> > > 
> > >     $ lout --'@Monochrome{Yes}' main.lout > bw.ps
> > > 
> > > and
> > > 
> > >     $ lout main.lout > color.ps
> > > 
> > > How can I add @Monochrome{No} as a default value somewhere?
> > 
> > IIRC, define that symbol as a named parameter (with appropriate
> > default) to, say, @MySetup and @Use @MySetup.  Command line options
> > are consulted for overrides when a symbol is @Use'd (see calls to
> > HuntCommandOption in z06.c).
> > 
> > Consider the manual page example @PageType which is a named parameter
> > to @DocumentSetup.
> 
> Hi Uwe,
> 
> I think that's a bit advanced for me, but I'll see if I can find where
> @PageType is defined & see if I can imitate it.

Ok, got around to actually test it:

@SysInclude { doc }

export @Monochrome
def @MyOptions
  named @Monochrome { No }
{}

@Use { @MyOptions }

@Doc @Text @Begin
@LP Monochrome is @Monochrome
@End @Text


$ lout -p -s override.lt | uniq

          Monochrome is No

$ lout -p -s --'@Monochrome{Yes}' override.lt | uniq

          Monochrome is Yes

-uwe
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.