Skip to content

Redundant code in PrettifyTreeprocessor._prettifyETree #1267

@h4b4n3r0

Description

@h4b4n3r0

I just saw following code in https://github.com/Python-Markdown/markdown/blob/master/markdown/treeprocessors.py#L398-L412

if self.md.is_block_level(elem.tag) and elem.tag not in ['code', 'pre']:
    ...
    if not elem.tail or not elem.tail.strip():
        elem.tail = i
if not elem.tail or not elem.tail.strip():
    elem.tail = i

In my opinion the two lines in https://github.com/Python-Markdown/markdown/blob/master/markdown/treeprocessors.py#L409-L410

    if not elem.tail or not elem.tail.strip():
        elem.tail = i

are superfluous as they are called regardless identically in https://github.com/Python-Markdown/markdown/blob/master/markdown/treeprocessors.py#L411-L412. Also with the variable i is not changed.

Solution would be to remove the two lines https://github.com/Python-Markdown/markdown/blob/master/markdown/treeprocessors.py#L409-L410

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions