From 9ce5c5a7caf0698b20efb05fddd48d3be21afc93 Mon Sep 17 00:00:00 2001 From: Chris Hall Date: Sat, 6 Apr 2024 22:55:03 +1100 Subject: [PATCH] formatters: new conga formatter, renamed formatters for consistency. (#1355) previously: - SLASH_SEPARATED includes a prefix slash, unlike other *_SEPARATED. now: - renamed SLASH_SEPARATED to ALL_SLASHES - added new SLASH_SEPARATED matching *_SEPARATED behavior. - added new command `conga` (for 'conga line') for SLASH_SEPARATED. --- core/text/formatters.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/text/formatters.py b/core/text/formatters.py index a01f8d6ba7..f75afba0b1 100644 --- a/core/text/formatters.py +++ b/core/text/formatters.py @@ -160,7 +160,8 @@ def every_word(word_func): "SPACE_SURROUNDED_STRING": (SEP, surround(" ")), "DOT_SEPARATED": words_with_joiner("."), "DOT_SNAKE": (NOSEP, lambda i, word, _: "." + word if i == 0 else "_" + word), - "SLASH_SEPARATED": (NOSEP, every_word(lambda w: "/" + w)), + "ALL_SLASHES": (NOSEP, every_word(lambda w: "/" + w)), + "SLASH_SEPARATED": words_with_joiner("/"), "CAPITALIZE_FIRST_WORD": ( SEP, first_vs_rest(lambda w: title_case()(0, w, True)), @@ -180,7 +181,8 @@ def every_word(word_func): "kebab": "DASH_SEPARATED", "packed": "DOUBLE_COLON_SEPARATED", "padded": "SPACE_SURROUNDED_STRING", - "slasher": "SLASH_SEPARATED", + "slasher": "ALL_SLASHES", + "conga": "SLASH_SEPARATED", "smash": "NO_SPACES", "snake": "SNAKE_CASE", "string": "SINGLE_QUOTED_STRING",