Skip to content

Commit

Permalink
fix: ensure title and exceptions use the same split regex
Browse files Browse the repository at this point in the history
See #235.
  • Loading branch information
jdkato committed Oct 3, 2020
1 parent ddd95cb commit 10f7c33
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion check/variables.go
Expand Up @@ -16,7 +16,7 @@ func isMatch(r *regexp.Regexp, s string) bool {
}

func makeExceptions(ignore []string) *regexp.Regexp {
ignore = append(ignore, `[^\s]+`)
ignore = append(ignore, `[\p{N}\p{L}*]+[^\s-/]*`)
return regexp.MustCompile(`(?:` + strings.Join(ignore, "|") + `)`)
}

Expand Down
6 changes: 6 additions & 0 deletions features/checks.feature
Expand Up @@ -19,6 +19,12 @@ Feature: Checks
text.rst:20:13:Vale.Repetition:'be' is repeated!
"""

Scenario: Capitalization
When I test "checks/Capitalization"
Then the output should contain exactly:
"""
"""

Scenario: Sequence
When I test "checks/Sequence"
Then the output should contain exactly:
Expand Down
4 changes: 4 additions & 0 deletions fixtures/checks/Capitalization/.vale.ini
@@ -0,0 +1,4 @@
StylesPath = ../../../styles/

[*]
demo.Cap = YES
3 changes: 3 additions & 0 deletions fixtures/checks/Capitalization/test.md
@@ -0,0 +1,3 @@
# foo, bar, and lorem Are Best Friends

Dummy text.
1 change: 1 addition & 0 deletions fixtures/styles/demo/_vale
Expand Up @@ -13,6 +13,7 @@ demo.Spellcheck = NO
demo.Filters = NO
demo.SentenceCase = NO
demo.TitleCase = NO
demo.Cap = NO

Limit.Rule = YES

Expand Down
11 changes: 11 additions & 0 deletions styles/demo/Cap.yml
@@ -0,0 +1,11 @@
extends: capitalization
message: "'%s' should be in title case."
level: error
scope: heading
match: $title
style: Chicago
exceptions:
- foo
- bar
- lorem
- ipsum

0 comments on commit 10f7c33

Please sign in to comment.