6.6 Setting and Getting Conversion Customization Variables

The customization variables values set during the conversion process may be different from the main program customization variables. The general rule is that variables set in the main program, in particular from init files, are passed to the converter. Some variables, however, only appear in the converter. Some variables are also set in the converter based on the main program customization variables. Finally, some variables should be set or reset during conversion, in particular when converting the tree representing the Texinfo document, when expanding the tree element corresponding to @-commands associated with customization variables (see Customization Variables for @-Commands in Texinfo).

The functions described here should be used in user defined functions, but should not be used out of functions. Conversely, the similar functions used to set customization variables from init files without a converter should not be used in functions, but should be used out of functions in init files (see Managing Customization Variables).

To get the value of a variable in a converter $converter, the function is get_conf:

Function: $converter->get_conf ($variable_name)

$variable_name is the name of the variable; its value in the converter $converter (possibly undef) is returned.

For example:

my $footnotestyle = $converter->get_conf('footnotestyle');

To set a variable in a converter $converter, the function is set_conf:

Function: $converter->set_conf ($variable_name, $variable_value)

$variable_name is the name of the variable; its value in the converter $converter is set to $variable_value. The $variable_name value will not be overidden if it was set from the command line or from an init file.

For example:

$converter->set_conf('footnotestyle', 'separate');

Some customization variables, in particular those associated with @-commands, can be reset to the value they had before starting the conversion. For example, they are reset in order to obtain their value before the conversion. Thet are also reset to the value they had before starting the conversion when their value at the end of the preambule or at the end of the document is needed, but there are no @-commands at those locations in the Texinfo manual. If a value set by set_conf is intended to be found when the customization variable value is reset, set_conf should be called early. For example, when called from a user-defined function called at different stage, it should be called in the ‘setup’ stage (see Init File Calling at Different Stages).

The values set in converter with set_conf will not override command-line set customization variables, nor variables set early in init files. This is the expected behaviour, in particular when the values are set from the document. In the rare cases when overriding the customization would be needed, the force_conf function can be used:

Function: $converter->force_conf ($variable_name, $variable_value)

$variable_name is the name of the variable; its value in the converter $converter is set to $variable_value, overriding any previous value.