OSDN Git Service

フォルダ名変更
[wordring-tm/wordring-tm.git] / third-party / tidy-html5-master / test / html5 / testhtml5.sh
1 set -eu
2
3 noexe()
4 {
5         echo "Unable to find/run exe ${TMPEXE}! *** FIX ME ***"
6         echo "Set the name of the 'tidy' executable to use..."
7         exit 1
8 }
9
10 noout()
11 {
12         echo "Unable to creat ${TMPDIR}"
13         exit 1
14 }
15
16 failed()
17 {
18         echo "The test of ${f} FAILED!";
19         TMPCNT3=$((${TMPCNT3} + 1));
20 }
21
22 TMPEXE="../../build/cmake/tidy5"
23 [ -e ${TMPEXE} ] || noexe
24
25 TMPINP=temphtml5.cfg
26 TMPDIR=tempout
27
28 ${TMPEXE} -h > /dev/null || noexe
29
30 if [ ! -e "${TMPDIR}" ]; then
31         echo "Will create the folder ${TMPDIR} for output"
32         read
33
34         mkdir ${TMPDIR} || noout
35 fi
36
37 # This option would be nice, but at present it is FARRRR TOOOOO agressive,
38 # dropping <html>, <body>, etc...  because they are marked CM_OPT
39 # which causes WARNINGS when tidy is run on the tidied file!!!
40 # echo omit-optional-tags: yes >> ${TMPINP}
41
42 if [ ! -e "${TMPINP}" ]; then
43         echo "Creating a CONFIG file ${TMPINP}"
44         read
45
46         cat <<EOF > ${TMPINP}
47 wrap: 99
48 tidy-mark: no
49 indent: yes
50 break-before-br: yes
51 indent-attributes: yes
52 vertical-space: yes
53 indent-spaces: 1
54 indent-cdata: no
55 wrap-asp: no
56 wrap-attributes: no
57 wrap-jste: no
58 wrap-php: no
59 wrap-script-literals: no
60 wrap-sections: no
61 tab-size: 4
62 show-info: no
63 EOF
64 fi
65
66 TMPCNT1=0
67 TMPCNT2=0
68 TMPCNT3=0
69
70 for f in *.org.html; do
71         TMPCNT1=$((${TMPCNT1} + 1))
72 done
73
74 echo
75 echo "Will process ${TMPCNT1} files found..."
76 echo "All should exit with NO WARNINGS or ERRORS"
77 echo "*** CONTINUE? *** Only Ctlr+C aborts... all other keys continue..."
78
79 read
80
81 for f in *.org.html ; do
82         TMPCNT2=$((${TMPCNT2} + 1))
83
84         echo "${TMPCNT2} of ${TMPCNT1}"
85
86         TMPOUT="${TMPDIR}/${f}"
87         ${TMPEXE} -config ${TMPINP} -o ${TMPOUT} ${f} || failed
88 done
89
90 echo
91 echo Done ${TMPCNT2} files. See tidied output in ${TMPDIR}
92 if [ "${TMPCNT3}" = 0 ]; then
93         echo "With NO WARNINGS or ERRORS! This is a *** SUCCESS ***"
94 else
95         echo "However have ${TMPCNT3} WARNINGS or ERRORS! This is a *** FAILURE ***"
96 fi
97 echo