m4-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Macro + diversion issue


From: Daniel Richard G.
Subject: Macro + diversion issue
Date: Sat, 19 May 2007 21:00:41 -0400

Hello,

I've been messing around with diversions inside macros, and have come upon 
an odd scenario. I'd like to call it a bug, but I get the same behavior 
from m4 1.4 as from 1.9a.

See the attached m4 input file. You have div10(), a macro which sends its 
argument to diversion 10, and foo(), a trivial HTML-enclosing thing.

div10() works fine when called by itself, and when called inside a quoted 
macro argument. But when called inside an unquoted macro argument, it is as 
if the divert(10) never happened; the text that was supposed to go to div 
10 ends up in the current div (i.e. 0):

        <FOO>This goes inside FOO tags.</FOO>
        <FOO>This also goes inside FOO tags.This is even more text in div 10.
        </FOO>
        Diversion 10:
        This is text in div 10.
        This is some more text in div 10.
        End of input

I would have expected that all three "This is ... text in div 10" lines 
would have been diverted accordingly:

        <FOO>This goes inside FOO tags.</FOO>
        <FOO>This also goes inside FOO tags.</FOO>
        Diversion 10:
        This is text in div 10.
        This is some more text in div 10.
        This is even more text in div 10.
        End of input

(This came about from attempting to implement a footnote mechanism. foo() 
is my \p{} macro, and div10() is \footnote{}.)

So, what's going on here, and is there any way to make div10() work as 
expected without needing to quote the argument to foo()?


--Daniel


-- 
NAME   = Daniel Richard G.       ##  Remember, skunks       _\|/_  meef?
EMAIL1 = address@hidden        ##  don't smell bad---    (/o|o\) /
EMAIL2 = address@hidden      ##  it's the people who   < (^),>
WWW    = http://www.******.org/  ##  annoy them that do!    /   \
--
(****** = site not yet online)

Attachment: input.m4
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]