OILS / doctools / lint.sh View on Github | oilshell.org

91 lines, 39 significant
1#!/usr/bin/env bash
2#
3# Usage:
4# ./doc.sh <function name>
5
6set -o nounset
7set -o pipefail
8set -o errexit
9
10#
11# TODO: Use this 2017 release!
12#
13# http://www.html-tidy.org/
14# http://binaries.html-tidy.org/
15#
16# The Ubuntu version is from 2009!
17
18validate-html() {
19 # -e shows only errors
20 # -q suppresses other text
21
22 echo
23 echo "--- $1"
24 echo
25
26 set +o errexit
27 tidy -e -q -utf8 "$@"
28 local status=$?
29
30 if test $status -ne 0; then
31 #exit 255 # stop xargs
32 return $status
33 fi
34}
35
36manifest() {
37 local -a html_dirs=(
38 _release/VERSION
39 _tmp/unit
40 #_tmp/spec
41 _tmp/osh-parser
42 )
43 # There are a lot of empty <pre></pre> here which I don't care about
44 # _tmp/spec \
45 #
46 # things I don't care about:
47 # - empty <pre> resulting from auto-generated code
48 # - proprietary attributes -- I use some, doesn't understand "col"
49
50 find "${html_dirs[@]}" -name '*.html'
51}
52
53release-tree() {
54 ### Lint SOME of the release tree
55
56 manifest | xargs -n 1 --verbose -- $0 validate-html
57}
58
59# A tree of files to test.
60
61# Note: you also need to look at the originals in _tmp/unit, etc. because most
62# of these are compressed.
63
64quickly-build-release-tree() {
65 test/unit.sh write-report
66 test/wild-runner.sh make-report
67
68 local suite='osh'
69 local manifest=_tmp/spec/SUITE-$suite.txt
70
71 test/spec-runner.sh all-tests-to-html $manifest
72 test/spec-runner.sh html-summary $suite
73
74 local version=0.7.pre10
75
76 devtools/release-version.sh git-changelog-$version
77 devtools/release-version.sh announcement-$version
78
79 benchmarks/report.sh all
80
81 devtools/release.sh build-tree
82
83 # gah this builds .wwz files
84 # but it shows you all the locations where they live
85 devtools/release.sh compress
86
87 # Now to ./local.sh test-release-tree to upload _release/VERSION to the
88 # server
89}
90
91"$@"