Hello Marc,
> define(`LISTITEM', `ifelse($1,`',,`<li>$1</li>
> LISTITEM(shift($*))')')dnl
> define(UL,`<ul>
> LISTITEM($@)</ul>')dnl
> UL(sed, awk, ``m4, first experience'')
the first obvious bug here is the $* on the second line.
You should use $@ to pass the argument list to `shift.'
Change that, and your example will work as expected.
Second, you should quote the first argument of ifelse. (Remember,
the parameter replacement heppens independently on quoting.)
This problem will manifest itself if the argument with comma were
not double quoted.
Observe:
define(`LISTITEM', `ifelse(`$1',`',,`<li>$1</li>
LISTITEM(shift($@))')')dnl
define(UL,`<ul>
LISTITEM($@)</ul>')dnl
UL(sed, awk, ``m4, first experience'')
define(`SECOND', ``second experience'')
UL(sed, awk, `m4, SECOND')
Have a nice day,
Stepan
_______________________________________________
M4-discuss mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/m4-discuss