add gzip size
This commit is contained in:
parent
bae4ce7967
commit
175612b82f
|
@ -31,6 +31,9 @@ for fic in $filelist; do
|
|||
|
||||
htmlsize=$(sizeof $fic)
|
||||
debug HTML: $htmlsize
|
||||
|
||||
gzhtmlsize=$( gzip -c $fic|wc -c )
|
||||
debug GZHTML: $gzhtmlsize
|
||||
|
||||
xfic=$tmpdir/$fic
|
||||
mkdir -p $(dirname $xfic)
|
||||
|
@ -49,21 +52,29 @@ for fic in $filelist; do
|
|||
|
||||
css=( $( < $xfic hxselect -i -c -s '\n' 'link[rel=stylesheet]::attr(href)'))
|
||||
csssize=0
|
||||
gzcsssize=0
|
||||
for i in $css; do
|
||||
isize=$( sizeof $webdir/$i )
|
||||
gzisize=$( gzip -c $webdir/$i | wc -c )
|
||||
debug $i '=>' $isize
|
||||
(( csssize += isize ))
|
||||
(( gzcsssize += gzisize ))
|
||||
done
|
||||
debug CSS: $csssize
|
||||
debug GZCSS: $gzcsssize
|
||||
total=$(( htmlsize + imgsize + csssize ))
|
||||
gztotal=$(( gzhtmlsize + imgsize + gzcsssize ))
|
||||
# the space is important before the toh total
|
||||
sizeinfos=$(print -- " $(toh $total) (html $(toh $htmlsize), css $(toh $csssize)")
|
||||
gzsizeinfos=$(print -- " $(toh $gztotal) (html $(toh $gzhtmlsize), css $(toh $gzcsssize)")
|
||||
if ((imgsize>0)); then
|
||||
sizeinfos="$sizeinfos, img $(toh $imgsize))"
|
||||
gzsizeinfos="$gzsizeinfos, img $(toh $imgsize))"
|
||||
else
|
||||
sizeinfos="$sizeinfos)"
|
||||
gzsizeinfos="$gzsizeinfos)"
|
||||
fi
|
||||
print -- $sizeinfos
|
||||
perl -pi -e 's#(<div class="?web-file-size"?>)[^<]*(</div>)#$1'"$sizeinfos"'$2#' $fic
|
||||
perl -pi -e 's#(<div class="?web-file-size"?>)[^<]*(</div>)#$1'"$sizeinfos"'$2#;s#(<div class="?gzweb-file-size"?>)[^<]*(</div>)#$1'"$gzsizeinfos"'$2#' $fic
|
||||
done
|
||||
rm -rf $tmpdir
|
||||
|
|
|
@ -171,7 +171,9 @@
|
|||
(format "<div class=\"date\">%s</div>"
|
||||
(format-time-string "%Y-%m-%d %H:%M:%S")))
|
||||
(size
|
||||
"<div class=\"web-file-size\">XXK (HTML: XXK, CSS: XXK, IMG: XXK)</div>")
|
||||
"<div class=\"web-file-size\">XXK (html XXK, css XXK, img XXK)</div>")
|
||||
(gzsize
|
||||
"<div class=\"gzweb-file-size\">XXK (html XXK, css XXK, img XXK)</div>")
|
||||
(generated-with
|
||||
(format (concat "<div class=\"creator\">"
|
||||
"<a href=\"https://www.gnu.org/software/emacs/\" target=\"_blank\" rel=\"noopener noreferrer\">Emacs %s</a>, "
|
||||
|
@ -195,6 +197,7 @@
|
|||
("tags" . ,keywords)
|
||||
("rss" . ,rss)
|
||||
("size" . ,size)
|
||||
("gz" . ,gzsize)
|
||||
("gen-date" . ,generated-date)
|
||||
("get-with" . ,generated-with)
|
||||
("src" . ,website-code)
|
||||
|
|
BIN
project.el.sig
BIN
project.el.sig
Binary file not shown.
Loading…
Reference in a new issue