vale icon indicating copy to clipboard operation
vale copied to clipboard

TokenIgnores not working in DITA

Open jiewang2 opened this issue 3 years ago • 4 comments

Hi,

I have the TokenIgnores setting as follows in the .vale.ini:

[*]
TokenIgnores = (\[.+\][^(])

This rule should ignore anything wrapped with the square brackets except markdown links. It works for the following content in markdown, but it's not working for the same content in .dita (still reporting errors): [if it rains, i will not go].

jiewang2 avatar Feb 11 '22 06:02 jiewang2

Hi,

as far as i can understand, your regex is invalid.

To match [if it rains, i will not go], the regex should be (\[.+\])

To match [if it rains, i will not go](, the regex should be (\[.+\]\()

To match [if it rains, i will not go]something-other-than-opening-parenthesis, the regex should be (\[.+\][^\(])

In this last case, you are not escaping the opening parenthesis in the brakets.

You can use regex101 for Golang to debug Vale regular expressions.

landure avatar Apr 17 '22 17:04 landure

You don't have to escape values inside a character class.

The problem here is that ignore patterns aren't yet supported in DITA.

jdkato avatar Apr 17 '22 17:04 jdkato

Ok, my bad... i need to review my regex knowledge.

landure avatar Apr 18 '22 07:04 landure

The problem here is that ignore patterns aren't yet supported in DITA.

Should the list of supported markups be added to the TokenIgnores for the time being? If so, and a list is provided, I can make a docs PR to add it.

edit: I ended up making a PR here: https://github.com/errata-ai/vale.sh/pull/30

jdillard avatar Feb 19 '23 22:02 jdillard