OSDN Git Service

Initial commit
[wordring-tm/wordring-tm.git] / third_party / tidy-html5-master / test / html5 / html4 / testhtml4.cmd
1 @setlocal
2
3 @set TMPEXE=..\..\..\build\cmake\Release\tidy5.exe
4 @if NOT EXIST %TMPEXE% goto NOEXE
5 @set TMPINP=temphtml4.cfg
6 @set TMPDIR=tempout
7
8 @%TMPEXE% -h > nul
9 @if ERRORLEVEL 1 goto NOEXE
10
11 @if EXIST %TMPDIR%\nul goto GOTOUT
12 @echo Will create the folder %TMPDIR% for output...
13 @pause
14 @md %TMPDIR%
15 @if ERRORLEVEL 1 goto NOOUT
16 @if NOT EXIST %TMPDIR%\nul goto NODIR
17 :GOTOUT
18
19 @REM This option would be nice, but at present it is FARRRR TOOOOO agressive,
20 @REM dropping <html>, <body>, etc...  because they are marked CM_OPT
21 @REM which causes WARNINGS when tidy is run on the tidied file!!!
22 @REM echo omit-optional-tags: yes >> %TMPINP%
23
24 @if EXIST %TMPINP% goto GOTINP
25 @echo Creating a CONFIG file %TMPINP%
26 @pause
27 @echo wrap: 99 > %TMPINP%
28 @echo tidy-mark: no >> %TMPINP%
29 @echo indent: yes >> %TMPINP%
30 @echo break-before-br: yes >> %TMPINP%
31 @echo indent-attributes: yes >> %TMPINP%
32 @echo vertical-space: yes >> %TMPINP%
33 @echo indent-spaces: 1 >> %TMPINP%
34 @echo indent-cdata: no >> %TMPINP%
35 @echo wrap-asp: no >> %TMPINP%
36 @echo wrap-attributes: no >> %TMPINP%
37 @echo wrap-jste: no >> %TMPINP%
38 @echo wrap-php: no >> %TMPINP%
39 @echo wrap-script-literals: no >> %TMPINP%
40 @echo wrap-sections: no >> %TMPINP%
41 @echo tab-size: 4 >> %TMPINP%
42 @echo show-info: no >> %TMPINP%
43 @echo doctype: html5 >> %TMPINP%
44 @if NOT EXIST %TMPINP% goto NOINP
45 :GOTINP
46 @set TMPCNT1=0
47 @set TMPCNT2=0
48 @set TMPCNT3=0
49
50 @for %%i in (*4.html) do @(call :CNTIT %%i)
51 @echo.
52 @echo Will process %TMPCNT1% files found, using the config file %TMPINP%, which contains a directive doctype: html5,
53 @echo forcing tidy5 to assume they are HTML5 files. All output is to %TMPDIR% folder...
54 @echo.
55 @echo *** ALL *** should exit with WARNINGS and/or ERRORS, since they contain tags no longer used in HTML5
56 @echo.
57 @echo *** CONTINUE? *** Only Ctlr+C aborts... all other keys continue...
58 @echo.
59 @pause
60 @echo.
61
62 @for %%i in (*4.html) do @(call :DOONE %%i)
63
64 @echo.
65 @echo Done %TMPCNT2% files. See message and tidied output in the %TMPDIR% folder...
66 @echo.
67 @if "%TMPCNT3%x" == "0x" (
68 @echo ALL exited With WARNINGS and/or ERRORS! This is a *** SUCCESS ***
69 ) ELSE (
70 @echo However have %TMPCNT3% with NO WARNINGS or ERRORS! This is a *** FAILURE ***
71 )
72 @echo.
73 @goto END
74
75 :CNTIT
76 @if "%~1x" == "x" goto :EOF
77 @set /A TMPCNT1+=1
78 @goto :EOF
79
80 :DOONE
81 @if "%~1x" == "x" goto :EOF
82 @set /A TMPCNT2+=1
83 @echo %TMPCNT2% of %TMPCNT1%: %1
84 @set TMPOUT=%TMPDIR%\%~nx1
85 @set TMPMSG=%TMPOUT%.txt
86
87 @if EXIST %TMPOUT% @del %TMPOUT% > nul
88 @if EXIST %TMPMSG% @del %TMPMSG% > nul
89
90 @%TMPEXE% -f %TMPMSG% -config %TMPINP% -o %TMPOUT% %1
91 @if ERRORLEVEL 1 goto :EOF
92 :FAILED
93 @echo The test of %1 FAILED!
94 @set /A TMPCNT3+=1
95 @pause
96 @goto :EOF
97
98 :NODIR
99 :NOOUT
100 @echo Error: Unable to create %TMPDIR%!
101 @goto END
102
103
104 :NOEXE
105 @echo Unable to find/run exe %TMPEXE%! *** FIX ME ***
106 @echo Set the name of the 'tidy' executable to use...
107 @goto END
108
109 :NOINP
110 @echo Error: Unable to create config file %TMPINP%!
111 @goto END
112
113
114 :END