Skip to content

Commit c0ed764

Browse files
committed
make.bat update
1 parent 0a3e03d commit c0ed764

File tree

1 file changed

+21
-15
lines changed

1 file changed

+21
-15
lines changed

make.bat

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -89,37 +89,43 @@ goto :help
8989
echo Counting words in %THESIS%.tex...
9090
set found=0
9191
setlocal enabledelayedexpansion
92+
if not exist %THESIS%.tex (
93+
echo Error: %THESIS%.tex does not exist.
94+
exit /b 1
95+
)
9296

93-
findstr "\\documentclass\[[^\[]*en" %THESIS%.tex >nul 2>&1
94-
if %ERRORLEVEL% EQU 0 (
95-
for /f "delims=" %%i in ('texcount %THESIS%.tex -inc -char-only 2^>nul') do (
97+
findstr "\\documentclass\[[^\[]*en" %THESIS%.tex > nul
98+
if %errorlevel% equ 0 (
99+
for /f "delims=" %%i in ('texcount %THESIS%.tex -inc -char-only 2^>nul') do (
96100
if !found! equ 1 (
97-
echo 英文字符数 (Latin characters) :%%i
98-
goto :count_total
101+
echo 英文字符数 Latin characters:!%%i!
102+
goto :total
99103
)
100-
echo %%i | findstr "total" >nul && set found=1
104+
echo %%i | findstr "total" > nul && set found=1
101105
)
102106
) else (
103-
for /f "delims=" %%i in ('texcount %THESIS%.tex -inc -ch-only 2^>nul') do (
107+
for /f "delims=" %%i in ('texcount %THESIS%.tex -inc -ch-only 2^>nul') do (
104108
if !found! equ 1 (
105-
echo 纯中文字数 (Chinese characters) :%%i
106-
goto :count_total
109+
echo 纯中文字数 Chinese characters:!%%i!
110+
goto :total
107111
)
108-
echo %%i | findstr "total" >nul && set found=1
112+
echo %%i | findstr "total" > nul && set found=1
109113
)
110114
)
115+
goto :total
111116

112-
:count_total
117+
:total
113118
set found=0
114119
for /f "delims=" %%i in ('texcount %THESIS%.tex -inc -chinese 2^>nul') do (
115120
if !found! equ 1 (
116-
echo 总字数 (Total characters) :%%i
117-
endlocal
121+
echo 总字数 Total characters:!%%i!
118122
goto :EOF
119123
)
120-
echo %%i | findstr "total" >nul && set found=1
124+
echo %%i | findstr "total" > nul && set found=1
125+
)
126+
if !found! neq 1 (
127+
echo Warning: Could not determine word count.
121128
)
122-
endlocal
123129
goto :EOF
124130

125131
:clean

0 commit comments

Comments
 (0)