[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Groff] Request "cf"
From: |
Miklos Somogyi |
Subject: |
Re: [Groff] Request "cf" |
Date: |
Thu, 13 Mar 2008 01:36:25 +1100 |
On 02/03/2008, at 09:28 PM, Werner LEMBERG wrote:
You say that you've found a solution using `.trf' -- please post
it here.
I haven't, you did. You taught me about this in bits an' pieces a
year or so ago: [...]
Uuh, how embarassing :-)
Doing some debugging, I've found out that .trf does the job right: It
doesn't handle the escape character specially. It's rather the
re-reading of the data as a string which causes the problem.
Here's another, more sophisticated try, cleverly mixing macros and
diversions.
Yep, this is really clever and it works like charm. Please find more
in the pdf attachments.
Thanks,
Miklos
notes.pdf
Description: Adobe PDF document
schemes.pdf
Description: Adobe PDF document
======================================================================
.\" macro: ps-file-insert <file> [<before>] [<after>]
.\"
.\"
.\" file: File name to be inserted literally into the PS output
.\" stream.
.\" before: Name of a macro whose contents is inserted right before
.\" <file>.
.\" after: Name of a macro whose contents is inserted immediately
.\" after <file>.
.
.de pfi-end
..
.
.de ps-file-insert
. ie '\\$2'' \
. ds pfi-before pfi-end\"
. el \
. ds pfi-before \\$2\"
. ie '\\$3'' \
. ds pfi-after pfi-end\"
. el \
. ds pfi-after \\$3\"
.
. de pfi-buffer pfi-end
ps: exec
\\*[\\*[pfi-before]]
. pfi-end
.
. br
. de pfi-aux pfi-end
. da pfi-buffer
. trf \\$1
. da
. pfi-end
.
. pfi-aux
.
. am pfi-buffer pfi-end
\\*[\\*[pfi-after]]
. pfi-end
.
. devicem pfi-buffer
..
.
.
.de before
aaa
..
.
.de after
bbb
..
.
.ps-file-insert foo1 before after
.
.\" eof
======================================================================
Assuming that file `foo1' contains this:
\a\b\c\d\e\$\x\y\z
I get this in the PS file (formatted):
...
EBEGIN
aaa
\a\b\c\d\e\$\x\y\z
bbb
EEND
...
It seems that is what you want, right? Please test it with a
real-case example.
Werner
- Re: [Groff] Request "cf", Miklos Somogyi, 2008/03/01
- Re: [Groff] Request "cf", Werner LEMBERG, 2008/03/01
- Re: [Groff] Request "cf", Miklos Somogyi, 2008/03/01
- Re: [Groff] Request "cf", Werner LEMBERG, 2008/03/02
- Re: [Groff] Request "cf",
Miklos Somogyi <=
- Re: [Groff] Request "cf", Werner LEMBERG, 2008/03/13
- Re: [Groff] Request "cf", Miklos Somogyi, 2008/03/14
- Re: [Groff] Request "cf", Werner LEMBERG, 2008/03/14
- Re: [Groff] Request "cf", Miklos Somogyi, 2008/03/15
- Re: [Groff] Request "cf", Werner LEMBERG, 2008/03/16
- Re: [Groff] Request "cf", Miklos Somogyi, 2008/03/16
- Re: [Groff] Request "cf", Keith Marshall, 2008/03/17