diff --git a/dup-for-themes.sh b/dup-for-themes.sh new file mode 100755 index 0000000..ba15d4e --- /dev/null +++ b/dup-for-themes.sh @@ -0,0 +1,27 @@ +#!/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 + +for fic in $filelist; do + if echo $fic|egrep -- '-(mk|sci|modern).html$'>/dev/null; then + continue + fi + print -n -- "$fic " + cat $fic | perl -p -e 's#href="/css/mk.css"#href="/css/sci.css"#' > ${fic:r}-sci.html + cat $fic | perl -p -e 's#href="/css/mk.css"#href="/css/modern.css"#' > ${fic:r}-modern.html + print "[OK]" +done diff --git a/fullbuild.sh b/fullbuild.sh index 0721d86..2f731dd 100755 --- a/fullbuild.sh +++ b/fullbuild.sh @@ -9,6 +9,8 @@ emacs \ echo "Update file size" ./update-file-size.sh +echo "Gen themes clones" +./dup-for-themes.sh echo "Building RSS" ./mkrss.sh echo "RSS Built" diff --git a/project.el b/project.el index 601ffaf..8b6f83a 100644 --- a/project.el +++ b/project.el @@ -9,7 +9,7 @@ (defvar posts-dir (concat base-dir "/posts")) (defvar rss-title "Subscribe to articles") (defvar posts-descr "Articles") -(defvar css-path "/css/minimalist.css") +(defvar css-path "/css/mk.css") (defvar author-name "Yann Esposito") (defvar author-email "yann@esposito.host") @@ -172,32 +172,30 @@ (defun org-blog-publish-to-html (plist filename pub-dir) "Same as `org-html-publish-to-html' but modifies html before finishing." - (let ((file-path (org-html-publish-to-html plist filename pub-dir))) + (let* ((file-path (org-html-publish-to-html plist filename pub-dir)) + (mk-path (format "./%s.html" (replace-regexp-in-string ".*/\\([^/]*\\)\\.org$" "\\1" filename))) + (sci-path (format "./%s-sci.html" (replace-regexp-in-string ".*/\\([^/]*\\)\\.org$" "\\1" filename))) + (modern-path (format "./%s-modern.html" (replace-regexp-in-string ".*/\\([^/]*\\)\\.org$" "\\1" filename)))) (with-current-buffer (find-file-noselect file-path) (goto-char (point-min)) (search-forward "
") (insert (mapconcat 'identity - '("" - "" - "" + `("" "" - "" - "" "