From 9926aff29770a0beeea9894a3e941c047ea6f0e5 Mon Sep 17 00:00:00 2001 From: Antti Savolainen Date: Sat, 14 Dec 2024 10:26:45 +0200 Subject: [PATCH] Allow for multi-option placeholders like in rsync.md --- tldr.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tldr.py b/tldr.py index c84a1ca..ceb53c5 100755 --- a/tldr.py +++ b/tldr.py @@ -481,9 +481,9 @@ def emphasise_example(x: str) -> str: # Extract long or short options from placeholders if not (shortform and longform): if shortform: - line = re.sub(r'{{(-.)\|--[^|]+?}}', r'{{\1}}', line) + line = re.sub(r'{{(-[^|]+)\|--[^|]+?}}', r'{{\1}}', line) elif longform: - line = re.sub(r'{{-.\|(--[^|]+?)}}', r'{{\1}}', line) + line = re.sub(r'{{-[^|]+\|(--[^|]+?)}}', r'{{\1}}', line) elements = [' ' * 2 * LEADING_SPACES_NUM] for item in COMMAND_SPLIT_REGEX.split(line):