[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: RE: [Groff] Newbie help for documenting code snippets
From: |
Jon Snader |
Subject: |
Re: RE: [Groff] Newbie help for documenting code snippets |
Date: |
Wed, 12 Jan 2005 13:25:54 -0500 |
User-agent: |
Mutt/1.4.2.1i |
On Wed, Jan 12, 2005 at 09:19:21AM -0800, Meg McRoberts wrote:
> Does loom handle the \n problem in code as well?
> Perhaps that is only an issue for the -mm macros,
> but I spent years writing developer documentation
> in the -mm macros and variants thereof and \n was
> the bane of my existence! It turned into \0 on
> output unless I modified the actual line of code.
>
No, that's handled by the loom filter. I adjust interline
spacing, map \n to \\n, and so on in the filter. If you look at
the sample markup from my last post you will see that the
%include statement (which causes loom to read the source file)
looks like:
%include junk.c label | bin/reformat
The output from loom is first fed to the reformat program which
acts like a normal Unix filter. In my case it's simply a shell
script that calls sed, awk, and expand:
LG=${1:-".7v"}
sed -e 's/\\/\\\\/g
s#/address@hidden(.*\)\*/$#\1#' | awk -v linegap=$LG '
length($0)==0 {
print ".sp", linegap;
next;
}
/^\# \$Id:/ { next; }
{
print $0;
}' |
expand -4
jcs