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

Pull out the MTL parser into a separate class so it can easily be reused #14

Open
RhetTbull opened this issue Nov 9, 2021 · 1 comment
Labels
enhancement New feature or request

Comments

@RhetTbull
Copy link
Owner

The MLT parser is used today in osxphotos, exif2findertags and autofile. I'll likely use it again. Rather than maintain 3 separate versions, the common parser engine could be pulled out into it's own package, mtlparser

class MTLParser:

    def __init__(self, get_field_value: Callable):
        ...

get_field_value would get passed the current field,subfield, default, options and return the field value so that could be implemented separately from the parser.

common things like punctuation and filters would be part of the parser class but could be overridden to implement custom filters, etc.

@RhetTbull RhetTbull added the enhancement New feature or request label Nov 9, 2021
@RhetTbull
Copy link
Owner Author

class MTLParser:
    def __init__(self, 
        get_field_value: Callable,
        sanitize: Optional[Callable], # sanitize fully rendered string
        sanitize_value: Optional[Callable], # sanitize each value from get_field_value,
        ):
        ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant