|
from utils.file_processor import FileProcessor, ProcessorOptions |
|
import re |
|
from pathlib import Path |
|
|
|
class WhitespaceProcessor(FileProcessor): |
|
def process_content(self, content: str) -> str: |
|
|
|
content = ' '.join(content.split()) |
|
|
|
return '\n'.join(line.strip() for line in content.split('\n')) |
|
|
|
def main(): |
|
options = ProcessorOptions( |
|
recursive=True, |
|
dry_run=False, |
|
file_extensions={'.txt', '.caption'} |
|
) |
|
|
|
processor = WhitespaceProcessor(options) |
|
processor.process_directory(Path('.')) |
|
|
|
if __name__ == "__main__": |
|
main() |
|
|