-
Couldn't load subscription status.
- Fork 162
Closed
Description
Description
The function add_id_to_html_tag contains a bug that causes incorrect ID assignment when generating HTML tags with specific configurations.
Current Behavior
In the current implementation, the id and id[:8] assignments are swapped based on the configuration flags add_ids_to_html_tags and add_short_ids_to_html_tags. This results in:
id[:8]being assigned whenconfig.add_ids_to_html_tagsisTrue.- The full
idbeing assigned whenconfig.add_short_ids_to_html_tagsisTrue.
Expected Behavior
The logic should be reversed:
- The full
idshould be assigned whenconfig.add_ids_to_html_tagsisTrue. id[:8]should be assigned whenconfig.add_short_ids_to_html_tagsisTrue.
Current Code
def add_id_to_html_tag(prefix, id, config):
if not isinstance(config, HTMLLinearizationConfig) or not prefix:
return prefix
if config.add_ids_to_html_tags:
return prefix[:-1] + f' id="{id[:8]}"' + prefix[-1]
elif config.add_short_ids_to_html_tags:
return prefix[:-1] + f' id="{id}"' + prefix[-1]
else:
return prefixMetadata
Metadata
Assignees
Labels
No labels