Open RhetTbull opened 3 years ago
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,
):
...
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
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.