4.3.2 Simple Output Customization for Simple Commands with Braces

You can change the formatting of the “indicator” and font commands (e.g., @code, @t), and other simple commands with arguments (e.g., @asis, @clicksequence, @sup, @verb).

You specify the HTML element associated to a command in a given expansion context by calling the texinfo_register_style_command_formatting function:

Function: texinfo_register_style_command_formatting ($command_name, $html_element, $context)

$command_name is the @-command name, without the leading @. $context is ‘normal’ or ‘preformatted’. There is no separate math nor code context, ‘preformatted’ should be used for math and code context. See Init File Expansion Contexts: Normal, Preformatted, Code, String, Math. There is no way to specify string context, as in string context HTML elements are not output. If $context is undef, the ‘normal’ context is assumed.

If $html_element is set, the argument is enclosed between the $html_element element opening and the element closing. If $html_element is undefined, no HTML element is output.

To specify the whether quotes should be output for an @-command conversion, you should call the texinfo_style_command_set_quoting function:

Function: texinfo_style_command_set_quoting ($command_name, $html_element, $in_quotes, $context)

$command_name is the @-command name, without the leading @. $context is ‘normal’ or ‘preformatted’. There is no separate math nor code context, ‘preformatted’ should be used for math and code context. See Init File Expansion Contexts: Normal, Preformatted, Code, String, Math. There is no string context as in string context simple formatting without the need for per command information should be sufficient. If $context is undef, the ‘normal’ context is assumed.

If $in_quotes is true, the result is enclosed in quotes associated with customization variables OPEN_QUOTE_SYMBOL and CLOSE_QUOTE_SYMBOL (see Customization of HTML Code Inserted in Texinfo). Otherwise, no quotes are output.

For example, to set @sansserif{argument} to be formatted as <code>argument</code> in normal and preformatted context, with quotes in preformatted context, use:

texinfo_register_style_command_formatting('sansserif', 'code',
                                          'normal');
texinfo_register_style_command_formatting('sansserif', 'code',
                                          'preformatted');

texinfo_style_command_set_quoting('sansserif', 0, 'normal');
texinfo_style_command_set_quoting('sansserif', 1, 'preformatted');

To output the formatted argument of @t as is:

foreach my $context ('normal', 'preformatted') {
  texinfo_register_style_command_formatting ('t', undef, $context);
  texinfo_style_command_set_quoting ('t', undef, $context);
}