Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extract image file path parsing code into separate function #308

Open
hayleycodes opened this issue Aug 2, 2018 · 0 comments
Open

Extract image file path parsing code into separate function #308

hayleycodes opened this issue Aug 2, 2018 · 0 comments

Comments

@hayleycodes
Copy link
Contributor

hayleycodes commented Aug 2, 2018

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

1 participant