[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: opposite of \c?
From: |
G. Branden Robinson |
Subject: |
Re: opposite of \c? |
Date: |
Sat, 7 Sep 2024 01:10:26 -0500 |
Hi népéta,
At 2024-09-07T14:52:33+1000, népéta mew wrote:
> yeah, i did also create an inline version of the macro, i mostly
> wanted a .q( .q) version just to make it easier to do things like
> nested quotes, but making that work seems like probably more trouble
> than it's worth.
Okay, well, here's one stab at it.
It's a little syntaxy, and does require the groff `\n[.br]` extension,
but it seems to work.
.nr qq 0 \" quote nesting level
.
.de qr \" update quotation mark strings
. ie \\n(qq%2 \{\
. ds qo \(oq\"
. ds qc \(cq\"
. \}
. el \{\
. ds qo \(lq\"
. ds qc \(rq\"
. \}
..
.
.de q( \" open quotation
. nr qq +1
. qr
\\*(qo\\$1\c
..
.
.de q) \" close quotation
. ds qx \" empty; output suffix
. \" The `.br` register is a groff extension.
. if \\n[.br] .as qi \c\"
\\*(qc\\$1\\*(qx
. rm qx
. nr qq -1
. qr
..
.
Demonstration:
$ nroff -ww ATTIC/nepeta3.groff | cat -s
‘Maybe my costume’s not “the norm”. I’m not “camera‐friendly”.
I “frighten children”; I’m “not hygienic”; I don’t “wipe prop‐
erly”. (in memory of Bennett Brauer (Chris Farley))
“She said, ‘I think we’re getting a little carried away with the
“nesting”’. But I told her it’s all the rage among Lisp ‘pro‐
grammers’.”
Full example attached.
Regards,
Branden
nepeta3.groff
Description: Text document
signature.asc
Description: PGP signature