aligrudi / neatroff_make

Neatroff top-level makefile
50 stars 15 forks source link

Escapes in character definitions not expanded correctly #26

Open rhaberkorn opened 1 year ago

rhaberkorn commented 1 year ago

See for instance this test case implementing "smart quotes" (adopted from Groff/MOM macros):

.nr #OPEN_CLOSE 0
.ds $QUOTE0 \(Fo
.ds $QUOTE1 \(Fc
.char " \\*[$QUOTE\\n[#OPEN_CLOSE]]\R'#OPEN_CLOSE (1-\\n[#OPEN_CLOSE])'
.
Hello "world"

You can also try the easier definition .char " \\*[$QUOTE0] for testing purposes. cdef_expand() is responsible as far as I understand. Is this even supposed to be supported by Neatroff?

aligrudi commented 1 year ago

Robin Haberkorn @.***> wrote:

See for instance this test case implementing "smart quotes" (adopted from Groff/MOM macros):

.nr #OPEN_CLOSE 0
.ds $QUOTE0 \(Fo
.ds $QUOTE1 \(Fc
.char " \\*[$QUOTE\\n[#OPEN_CLOSE]]\R'#OPEN_CLOSE (1-\\n[#OPEN_CLOSE])'
..
Hello "world"

You can also try the easier definition .char " \\*[$QUOTE0] for testing purposes. cdef_expand() is responsible as far as I understand. Is this even supposed to be supported by Neatroff?

I am afraid not. The problem is that cdef_expand() calls ren_parse() which skips copy-mode interpretation (that is handling *, \n, \R, and ..; see cp.c).

To make it work, expanding character definitions must be done in cp.c instead of ren.c; see the end of ren_put(). I am not sure if it is a good idea or not.

Ali