1. Georg Brandl
  2. pygments-main
  3. Issues
Issue #287 resolved

html formatter does not support deep custom tokens

Anonymous created an issue

The function _get_ttype_class() in html.py is designed to create css class names for custom token types (of the form standardclass-subtype1-subtype2 etc.). But it does do this for a single custom subtype only, due to the statement

fname = STANDARD_TYPES.get(ttype)

inside the loop

while fname is None:

After executing the offending statement once, fname won’t be None any longer due to the default empty string parameter in get(). Removing the default value fixes the problem - and won’t loop forever because Token itself is in STANDARD_TYPES.

Kai Brüning

Reported by guest