Skip to content

Extract image file path parsing code into separate function #308

@hayleycodes

Description

@hayleycodes

The same code is used in ImageTagBlockProcessor, ImageContainerBlockProcessor and ImageInline pattern. This is redundant and could lead to mistakes when updating these processors, so should moved to another function which each of the processors can call.

The repeated code is at least the following:

        external_path_match = re.search(r'^http', file_path)
        if external_path_match is None:  # internal image
            self.required.add(file_path)
            file_relative = True
            extra_args.update(image_file_name_components(file_path))
        else:
            file_relative = False
        extra_args['full_file_path'] = file_path
        extra_args['file_relative'] = file_relative

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions