summaryrefslogtreecommitdiff
path: root/test/script/check-toc
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2019-02-13 21:22:02 +0000
committerw0rp <devw0rp@gmail.com>2019-02-13 21:22:02 +0000
commit3140abcd0cc681ac53d59b290c1b29f534f572fb (patch)
tree77aca4168609d5016ec969b3b3667934802866d2 /test/script/check-toc
parent3050a132b557497c43b45345c7f5f9297eb707cb (diff)
downloadale-3140abcd0cc681ac53d59b290c1b29f534f572fb.zip
Fix #2293 - Update linter option documentation
* The README now points to a valid helptag for linter options. * The now very, very large part of the table of contents for linter and fixer options has been moved into a section so the initial table is smaller. * Special linter or fixer options now lie beneath the general linter or fixer options.
Diffstat (limited to 'test/script/check-toc')
-rwxr-xr-xtest/script/check-toc17
1 files changed, 11 insertions, 6 deletions
diff --git a/test/script/check-toc b/test/script/check-toc
index 09d794ee..f3a57ed2 100755
--- a/test/script/check-toc
+++ b/test/script/check-toc
@@ -6,19 +6,24 @@ set -u
# This script checks that the table of contents for the supported tools is
# sorted, and that the table matches the files.
-toc_start_line="$( \
- grep -m1 -n 'Integration Documentation.*|ale-integrations|' doc/ale.txt \
+toc_section_start_line="$(
+ grep -m1 -n '^7\..*\*ale-other-integration-options\*' doc/ale.txt \
+ | sed 's/\([0-9]*\).*/\1/' \
+)"
+toc_start_offset="$( \
+ tail -n +"$toc_section_start_line" doc/ale.txt \
+ | grep -m1 -n '^ .*\.\.\.' \
| sed 's/\([0-9]*\).*/\1/' \
)"
# shellcheck disable=SC2003
-toc_start_line="$(expr "$toc_start_line" + 1)"
+toc_start_line="$(expr "$toc_section_start_line" + "$toc_start_offset" - 1)"
toc_section_size="$( \
tail -n +"$toc_start_line" doc/ale.txt \
- | grep -m1 -n '^ [0-9]\+\.' \
+ | grep -m1 -n '^===*$' \
| sed 's/\([0-9]*\).*/\1/' \
)"
# shellcheck disable=SC2003
-toc_end_line="$(expr "$toc_start_line" + "$toc_section_size" - 2)"
+toc_end_line="$(expr "$toc_start_line" + "$toc_section_size" - 4)"
toc_file="$(mktemp -t table-of-contents.XXXXXXXX)"
heading_file="$(mktemp -t headings.XXXXXXXX)"
@@ -26,7 +31,7 @@ tagged_toc_file="$(mktemp -t ale.txt.XXXXXXXX)"
sorted_toc_file="$(mktemp -t sorted-ale.txt.XXXXXXXX)"
sed -n "$toc_start_line,$toc_end_line"p doc/ale.txt \
- | sed 's/^ \( *[^.][^.]*\)\.\.*|\(..*\)|/\1, \2/' \
+ | sed 's/^ \( *[^.][^.]*\)\.\.*|\(..*\)|/\1, \2/' \
> "$toc_file"
# Get all of the doc files in a natural sorted order.