From 170fc99c7154f25d918ce462b177100f8e53f746 Mon Sep 17 00:00:00 2001 From: Ronan Hennessy Date: Thu, 27 Apr 2023 15:49:44 +0100 Subject: [PATCH] Allowing repeated numbers in callouts as long as overall sequence increases in value --- .../SequentialNumberedCallouts/testvalid.adoc | 13 +++++++++++++ .../styles/AsciiDoc/SequentialNumberedCallouts.yml | 2 +- scripts/SequentialNumberedCallouts.tengo | 2 +- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/.vale/fixtures/AsciiDoc/SequentialNumberedCallouts/testvalid.adoc b/.vale/fixtures/AsciiDoc/SequentialNumberedCallouts/testvalid.adoc index 27faf58..abb0837 100644 --- a/.vale/fixtures/AsciiDoc/SequentialNumberedCallouts/testvalid.adoc +++ b/.vale/fixtures/AsciiDoc/SequentialNumberedCallouts/testvalid.adoc @@ -10,3 +10,16 @@ end <1> Library import <2> URL mapping <3> Response block + +//vale-fixture +[source,ruby] +---- +require 'sinatra' <1> + +get '/hi' do <1> + "Hello World!" +end +key: value <2> +---- +<1> Library import +<2> URL mapping diff --git a/.vale/styles/AsciiDoc/SequentialNumberedCallouts.yml b/.vale/styles/AsciiDoc/SequentialNumberedCallouts.yml index fbb49c1..307ab5e 100644 --- a/.vale/styles/AsciiDoc/SequentialNumberedCallouts.yml +++ b/.vale/styles/AsciiDoc/SequentialNumberedCallouts.yml @@ -28,7 +28,7 @@ script: | //cast string > int num := text.atoi(trimmed) //start counting - if num != prev_num+1 { + if num != prev_num && num != prev_num+1 { start := text.index(scope, line) matches = append(matches, {begin: start, end: start + len(line)}) } diff --git a/scripts/SequentialNumberedCallouts.tengo b/scripts/SequentialNumberedCallouts.tengo index ce72e4c..143aca3 100644 --- a/scripts/SequentialNumberedCallouts.tengo +++ b/scripts/SequentialNumberedCallouts.tengo @@ -32,7 +32,7 @@ for line in text.split(scope, "\n") { //cast string > int num := text.atoi(trimmed) //start counting - if num != prev_num+1 { + if num != prev_num && num != prev_num+1 { start := text.index(scope, line) matches = append(matches, {begin: start, end: start + len(line)}) }