From 41a08dea5dce915daeec5f390822e83f7e0fea4e Mon Sep 17 00:00:00 2001 From: Mikkel Kjeldsen Date: Fri, 29 Sep 2023 17:02:32 +0200 Subject: [PATCH] Remove implementation support for tab-indented list items The documentation specifies that a tab-indented line is a literal, not a list item, and that list items may be indented with spaces, yet the list item implementation allows both tabs and spaces in indentation. The documentation is quite clear and test backing appears incidental so bring the implementation in line with the documentation by dropping support for tab-indented list items. --- src/commitmsgfmt.rs | 6 ------ src/parser.rs | 6 +++++- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/commitmsgfmt.rs b/src/commitmsgfmt.rs index b018740..7b26e76 100644 --- a/src/commitmsgfmt.rs +++ b/src/commitmsgfmt.rs @@ -341,9 +341,6 @@ foo - spc-indented continuation line that should be realigned - -\t- tab-indented continuation line - that should be realigned "; let expected = " @@ -354,9 +351,6 @@ foo - spc-indented continuation line that should be realigned - -\t- tab-indented continuation line -\t that should be realigned "; assert_eq!(filter(34, &input), expected); diff --git a/src/parser.rs b/src/parser.rs index efca34f..4903ba5 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -234,7 +234,7 @@ fn mk_regex_list_item() -> Regex { r"(?x) ^(?P # Lists may be indented a little; too much and they become literals. - \s{0,2} + [\ ]{0,2} ) (?P
  • (:? @@ -826,6 +826,8 @@ paragraph - paragraph - spaced list item + +\t- tab indent is literal, not list item " ), [ @@ -874,6 +876,8 @@ paragraph ListType("- ".to_owned()), "spaced list item".to_owned() ), + VerticalSpace, + Literal("\t- tab indent is literal, not list item"), ], ); }