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 typeset -a dates
dates=( ) dates=( )
for fic in $postsdir/**/*.html; do 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'/##')" postfile="$(echo "$fic"|sed 's#^'$postsdir'/##')"
blogfile="$(echo "$fic"|sed 's#^'$webdir'/##')" blogfile="$(echo "$fic"|sed 's#^'$webdir'/##')"
printf "%-30s" $postfile 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" "#+AUTHOR: " author-name "\n"
"#+EMAIL: " author-email "\n" "#+EMAIL: " author-email "\n"
"#+DESCRIPTION: " descr "\n" "#+DESCRIPTION: " descr "\n"
"@@html:<navigation>" ""
"@@html:<nav>"
"<a href=\"/index.html\">Home</a> | " "<a href=\"/index.html\">Home</a> | "
"<a href=\"/archive.html\">Posts</a> | " "<a href=\"/archive.html\">Posts</a> | "
"<a href=\"/slides.html\">Slides</a> | " "<a href=\"/slides.html\">Slides</a> | "
"<a href=\"/about-me.html\">About</a>" "<a href=\"/about-me.html\">About</a>"
"</navigation><br/>@@" "</nav>@@"
"\n\n"
(mapconcat (lambda (li) (format "%s" (car li))) (mapconcat (lambda (li) (format "%s" (car li)))
(seq-filter #'car (cdr list)) (seq-filter #'car (cdr list))
"\n"))) "\n")))

Binary file not shown.

View file

@ -8,6 +8,13 @@
#+OPTIONS: H:5 auto-id:t #+OPTIONS: H:5 auto-id:t
#+STARTUP: showeverything #+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 #+INCLUDE: ../logo-svg.org
#+begin_notes #+begin_notes

View file

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

View file

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

View file

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

View file

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

View file

@ -8,6 +8,13 @@
#+OPTIONS: H:5 #+OPTIONS: H:5
#+STARTUP: showeverything #+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 * English
- [2018-10-25 Thu] [[file:slides/git-project-manager.org][Git Project Manager]] is a talk I made for the "Commission Open Source" - [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 )) total=$(( htmlsize + imgsize + csssize ))
sizeinfos=$(print -- "Size: $(toh $total) (HTML: $(toh $htmlsize), CSS: $(toh $csssize), IMG: $(toh $imgsize))") sizeinfos=$(print -- "Size: $(toh $total) (HTML: $(toh $htmlsize), CSS: $(toh $csssize), IMG: $(toh $imgsize))")
print -- $sizeinfos 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 done
rm -rf $tmpdir rm -rf $tmpdir