Skip to content

Commit f84c547

Browse files
committed
chm: add gbk converting script
1 parent 040f91a commit f84c547

3 files changed

Lines changed: 12 additions & 2 deletions

File tree

make_chm.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ function buildChm( $cpp = true )
127127
{
128128
$e->parentNode->removeChild( $e );
129129
}
130-
else if ( $e->getAttribute('id') == "siteSub" || $e->getAttribute('id') == "mw-js-message")
130+
else if ( $e->getAttribute('id') == "siteSub" || $e->getAttribute('id') == "mw-js-message" || $e->getAttribute('id') == "cpp-footer-base" )
131131
{
132132
$e->parentNode->removeChild( $e );
133133
}

make_chm.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ mkdir -p chm_temp
4343
for i in cppreference.{hhc,hhk,hhp}; do
4444
sed -i '/chmhelp\\首页.html/d' "${i}"
4545
mv "${i}" "chm_temp/${i}"
46-
"${ICONV}" -c -f UTF-8 -t GB18030 "chm_temp/${i}" > "${i}"
46+
"${ICONV}" -c -f UTF-8 -t GBK "chm_temp/${i}" > "${i}"
4747
done
4848
rm -rf chm_temp
4949

make_gbk.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/ban/bash
2+
mv chmhelp chmhelp1
3+
mkdir chmhelp
4+
cd chmhelp1
5+
CPUS="$(cat /proc/cpuinfo | grep -c '^processor')"
6+
find -iname '*.html' | xargs -P "${CPUS}" sed -i 's/<meta http-equiv="Content-Type" content="text\/html; charset=utf-8" \/>/<meta http-equiv="Content-Type" content="text\/html; charset=gbk" \/>/'
7+
ls | grep .html | xargs -P "${CPUS}" -I {} sh -c "iconv -c -f UTF-8 -t GBK '{}' > '../chmhelp/{}'"
8+
cp -n ./* ../chmhelp/
9+
cd ..
10+
rm -rf chmhelp1

0 commit comments

Comments
 (0)