File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ PHP="${PHP:-$(which php)}"
3232ICONV=" ${ICONV:- $(which iconv)} "
3333HHC=" ${HHC:- $(which hhc)} "
3434_7Z=" ${_7Z:- $(which 7z)} "
35- VERSION=" ${VERSION:- $(date +% Y% m)} "
35+ VERSION=" ${VERSION:- $(date +% Y% m% d )} "
3636CPUS=" $( cat /proc/cpuinfo | grep -c ' ^processor' ) "
3737
3838# 在执行下一步之前,移动reference或output目录下文件到当前目录
Original file line number Diff line number Diff line change 11#! /bin/bash
2+ for i in " $@ "
3+ do
4+ case $i in
5+ _7Z=* )
6+ _7Z=" ${i#* =} "
7+ shift # past argument=value
8+ ;;
9+ VERSION=* )
10+ VERSION=" ${i#* =} "
11+ shift # past argument=value
12+ ;;
13+ * )
14+ # unknown option
15+ ;;
16+ esac
17+ done
218
319set -e
420git clone https://github.com/PeterFeicht/cppreference-doc.git --depth=1
@@ -25,8 +41,14 @@ ext_path="$(find | grep -iP 'load\.php.*?modules=.*ext.*&only=styles.*?' | head
2541
2642LIST=" startup_scripts site_scripts site_modules skin_scripts ext"
2743extra_fonts=" DejaVuSans.ttf DejaVuSans-Bold.ttf DejaVuSansMono.ttf DejaVuSansMono-Bold.ttf"
44+
45+ _7Z=" ${_7Z:- $(which 7z)} "
46+ VERSION=" ${VERSION:- $(date +% Y% m% d)} "
2847CPUS=" $( cat /proc/cpuinfo | grep -c ' ^processor' ) "
2948
49+ # package un-processed files
50+ " ${_7Z} " -mx9 -myx9 " cppreference-unprocessed-${VERSION} .7z" ./reference
51+
3052# https://gist.github.com/cdown/1163649/8a35c36fdd24b373788a7057ed483a5bcd8cd43e
3153url_encode () {
3254 local _length=" ${# 1} "
90112fi
91113rm -rf font_temp
92114
115+ find ./ -iname ' *.html' -type f | xargs -P " ${CPUS} " sed -i " s/ - cppreference.com//g"
116+
93117echo post-processing...
94118for i in $LIST ; do
95119 echo processing $i
@@ -103,5 +127,10 @@ find -iname "${skin_scripts_replace}" | xargs sed -i '1 i if(window.mw)'
103127find -iname ' *.css' | xargs sed -i -r ' s/\.\.\/([^.]+?)\.ttf/\1.ttf/ig'
104128echo Done.
105129
106- mv reference/* ../
130+ # package processed files
131+ " ${_7Z} " -mx9 -myx9 " html-book-${VERSION} .7z" ./reference
132+
133+ # move processed files to parent folder
134+ # for make_chm.sh
135+ mv -f reference/* ../
107136cd ..
You can’t perform that action at this time.
0 commit comments