optim html, minor changes

This commit is contained in:
Yann Esposito (Yogsototh) 2019-11-27 19:06:42 +01:00
parent d330c8688d
commit 19e60630ae
Signed by untrusted user who does not match committer: yogsototh
GPG Key ID: 7B19A4C650D59646
11 changed files with 62 additions and 11 deletions

View File

@ -50,6 +50,9 @@ tmpdir=$(mktemp -d)
typeset -a dates
dates=( )
for fic in $postsdir/**/*.html; do
if echo $fic|egrep -- '-(mk|min|sci|modern).html$'>/dev/null; then
continue
fi
postfile="$(echo "$fic"|sed 's#^'$postsdir'/##')"
blogfile="$(echo "$fic"|sed 's#^'$webdir'/##')"
printf "%-30s" $postfile

28
optim-html.sh Executable file
View File

@ -0,0 +1,28 @@
#!/usr/bin/env nix-shell
#!nix-shell -i zsh
#!nix-shell -I nixpkgs="https://github.com/NixOS/nixpkgs/archive/19.09.tar.gz"
webdir="_site"
debug () {
print -- $* >/dev/null
}
type -a filelist
setopt extendedglob
if (($#>0)); then
filelist=( $* )
else
filelist=( $webdir/**/*.html(.) )
fi
tmp=$(mktemp)
for fic in $filelist; do
if echo $fic|egrep -- '-(mk|min|sci|modern).html$'>/dev/null; then
continue
fi
print -n -- "$fic "
cp $fic $tmp; minify --mime text/html $tmp > $fic
print "[OK]"
done

View File

@ -154,12 +154,14 @@
"#+AUTHOR: " author-name "\n"
"#+EMAIL: " author-email "\n"
"#+DESCRIPTION: " descr "\n"
"@@html:<navigation>"
""
"@@html:<nav>"
"<a href=\"/index.html\">Home</a> | "
"<a href=\"/archive.html\">Posts</a> | "
"<a href=\"/slides.html\">Slides</a> | "
"<a href=\"/about-me.html\">About</a>"
"</navigation><br/>@@"
"</nav>@@"
"\n\n"
(mapconcat (lambda (li) (format "%s" (car li)))
(seq-filter #'car (cdr list))
"\n")))

Binary file not shown.

View File

@ -8,6 +8,13 @@
#+OPTIONS: H:5 auto-id:t
#+STARTUP: showeverything
@@html:<nav>
<a href="/index.html">Home</a> |
<a href="/archive.html">Posts</a> |
<a href="/slides.html">Slides</a> |
<a href="/about-me.html">About</a>
</nav>@@
#+INCLUDE: ../logo-svg.org
#+begin_notes

View File

@ -238,6 +238,9 @@ figure, .figure {
#h {
float: left;
}
.main {
padding-top: 1em;
}
#labels {
width: 100%;
text-align: right;
@ -495,7 +498,6 @@ figure, .figure {
body,.main {
background: var(--bg);
color: var(--fg);
min-height: 100vh;
}
::selection, .main ::selection,
::-moz-selection, .main ::-moz-selection {

View File

@ -282,10 +282,12 @@ figure, .figure {
#h {
float: left;
}
.main {
padding-top: 1em;
}
#labels {
width: 100%;
text-align: right;
margin-bottom: 1em;
}
#labels label {
text-decoration: underline;

View File

@ -8,12 +8,12 @@
#+OPTIONS: H:5
#+STARTUP: showeverything
@@html:<navigation>
@@html:<nav>
<a href="/index.html">Home</a> |
<a href="/archive.html">Posts</a> |
<a href="/slides.html">Slides</a> |
<a href="/about-me.html">About</a>
</navigation>@@
</nav>@@
#+INCLUDE: ../logo-svg.org

View File

@ -354,7 +354,7 @@ date, etc...
(defun menu (lst)
"Blog menu"
(concat
"<navigation>"
"<nav>"
(mapconcat 'identity
(append
'("<a href=\"/index.html\">Home</a>"
@ -362,7 +362,7 @@ date, etc...
"<a href=\"/about-me.html\">About</a>")
lst)
" | ")
"</navigation>"))
"</nav>"))
(defun get-from-info (info k)
(let ((i (car (plist-get info k))))
@ -570,7 +570,7 @@ Here is the full code:
(defun menu (lst)
"Blog menu"
(concat
"<navigation>"
"<nav>"
(mapconcat 'identity
(append
'("<a href=\"/index.html\">Home</a>"
@ -578,7 +578,7 @@ Here is the full code:
"<a href=\"/about-me.html\">About</a>")
lst)
" | ")
"</navigation>"))
"</nav>"))
(defun get-from-info (info k)
(let ((i (car (plist-get info k))))

View File

@ -8,6 +8,13 @@
#+OPTIONS: H:5
#+STARTUP: showeverything
@@html:<nav>
<a href="/index.html">Home</a> |
<a href="/archive.html">Posts</a> |
<a href="/slides.html">Slides</a> |
<a href="/about-me.html">About</a>
</nav>@@
* English
- [2018-10-25 Thu] [[file:slides/git-project-manager.org][Git Project Manager]] is a talk I made for the "Commission Open Source"

View File

@ -57,6 +57,6 @@ for fic in $filelist; do
total=$(( htmlsize + imgsize + csssize ))
sizeinfos=$(print -- "Size: $(toh $total) (HTML: $(toh $htmlsize), CSS: $(toh $csssize), IMG: $(toh $imgsize))")
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#' $fic
done
rm -rf $tmpdir