fix some multi_apps tasks
This commit is contained in:
@@ -86,6 +86,7 @@ def compare_docx_files(file1, file2, **options):
|
||||
ignore_case = options.get('ignore_case', False)
|
||||
ignore_order = options.get('ignore_order', False)
|
||||
content_only = options.get('content_only', False)
|
||||
delete_empty_lines = options.get('delete_empty_lines', False)
|
||||
|
||||
if not file1 or not file2:
|
||||
return 0
|
||||
@@ -119,6 +120,9 @@ def compare_docx_files(file1, file2, **options):
|
||||
if ignore_order:
|
||||
doc1_paragraphs = sorted(doc1_paragraphs)
|
||||
doc2_paragraphs = sorted(doc2_paragraphs)
|
||||
if delete_empty_lines:
|
||||
doc1_paragraphs = [p for p in doc1_paragraphs if p.strip()]
|
||||
doc2_paragraphs = [p for p in doc2_paragraphs if p.strip()]
|
||||
elif file1.endswith('.odt') and file2.endswith('.odt'):
|
||||
try:
|
||||
doc1 = load(file1)
|
||||
@@ -131,6 +135,9 @@ def compare_docx_files(file1, file2, **options):
|
||||
if ignore_order:
|
||||
doc1_paragraphs = sorted(doc1_paragraphs)
|
||||
doc2_paragraphs = sorted(doc2_paragraphs)
|
||||
if delete_empty_lines:
|
||||
doc1_paragraphs = [p for p in doc1_paragraphs if p.strip()]
|
||||
doc2_paragraphs = [p for p in doc2_paragraphs if p.strip()]
|
||||
else:
|
||||
# Unsupported file types or mismatch
|
||||
print("Unsupported file types or mismatch between file types.")
|
||||
|
||||
Reference in New Issue
Block a user