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
.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
..
.
.q(
Maybe my costume's not
.q(
the norm\c
'q) .
I'm not
.q(
camera-friendly\c
'q) .
I
.q(
frighten children\c
'q) ;
I'm
.q(
not hygienic\c
'q) ;
I don't
.q(
wipe properly\c
'q) .
(in memory of Bennett Brauer (Chris Farley))
.sp
.
.sp
.
.q(
She said,
.q(
I think we're getting a little carried away
with the
.q(
nesting\c
'q) \c
'q) .
.
But I told her it's all the rage among Lisp
.q(
programmers\c
'q) .\c
.q)
signature.asc
Description: PGP signature
