mirror of https://github.com/istio/istio.io.git
Improve spell checking command so we get colorized output. (#2752)
This commit is contained in:
parent
465c5fe5e6
commit
28900ad96c
|
|
@ -1,8 +1,8 @@
|
||||||
version: 2
|
version: 2.1
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
docker:
|
docker:
|
||||||
- image: gcr.io/istio-testing/website-builder:2018-10-05
|
- image: gcr.io/istio-testing/website-builder:2018-10-08
|
||||||
|
|
||||||
working_directory: ~/site
|
working_directory: ~/site
|
||||||
|
|
||||||
|
|
|
||||||
2
Makefile
2
Makefile
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
img := gcr.io/istio-testing/website-builder:2018-10-05
|
img := gcr.io/istio-testing/website-builder:2018-10-08
|
||||||
docker := docker run -t -i --sig-proxy=true --rm -v $(shell pwd):/site -w /site $(img)
|
docker := docker run -t -i --sig-proxy=true --rm -v $(shell pwd):/site -w /site $(img)
|
||||||
|
|
||||||
ifeq ($(CONTEXT),production)
|
ifeq ($(CONTEXT),production)
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/env sh
|
#!/bin/bash
|
||||||
|
|
||||||
FAILED=0
|
FAILED=0
|
||||||
|
|
||||||
|
|
@ -16,13 +16,14 @@ check_content() {
|
||||||
DIR=$1
|
DIR=$1
|
||||||
LANG=$2
|
LANG=$2
|
||||||
TMP=$(mktemp -d)
|
TMP=$(mktemp -d)
|
||||||
OUT=$(mktemp)
|
|
||||||
|
|
||||||
# make the tmp dir
|
# make the tmp dir
|
||||||
mkdir -p ${TMP}
|
mkdir -p ${TMP}
|
||||||
|
|
||||||
# create a throwaway copy of the content
|
# create a throwaway copy of the content
|
||||||
cp -R ${DIR} ${TMP}
|
cp -R ${DIR} ${TMP}
|
||||||
|
cp .spelling ${TMP}
|
||||||
|
cp mdl_style.rb ${TMP}
|
||||||
|
|
||||||
# replace the {{< text >}} shortcodes with ```plain
|
# replace the {{< text >}} shortcodes with ```plain
|
||||||
find ${TMP} -type f -name \*.md -exec sed -E -i "s/\\{\\{< text .*>\}\}/\`\`\`plain/g" {} ";"
|
find ${TMP} -type f -name \*.md -exec sed -E -i "s/\\{\\{< text .*>\}\}/\`\`\`plain/g" {} ";"
|
||||||
|
|
@ -36,26 +37,27 @@ check_content() {
|
||||||
# elide link="*"
|
# elide link="*"
|
||||||
find ${TMP} -type f -name \*.md -exec sed -E -i "s/link=\".*\"/LINK/g" {} ";"
|
find ${TMP} -type f -name \*.md -exec sed -E -i "s/link=\".*\"/LINK/g" {} ";"
|
||||||
|
|
||||||
mdspell ${LANG} --ignore-acronyms --ignore-numbers --no-suggestions --report ${TMP}/*.md ${TMP}/*/*.md ${TMP}/*/*/*.md ${TMP}/*/*/*/*.md ${TMP}/*/*/*/*/*.md ${TMP}/*/*/*/*/*/*.md ${TMP}/*/*/*/*/*/*/*.md >${OUT}
|
# switch to the temp dir
|
||||||
|
pushd ${TMP} >/dev/null
|
||||||
|
|
||||||
|
mdspell ${LANG} --ignore-acronyms --ignore-numbers --no-suggestions --report *.md */*.md */*/*.md */*/*/*.md */*/*/*/*.md */*/*/*/*/*.md */*/*/*/*/*/*.md
|
||||||
if [ "$?" != "0" ]
|
if [ "$?" != "0" ]
|
||||||
then
|
then
|
||||||
# remove the tmp dir prefix from error messages
|
|
||||||
sed s!${TMP}/!! ${OUT}
|
|
||||||
echo "To learn how to address spelling errors, please see https://github.com/istio/istio.io#linting"
|
echo "To learn how to address spelling errors, please see https://github.com/istio/istio.io#linting"
|
||||||
FAILED=1
|
FAILED=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mdl --ignore-front-matter --style mdl_style.rb ${TMP} >${OUT}
|
mdl --ignore-front-matter --style mdl_style.rb .
|
||||||
if [ "$?" != "0" ]
|
if [ "$?" != "0" ]
|
||||||
then
|
then
|
||||||
# remove the tmp dir prefix from error messages
|
|
||||||
sed s!${TMP}/!! ${OUT}
|
|
||||||
FAILED=1
|
FAILED=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# go back whence we came
|
||||||
|
popd >/dev/null
|
||||||
|
|
||||||
# cleanup
|
# cleanup
|
||||||
rm -fr ${TMP}
|
rm -fr ${TMP}
|
||||||
rm -fr ${OUT}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
check_content content --en-us
|
check_content content --en-us
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue