Add LTeX for grammar checking

This commit is contained in:
Ben Edgington
2022-11-04 09:13:15 +00:00
parent 87d5b79ba2
commit a9077072f0
4 changed files with 40 additions and 2 deletions

14
bin/util/check_grammar.sh Executable file
View File

@@ -0,0 +1,14 @@
#!/bin/bash
# Run LTeX grammar checker: https://valentjn.github.io/ltex/index.html
ltex=~/bin/ltex-ls-15.2.0/bin/ltex-cli
config=$(dirname "$0")/ltex_config.json
temp=$(mktemp /tmp/ltex_XXXXXXXX.md)
# Image links seems to cause a problem for LTeX, so strip them
cat $1 | sed 's/^!\[.*$//' > $temp
$ltex --client-configuration=$config $temp | sed "s:^$temp:\n$1:"
rm -f $temp

23
bin/util/ltex_config.json Normal file
View File

@@ -0,0 +1,23 @@
{
"language": "en-GB",
"disabledRules": {
"en-GB": [
"MORFOLOGIK_RULE_EN_GB",
"OXFORD_SPELLING_Z_NOT_S",
"ARROWS",
"WHITESPACE_RULE",
"WANNA",
"EN_WORD_COHERENCY",
"SOME_OF_THE",
"SMALL_NUMBER_OF"
]
},
"markdown": {
"nodes": {}
},
"hiddenFalsePositives": {
"en-GB": [
"{\"rule\": \"EN_COMPOUNDS\", \"sentence\": \"block chain\"}"
]
}
}