On Wed, Dec 28, 2022 at 03:16:16PM +0100, Patrice Dumas wrote: > On Tue, Dec 27, 2022 at 12:56:50PM +0100, Patrice Dumas wrote: > > On Sat, Dec 03, 2022 at 01:41:44AM +0000, Gavin Smith wrote: > > > Not a big deal but I noticed that nested @ignore does not work with > > > texi2any, although it does work with texinfo.tex. For example: > > > > Indeed, @ignore are implemented like @verbatim. However, @macro which > > is in the same block commands category can nest. > > > > > I don't have a strong preference as to whether nested @ignore should > > > work or not but it should be consistent between the two processors. > > > I think we should take whichever is the easiest to implement. > > > > I'll change texi2any. > > I have done it, but I am not so happy with the result. Indeed, nested > @ignore now appears in the tree, but the tree is quite complicated for a > case of an ignored block. Maybe it would be better not to have an > explicit element in the tree, but keep count of the opened @ignore > blocks.
That sounds right. > It is also not clear to me whether this is right to have nesting by type > of block command. I am not sure that Texinfo TeX does it like that too. > Indeed, @if* nest together, @ignore nest with @ignore and @r?macro nest > together. My guess is that in Texinfo TeX all should nest together. Each type of ignored block (e.g. @ignore, @ifhtml) can nest through the \doignore macro in texinfo.tex, but only with other blocks of the same type. So when ignoring @ignore, @ignore nested in @ignore is taken account of; likewise with ignoring @ifhtml. If an @ifset or @ifclear conditional fails, the ignoring keeps track of nested @ifset, respectively @ifclear, blocks. There is no explicit handling of handling other commands other than the one currently being ignored. I don't see that this is a problem. > Maybe we should take one step back and think on what nesting we would > want? > > For example, if we want to have @ignore nesting to be able to ignore a > long slice of code, it will fail if there is in it > > @macro a > @end ignore > @end macro If this is inside an @ignore block in texinfo.tex, I expect the "@end ignore" line will terminate an @ignore block. There is no handling of other block commands (like @macro in this case). Such a macro appears to be useless, as it cannot be expanded to terminate an @ignore block. If this macro @a{} is used following an @ignore line, it will be skipped over when looking for the @end ignore line. See also (texinfo)Conditional Nesting in the manual. > @ifset notset > @end ignore > @end ifset I can't see how this is a useful use case. If someone has a pair @ifset notset @ignore @end ifset ... @ifset notset @end ignore @end ifset then this may actualy work with the @ignore matching the @end ignore, but the following should be used instead: @ifclear notset ... @end ifclear