diff --git a/.vale/fixtures/AsciiDoc/ValidConditions/testvalid.adoc b/.vale/fixtures/AsciiDoc/ValidConditions/testvalid.adoc index 42e20c3a8..623c5dc1e 100644 --- a/.vale/fixtures/AsciiDoc/ValidConditions/testvalid.adoc +++ b/.vale/fixtures/AsciiDoc/ValidConditions/testvalid.adoc @@ -40,3 +40,6 @@ endif::[] ifeval::["{docname}{outfilesuffix}" == "main.html"] Some text! endif::[] + +//vale-fixture +ifndef::olmv1-pullsecret-proc[For more information, see "Creating a pull secret for catalogs hosted on a secure registry".] diff --git a/.vale/styles/AsciiDoc/ValidConditions.yml b/.vale/styles/AsciiDoc/ValidConditions.yml index 62994e4ba..1bc20cfa7 100644 --- a/.vale/styles/AsciiDoc/ValidConditions.yml +++ b/.vale/styles/AsciiDoc/ValidConditions.yml @@ -13,13 +13,15 @@ script: | //add a newline, it might be missing scope += "\n" - if_regex := "^(ifdef::.+\\[\\]|ifndef::.+\\[\\]|ifeval::.*)" - endif_regex := "^endif::.*" + if_regex := "^ifdef::.+\\[\\]" + ifn_regex := "^ifndef::.+\\[\\]" + ifeval_regex := "ifeval::\\[.+\\]" + endif_regex := "^endif::.*\\[\\]" for line in text.split(scope, "\n") { // trim trailing whitespace line = text.trim_space(line) - if text.re_match(if_regex, line) { + if text.re_match(if_regex, line) || text.re_match(ifn_regex, line) || text.re_match(ifeval_regex, line) { start := text.index(scope, line) matches = append(matches, {begin: start, end: start + len(line)}) } else if text.re_match(endif_regex, line) { diff --git a/tengo-rule-scripts/ValidConditions.tengo b/tengo-rule-scripts/ValidConditions.tengo index 1946d4180..adf862708 100644 --- a/tengo-rule-scripts/ValidConditions.tengo +++ b/tengo-rule-scripts/ValidConditions.tengo @@ -16,13 +16,15 @@ scope = text.re_replace("(?s) *(\n////.*?////\n)", scope, "") //add a newline, it might be missing scope += "\n" -if_regex := "^(ifdef::.+\\[\\]|ifndef::.+\\[\\]|ifeval::.*)" -endif_regex := "^endif::.*" +if_regex := "^ifdef::.+\\[\\]" +ifn_regex := "^ifndef::.+\\[\\]" +ifeval_regex := "ifeval::\\[.+\\]" +endif_regex := "^endif::.*\\[\\]" for line in text.split(scope, "\n") { // trim trailing whitespace line = text.trim_space(line) - if text.re_match(if_regex, line) { + if text.re_match(if_regex, line) || text.re_match(ifn_regex, line) || text.re_match(ifeval_regex, line) { start := text.index(scope, line) matches = append(matches, {begin: start, end: start + len(line)}) } else if text.re_match(endif_regex, line) {