10.1.1 Formatting HTML Element with Classes

Opening an HTML element with one or more classes should always be done through html_attribute_class:

Function: $element_open = $converter->html_attribute_class ($html_element, \@classes)

Formats the beginning of an HTML element $html_element. \@classes is the list of classes for this element. The element opening returned does not include the end of element symbol ‘>’ such that it is possible to add more attributes.

If the HTML element is span, an empty string is returned if there is also no attribute.

If NO_CSS is set, no attribute is set for the element. Otherwise a class attribute is set based on \@classes . If INLINE_CSS_STYLE is set, a CSS style attribute based on CSS element class rules is also added (see HTML CSS in Texinfo). Otherwise the information that the element class was seen is registered by the converter.

Examples of use:

my $open = $converter->html_attribute_class('span', ['math-arg']);
my $arg_result = $open.'>'.$arg.'</span>'
  if ($open ne '');

my $result = $converter->html_attribute_class('em', [$cmdname, 'jax_p'])
   . '>' . $arg_result . '</em>';