lout-users
[Top][All Lists]
Advanced

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

Re: About special characters / , | &


From: Mike Dowling
Subject: Re: About special characters / , | &
Date: Fri, 14 Apr 2000 17:21:31 +0200
User-agent: Mutt/1.1i

On Fri, Apr 14, 2000 at 02:56:29PM +0200, Dominique Crétel wrote:
> Hi all,
> 
> I generate a lout source file with datas from somewhere.
> In this datas, I have sometimes specials charcaters like / , | and &.
> Is there any option which apply to data quote them like:
> 
> data = The wind is blowing,  the rain is falling, Cook & Co is working hard.
> 
> @Option { data }
> 

As I see it, this is not an lout problem.  What you apparently want to
do is automatically edit output from a program.

I see from your headers that you use Microsoft, so I doubt that this
answer will help you much, but, this is what UNIX utilities like sed,
awk, and perl are there for.  (I believe you can get awk and perl for
Microsoft systems.)

For example, the simplest of these utilities is sed, and suppose your
data are generated using a program called myprog, and that the output is
sent to stdout.

$myprog | sed sed 's|\|"\"|g \
> s/&/"&"/g' 

and that would generate the input file, transforming / into "/" and &
into "&".  The output is written to stdout.  (The last "\" on the first
line comes from pressing "Enter", and the shell signals this by writing
the \ and the end of the line and the > at the beginning of the second.)
The actual sed script would contain more conversions, but you get the
picture.


You will of course need a file, call it head, containing

@SysInclude{ tab }
@SysInclude{ tbl }
etc

to start the lout document correctly, and another file, call it tail,
containing stuff like

@End
@Text

to finish the lout document correctly.  So, (at the risk of turning you
off UNIX altogether) you could enter something like

$cat head <(myprog | sed sed 's|\|"\"|g \
> s/&/"&"/g') tail | lout | lpr

This assembles the lout source file from the file head, the output of
myprog, and the file tail, runs the resulting lout source code through
lout, and pipes the postscript output to the default printer.  There are
no intermediary files that are written to disk :-).

It is a nice design feature that, by default, it reads from stdin, and
writes to stdout, making this sort of thing possible.

Cheers,
Mike


reply via email to

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