diff options
-rw-r--r-- | doc/ale-asm.txt | 2 | ||||
-rw-r--r-- | doc/ale-c.txt | 38 | ||||
-rw-r--r-- | doc/ale-chef.txt | 2 | ||||
-rw-r--r-- | doc/ale-cpp.txt | 14 | ||||
-rw-r--r-- | doc/ale-css.txt | 12 | ||||
-rw-r--r-- | doc/ale-cuda.txt | 2 | ||||
-rw-r--r-- | doc/ale-elm.txt | 12 | ||||
-rw-r--r-- | doc/ale-fuse.txt | 2 | ||||
-rw-r--r-- | doc/ale-haskell.txt | 22 | ||||
-rw-r--r-- | doc/ale-javascript.txt | 113 | ||||
-rw-r--r-- | doc/ale-lua.txt | 2 | ||||
-rw-r--r-- | doc/ale-php.txt | 62 | ||||
-rw-r--r-- | doc/ale-scss.txt | 12 | ||||
-rw-r--r-- | doc/ale-spec.txt | 2 | ||||
-rw-r--r-- | doc/ale-stylus.txt | 2 | ||||
-rw-r--r-- | doc/ale-typescript.txt | 12 | ||||
-rw-r--r-- | doc/ale.txt | 28 | ||||
-rwxr-xr-x | run-tests | 7 | ||||
-rwxr-xr-x | test/script/check-toc | 80 |
19 files changed, 266 insertions, 160 deletions
diff --git a/doc/ale-asm.txt b/doc/ale-asm.txt index a72b7754..63b5441f 100644 --- a/doc/ale-asm.txt +++ b/doc/ale-asm.txt @@ -1,5 +1,5 @@ =============================================================================== -ALE Assembly Integration *ale-asm-options* +ALE ASM Integration *ale-asm-options* =============================================================================== diff --git a/doc/ale-c.txt b/doc/ale-c.txt index 0c4f8dc9..fc2c45c7 100644 --- a/doc/ale-c.txt +++ b/doc/ale-c.txt @@ -53,6 +53,25 @@ g:ale_c_clang_options *g:ale_c_clang_options* =============================================================================== +clang-format *ale-c-clangformat* + +g:ale_c_clangformat_executable *g:ale_c_clangformat_executable* + *b:ale_c_clangformat_executable* + Type: |String| + Default: `'clang-format'` + + This variable can be changed to use a different executable for clang-format. + + +g:ale_c_clangformat_options *g:ale_c_clangformat_options* + *b:ale_c_clangformat_options* + Type: |String| + Default: `''` + + This variable can be change to modify flags given to clang-format. + + +=============================================================================== clangtidy *ale-c-clangtidy* `clang-tidy` will be run only when files are saved to disk, so that @@ -144,23 +163,4 @@ g:ale_c_gcc_options *g:ale_c_gcc_options* =============================================================================== -clang-format *ale-c-clangformat* - -g:ale_c_clangformat_executable *g:ale_c_clangformat_executable* - *b:ale_c_clangformat_executable* - Type: |String| - Default: `'clang-format'` - - This variable can be changed to use a different executable for clang-format. - - -g:ale_c_clangformat_options *g:ale_c_clangformat_options* - *b:ale_c_clangformat_options* - Type: |String| - Default: `''` - - This variable can be change to modify flags given to clang-format. - - -=============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/doc/ale-chef.txt b/doc/ale-chef.txt index 026f9b3c..5024e279 100644 --- a/doc/ale-chef.txt +++ b/doc/ale-chef.txt @@ -3,7 +3,7 @@ ALE Chef Integration *ale-chef-options* =============================================================================== -foodcritc *ale-chef-foodcritic* +foodcritic *ale-chef-foodcritic* g:ale_chef_foodcritic_options *g:ale_chef_foodcritic_options* *b:ale_chef_foodcritic_options* diff --git a/doc/ale-cpp.txt b/doc/ale-cpp.txt index 685bb8dc..cda5768b 100644 --- a/doc/ale-cpp.txt +++ b/doc/ale-cpp.txt @@ -60,6 +60,13 @@ g:ale_cpp_clangcheck_options *g:ale_cpp_clangcheck_options* =============================================================================== +clang-format *ale-cpp-clangformat* + +See |ale-c-clangformat| for information about the available options. +Note that the C options are also used for C++. + + +=============================================================================== clangtidy *ale-cpp-clangtidy* `clang-tidy` will be run only when files are saved to disk, so that @@ -166,11 +173,4 @@ g:ale_cpp_gcc_options *g:ale_cpp_gcc_options* =============================================================================== -clang-format *ale-cpp-clangformat* - -See |ale-c-clangformat| for information about the available options. -Note that the C options are also used for C++. - - -=============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/doc/ale-css.txt b/doc/ale-css.txt index 979be881..474445b8 100644 --- a/doc/ale-css.txt +++ b/doc/ale-css.txt @@ -3,6 +3,12 @@ ALE CSS Integration *ale-css-options* =============================================================================== +prettier *ale-css-prettier* + +See |ale-javascript-prettier| for information about the available options. + + +=============================================================================== stylelint *ale-css-stylelint* g:ale_css_stylelint_executable *g:ale_css_stylelint_executable* @@ -30,10 +36,4 @@ g:ale_css_stylelint_use_global *g:ale_css_stylelint_use_global* =============================================================================== -prettier *ale-css-prettier* - -See |ale-javascript-prettier| for information about the available options. - - -=============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/doc/ale-cuda.txt b/doc/ale-cuda.txt index 8cba66f0..052b3363 100644 --- a/doc/ale-cuda.txt +++ b/doc/ale-cuda.txt @@ -3,7 +3,7 @@ ALE CUDA Integration *ale-cuda-options* =============================================================================== -NVCC *ale-cuda-nvcc* +nvcc *ale-cuda-nvcc* g:ale_cuda_nvcc_executable *g:ale_cuda_nvcc_executable* *b:ale_cuda_nvcc_executable* diff --git a/doc/ale-elm.txt b/doc/ale-elm.txt index dff781cf..e96205df 100644 --- a/doc/ale-elm.txt +++ b/doc/ale-elm.txt @@ -3,7 +3,7 @@ ALE Elm Integration *ale-elm-options* =============================================================================== -elm-format *ale-elm-format* +elm-format *ale-elm-elm-format* g:ale_elm_format_executable *g:ale_elm_format_executable* *b:ale_elm_format_executable* @@ -29,18 +29,18 @@ g:ale_elm_format_options *g:ale_elm_format_options* This variable can be set to pass additional options to elm-format. =============================================================================== -elm-make *ale-elm-make* +elm-make *ale-elm-elm-make* g:ale_elm_make_executable *g:ale_elm_make_executable* *b:ale_elm_make_executable* Type: |String| Default: `'elm-make'` - + See |ale-integrations-local-executables| - - + + g:ale_elm_make_use_global *g:ale_elm_make_use_global* - *b:ale_elm_make_use_global* + *b:ale_elm_make_use_global* Type: |Number| Default: `0` diff --git a/doc/ale-fuse.txt b/doc/ale-fuse.txt index 95e1160f..0849c371 100644 --- a/doc/ale-fuse.txt +++ b/doc/ale-fuse.txt @@ -3,7 +3,7 @@ ALE FusionScript Integration *ale-fuse-options* =============================================================================== -4.12. fusionlint *ale-fuse-fusionlint* +fusion-lint *ale-fuse-fusionlint* g:ale_fusion_fusionlint_executable *g:ale_fuse_fusionlint_executable* *b:ale_fuse_fusionlint_executable* diff --git a/doc/ale-haskell.txt b/doc/ale-haskell.txt index 0735c6e9..bbf99fcf 100644 --- a/doc/ale-haskell.txt +++ b/doc/ale-haskell.txt @@ -1,16 +1,6 @@ =============================================================================== ALE Haskell Integration *ale-haskell-options* -=============================================================================== -stack-build *ale-haskell-stack-build* - -g:ale_haskell_stack_build_options *g:ale_haskell_stack_build_options* - *b:ale_haskell_stack_build_options* - Type: |String| - Default: `'--fast'` - - We default to using `'--fast'`. Since Stack generates binaries, your - programs will be slower unless you separately rebuild them outside of ALE. =============================================================================== hdevtools *ale-haskell-hdevtools* @@ -31,4 +21,16 @@ g:ale_haskell_hdevtools_options *g:ale_haskell_hdevtools_options* This variable can be changed to modify flags given to hdevtools. =============================================================================== +stack-build *ale-haskell-stack-build* + +g:ale_haskell_stack_build_options *g:ale_haskell_stack_build_options* + *b:ale_haskell_stack_build_options* + Type: |String| + Default: `'--fast'` + + We default to using `'--fast'`. Since Stack generates binaries, your + programs will be slower unless you separately rebuild them outside of ALE. + + +=============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/doc/ale-javascript.txt b/doc/ale-javascript.txt index 09d7f99d..8bf1a0d3 100644 --- a/doc/ale-javascript.txt +++ b/doc/ale-javascript.txt @@ -61,6 +61,63 @@ g:ale_javascript_eslint_suppress_eslintignore =============================================================================== +flow *ale-javascript-flow* + +g:ale_javascript_flow_executable *g:ale_javascript_flow_executable* + *b:ale_javascript_flow_executable* + Type: |String| + Default: `'flow'` + + See |ale-integrations-local-executables| + + +g:ale_javascript_flow_use_global *g:ale_javascript_flow_use_global* + *b:ale_javascript_flow_use_global* + Type: |Number| + Default: `0` + + See |ale-integrations-local-executables| + + +=============================================================================== +jscs *ale-javascript-jscs* + +g:ale_javascript_jscs_executable *g:ale_javascript_jscs_executable* + *b:ale_javascript_jscs_executable* + Type: |String| + Default: `'jscs'` + + See |ale-integrations-local-executables| + + +g:ale_javascript_jscs_use_global *g:ale_javascript_jscs_use_global* + *b:ale_javascript_jscs_use_global* + Type: |Number| + Default: `0` + + See |ale-integrations-local-executables| + + +=============================================================================== +jshint *ale-javascript-jshint* + +g:ale_javascript_jshint_executable *g:ale_javascript_jshint_executable* + *b:ale_javascript_jshint_executable* + Type: |String| + Default: `'jshint'` + + See |ale-integrations-local-executables| + + +g:ale_javascript_jshint_use_global *g:ale_javascript_jshint_use_global* + *b:ale_javascript_jshint_use_global* + Type: |Number| + Default: `0` + + See |ale-integrations-local-executables| + + +=============================================================================== prettier *ale-javascript-prettier* g:ale_javascript_prettier_executable *g:ale_javascript_prettier_executable* @@ -94,6 +151,7 @@ g:ale_javascript_prettier_use_local_config This variable can be set to use the local prettier configuration file. + =============================================================================== prettier-eslint *ale-javascript-prettier-eslint* @@ -168,61 +226,6 @@ g:ale_javascript_prettier_standard_use_global See |ale-integrations-local-executables| -=============================================================================== -flow *ale-javascript-flow* - -g:ale_javascript_flow_executable *g:ale_javascript_flow_executable* - *b:ale_javascript_flow_executable* - Type: |String| - Default: `'flow'` - - See |ale-integrations-local-executables| - - -g:ale_javascript_flow_use_global *g:ale_javascript_flow_use_global* - *b:ale_javascript_flow_use_global* - Type: |Number| - Default: `0` - - See |ale-integrations-local-executables| - - -=============================================================================== -jscs *ale-javascript-jscs* - -g:ale_javascript_jscs_executable *g:ale_javascript_jscs_executable* - *b:ale_javascript_jscs_executable* - Type: |String| - Default: `'jscs'` - - See |ale-integrations-local-executables| - - -g:ale_javascript_jscs_use_global *g:ale_javascript_jscs_use_global* - *b:ale_javascript_jscs_use_global* - Type: |Number| - Default: `0` - - See |ale-integrations-local-executables| - - -=============================================================================== -jshint *ale-javascript-jshint* - -g:ale_javascript_jshint_executable *g:ale_javascript_jshint_executable* - *b:ale_javascript_jshint_executable* - Type: |String| - Default: `'jshint'` - - See |ale-integrations-local-executables| - - -g:ale_javascript_jshint_use_global *g:ale_javascript_jshint_use_global* - *b:ale_javascript_jshint_use_global* - Type: |Number| - Default: `0` - - See |ale-integrations-local-executables| =============================================================================== diff --git a/doc/ale-lua.txt b/doc/ale-lua.txt index f92d5a10..74d6b94a 100644 --- a/doc/ale-lua.txt +++ b/doc/ale-lua.txt @@ -3,7 +3,7 @@ ALE Lua Integration *ale-lua-options* =============================================================================== -4.12. luacheck *ale-lua-luacheck* +luacheck *ale-lua-luacheck* g:ale_lua_luacheck_executable *g:ale_lua_luacheck_executable* *b:ale_lua_luacheck_executable* diff --git a/doc/ale-php.txt b/doc/ale-php.txt index e2b0de6f..adaca08a 100644 --- a/doc/ale-php.txt +++ b/doc/ale-php.txt @@ -35,6 +35,35 @@ g:ale_php_langserver_use_global *g:ale_php_langserver_use_global* =============================================================================== +phpcbf *ale-php-phpcbf* + +g:ale_php_phpcbf_executable *g:ale_php_phpcbf_executable* + *b:ale_php_phpcbf_executable* + Type: |String| + Default: `'phpcbf'` + + See |ale-integrations-local-executables| + + +g:ale_php_phpcbf_standard *g:ale_php_phpcbf_standard* + *b:ale_php_phpcbf_standard* + Type: |String| + Default: `''` + + This variable can be set to specify the coding standard used by phpcbf. If no + coding standard is specified, phpcbf will default to fixing against the + PEAR coding standard, or the standard you have set as the default. + + +g:ale_php_phpcbf_use_global *g:ale_php_phpcbf_use_global* + *b:ale_php_phpcbf_use_global* + Type: |Number| + Default: `0` + + See |ale-integrations-local-executables| + + +=============================================================================== phpcs *ale-php-phpcs* g:ale_php_phpcs_executable *g:ale_php_phpcs_executable* @@ -63,7 +92,7 @@ g:ale_php_phpcs_use_global *g:ale_php_phpcs_use_global* See |ale-integrations-local-executables| -------------------------------------------------------------------------------- +=============================================================================== phpmd *ale-php-phpmd* g:ale_php_phpmd_ruleset *g:ale_php_phpmd_ruleset* @@ -75,7 +104,7 @@ g:ale_php_phpmd_ruleset *g:ale_php_phpmd_ruleset* the available phpmd rulesets -------------------------------------------------------------------------------- +=============================================================================== phpstan *ale-php-phpstan* g:ale_php_phpstan_executable *g:ale_php_phpstan_executable* @@ -95,34 +124,5 @@ g:ale_php_phpstan_level *g:ale_php_phpstan_level* strictest. -------------------------------------------------------------------------------- -phpcbf *ale-php-phpcbf* - -g:ale_php_phpcbf_executable *g:ale_php_phpcbf_executable* - *b:ale_php_phpcbf_executable* - Type: |String| - Default: `'phpcbf'` - - See |ale-integrations-local-executables| - - -g:ale_php_phpcbf_standard *g:ale_php_phpcbf_standard* - *b:ale_php_phpcbf_standard* - Type: |String| - Default: `''` - - This variable can be set to specify the coding standard used by phpcbf. If no - coding standard is specified, phpcbf will default to fixing against the - PEAR coding standard, or the standard you have set as the default. - - -g:ale_php_phpcbf_use_global *g:ale_php_phpcbf_use_global* - *b:ale_php_phpcbf_use_global* - Type: |Number| - Default: `0` - - See |ale-integrations-local-executables| - - =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/doc/ale-scss.txt b/doc/ale-scss.txt index e0b0a11d..19695a76 100644 --- a/doc/ale-scss.txt +++ b/doc/ale-scss.txt @@ -3,6 +3,12 @@ ALE SCSS Integration *ale-scss-options* =============================================================================== +prettier *ale-scss-prettier* + +See |ale-javascript-prettier| for information about the available options. + + +=============================================================================== stylelint *ale-scss-stylelint* g:ale_scss_stylelint_executable *g:ale_scss_stylelint_executable* @@ -22,10 +28,4 @@ g:ale_scss_stylelint_use_global *g:ale_scss_stylelint_use_global* =============================================================================== -prettier *ale-scss-prettier* - -See |ale-javascript-prettier| for information about the available options. - - -=============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/doc/ale-spec.txt b/doc/ale-spec.txt index b7c8f244..3da950c8 100644 --- a/doc/ale-spec.txt +++ b/doc/ale-spec.txt @@ -1,5 +1,5 @@ =============================================================================== -ALE RPM Spec Integration *ale-spec-options* +ALE Spec Integration *ale-spec-options* *ale-integration-spec* =============================================================================== diff --git a/doc/ale-stylus.txt b/doc/ale-stylus.txt index 29d0dfd9..59d90551 100644 --- a/doc/ale-stylus.txt +++ b/doc/ale-stylus.txt @@ -1,5 +1,5 @@ =============================================================================== -ALE CSS Integration *ale-stylus-options* +ALE Stylus Integration *ale-stylus-options* =============================================================================== diff --git a/doc/ale-typescript.txt b/doc/ale-typescript.txt index 887766fe..d31ac71e 100644 --- a/doc/ale-typescript.txt +++ b/doc/ale-typescript.txt @@ -11,6 +11,12 @@ options for `eslint` too. See: |ale-javascript-eslint|. =============================================================================== +prettier *ale-typescript-prettier* + +See |ale-javascript-prettier| for information about the available options. + + +=============================================================================== tslint *ale-typescript-tslint* g:ale_typescript_tslint_executable *g:ale_typescript_tslint_executable* @@ -94,10 +100,4 @@ g:ale_typescript_tsserver_use_global *g:ale_typescript_tsserver_use_global* =============================================================================== -prettier *ale-typescript-prettier* - -See |ale-javascript-prettier| for information about the available options. - - -=============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/doc/ale.txt b/doc/ale.txt index a061f012..ae3aa48e 100644 --- a/doc/ale.txt +++ b/doc/ale.txt @@ -16,31 +16,38 @@ CONTENTS *ale-contents* 7. Integration Documentation............|ale-integrations| asm...................................|ale-asm-options| gcc.................................|ale-asm-gcc| + awk...................................|ale-awk-options| + gawk................................|ale-awk-gawk| c.....................................|ale-c-options| clang...............................|ale-c-clang| + clang-format........................|ale-c-clangformat| clangtidy...........................|ale-c-clangtidy| cppcheck............................|ale-c-cppcheck| gcc.................................|ale-c-gcc| - clang-format........................|ale-c-clangformat| chef..................................|ale-chef-options| foodcritic..........................|ale-chef-foodcritic| + cmake.................................|ale-cmake-options| + cmakelint...........................|ale-cmake-cmakelint| cpp...................................|ale-cpp-options| clang...............................|ale-cpp-clang| clangcheck..........................|ale-cpp-clangcheck| + clang-format........................|ale-cpp-clangformat| clangtidy...........................|ale-cpp-clangtidy| cppcheck............................|ale-cpp-cppcheck| cpplint.............................|ale-cpp-cpplint| gcc.................................|ale-cpp-gcc| - clang-format........................|ale-cpp-clangformat| - cuda..................................|ale-cuda-options| - nvcc................................|ale-cuda-nvcc| css...................................|ale-css-options| prettier............................|ale-css-prettier| stylelint...........................|ale-css-stylelint| - cmake.................................|ale-cmake-options| - cmakelint...........................|ale-cmake-cmakelint| + cuda..................................|ale-cuda-options| + nvcc................................|ale-cuda-nvcc| dart..................................|ale-dart-options| dartanalyzer........................|ale-dart-dartanalyzer| + dockerfile............................|ale-dockerfile-options| + hadolint............................|ale-dockerfile-hadolint| + elm...................................|ale-elm-options| + elm-format..........................|ale-elm-elm-format| + elm-make............................|ale-elm-elm-make| erlang................................|ale-erlang-options| erlc................................|ale-erlang-erlc| syntaxerl...........................|ale-erlang-syntaxerl| @@ -58,6 +65,7 @@ CONTENTS *ale-contents* handlebars............................|ale-handlebars-options| ember-template-lint.................|ale-handlebars-embertemplatelint| haskell...............................|ale-haskell-options| + hdevtools...........................|ale-haskell-hdevtools| stack-build.........................|ale-haskell-stack-build| html..................................|ale-html-options| htmlhint............................|ale-html-htmlhint| @@ -70,6 +78,7 @@ CONTENTS *ale-contents* javascript............................|ale-javascript-options| eslint..............................|ale-javascript-eslint| flow................................|ale-javascript-flow| + jscs................................|ale-javascript-jscs| jshint..............................|ale-javascript-jshint| prettier............................|ale-javascript-prettier| prettier-eslint.....................|ale-javascript-prettier-eslint| @@ -81,6 +90,7 @@ CONTENTS *ale-contents* prettier............................|ale-json-prettier| kotlin................................|ale-kotlin-options| kotlinc.............................|ale-kotlin-kotlinc| + ktlint..............................|ale-kotlin-ktlint| lua...................................|ale-lua-options| luacheck............................|ale-lua-luacheck| objc..................................|ale-objc-options| @@ -95,12 +105,14 @@ CONTENTS *ale-contents* php...................................|ale-php-options| hack................................|ale-php-hack| langserver..........................|ale-php-langserver| + phpcbf..............................|ale-php-phpcbf| phpcs...............................|ale-php-phpcs| phpmd...............................|ale-php-phpmd| phpstan.............................|ale-php-phpstan| - phpcbf..............................|ale-php-phpcbf| pug...................................|ale-pug-options| puglint.............................|ale-pug-puglint| + puppet................................|ale-puppet-options| + puppetlint..........................|ale-puppet-puppetlint| python................................|ale-python-options| autopep8............................|ale-python-autopep8| flake8..............................|ale-python-flake8| @@ -111,6 +123,8 @@ CONTENTS *ale-contents* yapf................................|ale-python-yapf| r.....................................|ale-r-options| lintr...............................|ale-r-lintr| + reasonml..............................|ale-reasonml-options| + merlin..............................|ale-reasonml-merlin| ruby..................................|ale-ruby-options| brakeman............................|ale-ruby-brakeman| rails_best_practices................|ale-ruby-rails_best_practices| @@ -255,6 +255,13 @@ if ((run_custom_checks)); then grep ' \*[^*]\+\*$' doc/ -r \ | awk '{ sep = index($0, ":"); if (length(substr($0, sep + 1 )) < 79) { print } }' \ | grep . && EXIT=1 + + echo '========================================' + echo 'Look for table of contents issues' + echo '========================================' + echo + + test/script/check-toc || EXIT=$? fi exit $EXIT diff --git a/test/script/check-toc b/test/script/check-toc new file mode 100755 index 00000000..039707eb --- /dev/null +++ b/test/script/check-toc @@ -0,0 +1,80 @@ +#!/bin/bash -eu + +# 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 \ + | sed 's/\([0-9]*\).*/\1/' \ +)" +# shellcheck disable=SC2003 +toc_start_line="$(expr "$toc_start_line" + 1)" +toc_section_size="$( \ + tail -n +"$toc_start_line" doc/ale.txt \ + | grep -m1 -n '^ [0-9]\+\.' \ + | sed 's/\([0-9]*\).*/\1/' \ +)" +# shellcheck disable=SC2003 +toc_end_line="$(expr "$toc_start_line" + "$toc_section_size" - 2)" + +toc_file="$(mktemp -t table-of-contents.XXXXXXXX)" +heading_file="$(mktemp -t headings.XXXXXXXX)" +unsorted_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/' \ + > "$toc_file" + +# Get all of the doc files in a natural sorted order. +doc_files="$(/bin/ls -1v doc | grep ^ale- | sed 's/^/doc\//' | paste -sd ' ')" + +# shellcheck disable=SC2086 +grep -h 'ale-.*-options\|^[a-z].*\*ale-.*\*$' $doc_files \ + | sed 's/^/ /' \ + | sed 's/ALE Shell Integration/ALE sh Integration/' \ + | sed 's/ ALE \(.*\) Integration/\L\1/' \ + | sed 's/ *\*\(.\+\)\*$/, \1/' \ + | sed 's/objective-c/objc/' \ + | sed 's/c++/cpp/' \ + > "$heading_file" + +exit_code=0 +in_section=0 +section_index=0 + +while read -r; do + if [[ "$REPLY" =~ ^\ ]]; then + if ! ((in_section)); then + let section_index='section_index + 1' + in_section=1 + fi + else + if ((in_section)); then + let section_index='section_index + 1' + in_section=0 + fi + fi + + echo "$section_index $REPLY" >> "$unsorted_toc_file" +done < "$toc_file" + + +sort -h "$unsorted_toc_file" | sed 's/[0-9]\+//' > "$sorted_toc_file" +sed -i.bak 's/[0-9]\+//' "$unsorted_toc_file" +rm -f "$unsorted_toc_file".bak + +echo 'Check for bad ToC sorting:' +echo +diff -U2 "$sorted_toc_file" "$unsorted_toc_file" || exit_code=$? + +echo 'Check for mismatched ToC and headings:' +echo +diff -U3 "$toc_file" "$heading_file" || exit_code=$? + +rm "$toc_file" +rm "$heading_file" +rm "$unsorted_toc_file" +rm "$sorted_toc_file" + +exit "$exit_code" |