On 1 March 2015 at 11:42, Thien-Thi Nguyen <t...@gnuvola.org> wrote: > I see the source (also in Parser.pm) of that subroutine is: > > # return true if effect of global commands should be ignored. > sub _ignore_global_commands($) > { > my $self = shift; > return !$self->{'expanded_formats_stack'}->[-1]; > } > > but before i wade in fully, i'll just ask quickly here: What > must the user do (in terms of command-line options) to affect > the ‘expanded_formats_stack’?
My understanding is that this is used to ignore some commands, such as index commands, and other commands that record information that is not local to where the command occurred, like "@setfilename". This is in effect while inside a "raw formatter command", like @html, to include raw HTML in a Texinfo file. Presumably there is still some Texinfo parsing still being done while inside these commands, though. If you see later after the code you posted in _enter_index_entry, there is also a check on _ignore_global_commands to check whether to save the index entry in an index. It is always stored under the 'index_entry' 'extra' value. I haven't investigated the purpose of this, or indeed what using e.g. "@cindex" within "@html" should mean. However, this will not make the index entry show up in the indices when they are output with @printindex. > (I'm trying to figure out what > the IXIN stance towards attribute ‘number’ should be: ignore, > require, support but not require. I didn't find any mention of > ‘number’ in the NEWS file, although i did find ‘@elem number’ in > node "Customizing Output File Names" in doc/texi2oldapi.texi, > which seems obsolete or on its way to being so...) I'd suggest not adding data to the output formats unless there is a real use for it. Otherwise it is a burden on the other code in texi2any/makeinfo to pass along the information required to output this information. I don't know what the "number" attribute is used for in the XML output, but I don't know what the XML output as a whole is used for anyway. The use of the 'expanded_formats_stack' in the Parser.pm module is not very related to the question of whether a "number" attribute is needed. A more important question would be what to do with index commands within blocks like @html where they don't lead to an index entry. My first reaction would be to ignore them, because I can't think of a use for them off the top of my head, although there is always a chance there is one I've missed.