From 93adc86dcaf20903285b12eab0e901786430d5f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Sat, 8 Feb 2025 21:42:31 +0100 Subject: [PATCH] improve '\f' format string handling for --print add a newline only for f-string / \fF format strings, as it would break any of the others --- gallery_dl/option.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/gallery_dl/option.py b/gallery_dl/option.py index 0015691a..3c03271a 100644 --- a/gallery_dl/option.py +++ b/gallery_dl/option.py @@ -181,11 +181,13 @@ class PrintAction(argparse.Action): if format_string.startswith("\\f"): format_string = "\f" + format_string[2:] - elif "{" not in format_string and \ - " " not in format_string and \ - format_string[0] != "\f": - format_string = "{" + format_string + "}" - if format_string[-1] != "\n": + + if format_string[0] == "\f": + if format_string[1] == "F" and format_string[-1] != "\n": + format_string += "\n" + elif "{" not in format_string and " " not in format_string: + format_string = "{" + format_string + "}\n" + elif format_string[-1] != "\n": format_string += "\n" namespace.postprocessors.append({