New system in place
This commit is contained in:
parent
eff4b0bbf6
commit
9ddc693b3a
7 changed files with 16 additions and 463 deletions
14
Shakefile.hs
14
Shakefile.hs
|
@ -137,6 +137,7 @@ buildRules :: Rules ()
|
||||||
buildRules = do
|
buildRules = do
|
||||||
cleanRule
|
cleanRule
|
||||||
allRule
|
allRule
|
||||||
|
fullRule
|
||||||
getPost <- mkGetPost
|
getPost <- mkGetPost
|
||||||
getPosts <- mkGetPosts getPost
|
getPosts <- mkGetPosts getPost
|
||||||
getTemplate <- mkGetTemplate
|
getTemplate <- mkGetTemplate
|
||||||
|
@ -157,6 +158,9 @@ buildRules = do
|
||||||
".gif" -> compressImage asset
|
".gif" -> compressImage asset
|
||||||
".png" -> compressImage asset
|
".png" -> compressImage asset
|
||||||
_ -> copyFileChanged (srcDir </> asset) out
|
_ -> copyFileChanged (srcDir </> asset) out
|
||||||
|
optimDir </> "rss.xml" %> \_ -> do
|
||||||
|
needAll
|
||||||
|
command_[] "engine/pre-deploy.sh" []
|
||||||
|
|
||||||
buildArchive
|
buildArchive
|
||||||
:: (() -> Action [BlogPost])
|
:: (() -> Action [BlogPost])
|
||||||
|
@ -332,14 +336,18 @@ compressImage img = do
|
||||||
, "-ordered-dither","o4x4,4"
|
, "-ordered-dither","o4x4,4"
|
||||||
, dst ]
|
, dst ]
|
||||||
|
|
||||||
allRule :: Rules ()
|
needAll = do
|
||||||
allRule =
|
|
||||||
phony "all" $ do
|
|
||||||
allAssets <- filter (/= ".DS_Store") <$> getDirectoryFiles srcDir ["**"]
|
allAssets <- filter (/= ".DS_Store") <$> getDirectoryFiles srcDir ["**"]
|
||||||
need (map build $ allAssets <> ["archive.html"])
|
need (map build $ allAssets <> ["archive.html"])
|
||||||
allHtmlAction
|
allHtmlAction
|
||||||
allAsciiAction
|
allAsciiAction
|
||||||
|
|
||||||
|
allRule :: Rules ()
|
||||||
|
allRule = phony "all" needAll
|
||||||
|
|
||||||
|
fullRule :: Rules ()
|
||||||
|
fullRule = phony "full" $ need [optimDir </> "rss.xml"]
|
||||||
|
|
||||||
cleanRule :: Rules ()
|
cleanRule :: Rules ()
|
||||||
cleanRule =
|
cleanRule =
|
||||||
phony "clean" $ do
|
phony "clean" $ do
|
||||||
|
|
|
@ -1,9 +1,3 @@
|
||||||
#!/usr/bin/env bash
|
#!/bin/sh
|
||||||
|
mkdir -p _shake
|
||||||
cd "$(git rev-parse --show-toplevel)" || exit 1
|
ghc --make Shakefile.hs -rtsopts -threaded -with-rtsopts=-I0 -outputdir=_shake -o _shake/build && _shake/build "$@"
|
||||||
echo "* org-publish"
|
|
||||||
emacs -nw \
|
|
||||||
--load project.el \
|
|
||||||
--eval "(progn (org-publish \"blog\") (evil-quit))"
|
|
||||||
|
|
||||||
echo "* org-publish [done]"
|
|
||||||
|
|
447
project.el
447
project.el
|
@ -1,447 +0,0 @@
|
||||||
;; sign it with
|
|
||||||
;; gpg --local-user yann@esposito.host --output project.el.sig --detach-sign project.el
|
|
||||||
(defvar websiteorigin "https://her.esy.fun")
|
|
||||||
(defvar root-dir (projectile-project-root))
|
|
||||||
(defvar base-dir (concat root-dir "src"))
|
|
||||||
(defvar publish-dir (concat root-dir "_site"))
|
|
||||||
(defvar draft-publish-dir (concat root-dir "_full"))
|
|
||||||
(defvar assets-dir (concat base-dir "/"))
|
|
||||||
(defvar publish-assets-dir (concat publish-dir "/"))
|
|
||||||
(defvar draft-publish-assets-dir (concat draft-publish-dir "/"))
|
|
||||||
(defvar posts-dir (concat base-dir "/posts"))
|
|
||||||
(defvar rss-title "Subscribe to articles")
|
|
||||||
(defvar css-path "/css/y.css")
|
|
||||||
(defvar author-name "Yann Esposito")
|
|
||||||
(defvar author-email "yann@esposito.host")
|
|
||||||
|
|
||||||
(require 'org)
|
|
||||||
(require 'ox-publish)
|
|
||||||
(require 'ox-html)
|
|
||||||
(require 'org-element)
|
|
||||||
|
|
||||||
;; (setq org-link-file-path-type 'relative)
|
|
||||||
(setq org-publish-timestamp-directory
|
|
||||||
(concat (projectile-project-root) "_cache/"))
|
|
||||||
|
|
||||||
(defvar org-blog-head
|
|
||||||
(concat
|
|
||||||
"<link rel=\"stylesheet\" href=\"" css-path "\"/>"
|
|
||||||
"<link rel=\"alternate\" type=\"application/rss+xml\" href=\"/rss.xml\" />"
|
|
||||||
"<link rel=\"icon\" href=\"/favicon.ico\">"))
|
|
||||||
|
|
||||||
(defun menu (lst)
|
|
||||||
"Blog menu"
|
|
||||||
(concat
|
|
||||||
"<nav>"
|
|
||||||
(mapconcat 'identity
|
|
||||||
(append
|
|
||||||
'("<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>
|
|
||||||
<span class=\"details\">
|
|
||||||
(<a href=\"https://gitea.esy.fun/yogsototh\">code</a>
|
|
||||||
<a href=\"https://espial.esy.fun/u:yogsototh\">bookmarks</a>
|
|
||||||
<a href=\"https://espial.esy.fun/u:yogsototh/notes\">notes</a>)</span>")
|
|
||||||
lst)
|
|
||||||
" | ")
|
|
||||||
"</nav>"))
|
|
||||||
|
|
||||||
|
|
||||||
(defun get-from-info (info k)
|
|
||||||
(let ((i (car (plist-get info k))))
|
|
||||||
(when (and i (stringp i))
|
|
||||||
i)))
|
|
||||||
|
|
||||||
(defun logo ()
|
|
||||||
(concat
|
|
||||||
"<div id=\"logo\">"
|
|
||||||
"<a href=\"/\">"
|
|
||||||
"<svg width=\"5em\" viewBox=\"0 0 64 64\">"
|
|
||||||
"<circle cx=\"32\" cy=\"32\" r=\"30\" stroke=\"var(--b2)\" stroke-width=\"2\" fill=\"var(--b03)\"/>"
|
|
||||||
"<circle cx=\"32\" cy=\"32\" r=\"12\" stroke=\"var(--r)\" stroke-width=\"2\" fill=\"var(--o)\"/>"
|
|
||||||
"<circle cx=\"32\" cy=\"32\" r=\"6\" stroke-width=\"0\" fill=\"var(--y)\"/>"
|
|
||||||
"<ellipse cx=\"32\" cy=\"14\" rx=\"14\" ry=\"8\" stroke-width=\"0\" fill=\"var(--b3)\"/>"
|
|
||||||
"</svg>"
|
|
||||||
"</a>"
|
|
||||||
"</div>"))
|
|
||||||
|
|
||||||
(defun relative-link (output-file)
|
|
||||||
"Given an output-file generate a link relative to the URL origin."
|
|
||||||
(replace-regexp-in-string ".*/_site" "" output-file))
|
|
||||||
|
|
||||||
(defun gen-permalink (output-file)
|
|
||||||
"Given the output-file generate a permalink"
|
|
||||||
(format "%s%s"
|
|
||||||
websiteorigin
|
|
||||||
(relative-link output-file)))
|
|
||||||
|
|
||||||
(defun gen-org-src (permalink)
|
|
||||||
"Given a permalink generate the path to the asssociated .org source file"
|
|
||||||
(replace-regexp-in-string "\.html$" ".org" permalink))
|
|
||||||
|
|
||||||
(defun org-blog-preamble (info)
|
|
||||||
"Pre-amble for whole blog."
|
|
||||||
(concat
|
|
||||||
(logo)
|
|
||||||
"<div class=\"content\">"
|
|
||||||
"<h1>"
|
|
||||||
(format "%s" (car (plist-get info :title)))
|
|
||||||
"</h1>"
|
|
||||||
(when-let ((subtitle (car (plist-get info :subtitle))))
|
|
||||||
(format "<h2>%s</h2>" subtitle))
|
|
||||||
(when-let ((date (plist-get info :date)))
|
|
||||||
(concat
|
|
||||||
"<div class=\"author\">"
|
|
||||||
"Yann Esposito"
|
|
||||||
"<br/>"
|
|
||||||
(format "<span class=\"article-date\">%s</span>"
|
|
||||||
(format-time-string "%Y-%m-%d"
|
|
||||||
(org-timestamp-to-time
|
|
||||||
(car date))))
|
|
||||||
"<br/>on "
|
|
||||||
(format " <a href=\"%s\">Yann Esposito's blog</a>" websiteorigin)
|
|
||||||
(let ((permalink (gen-permalink (plist-get info :output-file))))
|
|
||||||
(concat
|
|
||||||
" - "
|
|
||||||
(let ((orgfile (gen-org-src permalink)))
|
|
||||||
(format " <a href=\"%s\">source</a>" orgfile))
|
|
||||||
" - "
|
|
||||||
(format " <a class=\"permalink\" href=\"%s\">§permalink</a>" permalink)))
|
|
||||||
"</div>"))
|
|
||||||
(when-let ((description (plist-get info :description)))
|
|
||||||
(format "<div class=\"abstract\">%s</div>" description))
|
|
||||||
"</div>"))
|
|
||||||
|
|
||||||
(defun rand-obfs (c)
|
|
||||||
(let ((r (% (random) 20)))
|
|
||||||
(cond ;; ((eq 0 r) (format "%c" c))
|
|
||||||
((<= 0 r 10) (format "&#%d;" c))
|
|
||||||
(t (format "&#x%X;" c)))))
|
|
||||||
|
|
||||||
(defun obfuscate-html (txt)
|
|
||||||
(apply 'concat
|
|
||||||
(mapcar 'rand-obfs txt)))
|
|
||||||
|
|
||||||
(defun keywords-to-html (keywords)
|
|
||||||
(let ((keywords (split-string keywords ",\s*")))
|
|
||||||
(format " <span class=\"keywords\">%s</span>"
|
|
||||||
(mapconcat (lambda (k)
|
|
||||||
(format "<code>#%s</code>" k))
|
|
||||||
(cl-sort keywords 'string-lessp :key 'downcase)
|
|
||||||
" "))))
|
|
||||||
|
|
||||||
(defun org-blog-postamble (info)
|
|
||||||
"Post-amble for whole blog."
|
|
||||||
(concat
|
|
||||||
"<div class=\"content\">"
|
|
||||||
;; TODO install a comment system
|
|
||||||
;; (let ((url (format "%s%s" websiteorigin (replace-regexp-in-string base-dir "" (plist-get info :input-file)))))
|
|
||||||
;; (format "<a href=\"https://comments.esy.fun/slug/%s\">comment</a>"
|
|
||||||
;; (url-hexify-string url)))
|
|
||||||
"<footer>"
|
|
||||||
(let* ((author (when-let ((author (get-from-info info :author)))
|
|
||||||
(if-let ((email (plist-get info :email)))
|
|
||||||
(let* ((obfs-email (obfuscate-html email))
|
|
||||||
(obfs-author (obfuscate-html author))
|
|
||||||
(obfs-title (obfuscate-html (get-from-info info :title)))
|
|
||||||
(full-email (format "%s <%s>" obfs-author obfs-email)))
|
|
||||||
(format "<span class=\"author\"><a href=\"%s%s%s%s\">%s</a></span>"
|
|
||||||
(obfuscate-html "mailto:")
|
|
||||||
full-email
|
|
||||||
(obfuscate-html "?subject=yblog: ")
|
|
||||||
obfs-title
|
|
||||||
full-email))
|
|
||||||
(format "<span class=\"author\">%s</span>" author))))
|
|
||||||
(date (when-let ((date (get-from-info info :date)))
|
|
||||||
(format "<div class=\"date\">Created: %s (%s)</div>" date (y-date date))))
|
|
||||||
(keywords (when-let ((keywords (plist-get info :keywords)))
|
|
||||||
(keywords-to-html keywords)))
|
|
||||||
(rss
|
|
||||||
(concat
|
|
||||||
"<div class=\"rss\">"
|
|
||||||
"<a rel=\"alternate\""
|
|
||||||
" type=\"application/rss+xml\""
|
|
||||||
" href=\"/rss.xml\">"
|
|
||||||
"RSS"
|
|
||||||
"</a>"
|
|
||||||
" (<a href=\"https://validator.w3.org/feed/check.cgi?url=https%3A%2F%2Fher.esy.fun%2Frss.xml\">"
|
|
||||||
"validate</a>)"
|
|
||||||
"</div>"))
|
|
||||||
(generated-date
|
|
||||||
(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>")
|
|
||||||
(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>, "
|
|
||||||
"<a href=\"http://spacemacs.org\" target=\"_blank\" rel=\"noopener noreferrer\">Spacemacs %s</a>, "
|
|
||||||
"<a href=\"http://orgmode.org\" target=\"_blank\" rel=\"noopener noreferrer\">Org Mode %s</a>"
|
|
||||||
"</div>")
|
|
||||||
emacs-version spacemacs-version org-version))
|
|
||||||
(website-code
|
|
||||||
"<a href=\"https://gitea.esy.fun/yogsototh/her.esy.fun\" target=\"_blank\" rel=\"noopener noreferrer\">Website source code</a>")
|
|
||||||
(org-src (gen-org-src (relative-link (plist-get info :output-file))))
|
|
||||||
(org-src-link (format "<a href=\"%s\">%s</a>" org-src org-src)))
|
|
||||||
(concat
|
|
||||||
"<i>Any comment? Click on my email below and I'll add it.</i>"
|
|
||||||
"<table>"
|
|
||||||
(mapconcat (lambda (entry)
|
|
||||||
(when (cdr entry)
|
|
||||||
(format "<tr><td>%s</td><td>%s</td></tr>"
|
|
||||||
(car entry) (cdr entry))))
|
|
||||||
`(("author" . ,author)
|
|
||||||
("date" . ,date)
|
|
||||||
("tags" . ,keywords)
|
|
||||||
("rss" . ,rss)
|
|
||||||
("size" . ,size)
|
|
||||||
("gz" . ,gzsize)
|
|
||||||
("generated" . ,generated-date)
|
|
||||||
("gen-with" . ,generated-with)
|
|
||||||
("src" . ,website-code)
|
|
||||||
("org-file" . ,org-src-link))
|
|
||||||
" ")
|
|
||||||
"</table>"))
|
|
||||||
"</footer>"
|
|
||||||
(menu '("<a href=\"#preamble\">↑ Top ↑</a>"))
|
|
||||||
"</div>"))
|
|
||||||
|
|
||||||
(defun date-format-entry (entry _style project)
|
|
||||||
"Return string for each ENTRY in PROJECT."
|
|
||||||
(when (string-match "posts/.*" entry)
|
|
||||||
(let* ((file (org-publish--expand-file-name entry project))
|
|
||||||
(title (org-publish-find-title entry project))
|
|
||||||
(artdate (format-time-string "%Y-%m-%d" (org-publish-find-date entry project)))
|
|
||||||
(description (org-publish-find-property entry :description project 'html)))
|
|
||||||
(concat
|
|
||||||
(format " @@html:<span class=\"metas\">%s</span>@@: " artdate)
|
|
||||||
(format " *[[file:%s][%s]]*" file title)
|
|
||||||
(format " @@html:<div class=\"description\">%s</div>@@" description)
|
|
||||||
(format " @@html:<div class=\"metas\">@@ ")
|
|
||||||
" @@html:</div>@@\n"))))
|
|
||||||
|
|
||||||
(defun org-blog-sitemap-fn-descr (_descr title list)
|
|
||||||
"Return sitemap using TITLE and LIST returned by `org-blog-sitemap-format-entry'."
|
|
||||||
(concat "#+TITLE: " title "\n"
|
|
||||||
"#+AUTHOR: " author-name "\n"
|
|
||||||
"#+EMAIL: " author-email "\n"
|
|
||||||
(concat "@@html:" (menu '()) "@@")
|
|
||||||
"\n\n"
|
|
||||||
(mapconcat (lambda (li) (format "%s" (car li)))
|
|
||||||
(seq-filter #'car (cdr list))
|
|
||||||
"\n")))
|
|
||||||
|
|
||||||
(defun org-blog-prepare (project-plist)
|
|
||||||
"With help from `https://github.com/howardabrams/dot-files'.
|
|
||||||
Touch `archive.org' to rebuilt it.
|
|
||||||
Argument `PROJECT-PLIST' contains information about the current project."
|
|
||||||
(let* ((base-directory (plist-get project-plist :base-directory))
|
|
||||||
(buffer (find-file-noselect (expand-file-name "archive.org" base-directory) t)))
|
|
||||||
(with-current-buffer buffer
|
|
||||||
(set-buffer-modified-p t)
|
|
||||||
(save-buffer 0))
|
|
||||||
(kill-buffer buffer)))
|
|
||||||
|
|
||||||
(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))
|
|
||||||
(mk-path (format "./%s.html"
|
|
||||||
(replace-regexp-in-string ".*/\\([^/]*\\)\\.org$"
|
|
||||||
"\\1"
|
|
||||||
filename))))
|
|
||||||
(with-current-buffer (find-file-noselect file-path)
|
|
||||||
(goto-char (point-min))
|
|
||||||
(search-forward "<body>")
|
|
||||||
(insert (mapconcat 'identity
|
|
||||||
`("<input name=\"t\" type=\"radio\" id=\"l\">"
|
|
||||||
"<input name=\"t\" type=\"radio\" id=\"d\">"
|
|
||||||
|
|
||||||
"<div id=\"labels\">"
|
|
||||||
"<div class=\"content\">"
|
|
||||||
"<label for=\"l\">light</label>"
|
|
||||||
"|"
|
|
||||||
"<label for=\"d\">dark</label>"
|
|
||||||
"</div>"
|
|
||||||
"</div>"
|
|
||||||
"<div class=\"main\">")
|
|
||||||
"\n"))
|
|
||||||
(goto-char (point-max))
|
|
||||||
(search-backward "</body>")
|
|
||||||
(insert "\n</div>\n")
|
|
||||||
(save-buffer)
|
|
||||||
(kill-buffer))
|
|
||||||
file-path))
|
|
||||||
|
|
||||||
(defun compress-image (filename dst-file)
|
|
||||||
"Compress images using imagemagick"
|
|
||||||
(shell-command
|
|
||||||
(format
|
|
||||||
(concat
|
|
||||||
"~/.nix-profile/bin/convert"
|
|
||||||
" %s" ;; source
|
|
||||||
" -sampling-factor 4:2:0"
|
|
||||||
" -strip"
|
|
||||||
" -resize 320x320\\>"
|
|
||||||
" -interlace Plane"
|
|
||||||
" -quality 85"
|
|
||||||
" -define filter:blur=0.75"
|
|
||||||
" -filter Gaussian"
|
|
||||||
" -ordered-dither o4x4,4"
|
|
||||||
" %s" ;; dest
|
|
||||||
)
|
|
||||||
filename
|
|
||||||
dst-file)))
|
|
||||||
|
|
||||||
(defun compress-css (root-dir filename dst-file)
|
|
||||||
"Compress CSS usin compresscss.sh script"
|
|
||||||
(shell-command
|
|
||||||
(format "%s/engine/compresscss.sh %s %s" root-dir filename dst-file)))
|
|
||||||
|
|
||||||
(defun org-blog-publish-attachment (plist filename pub-dir)
|
|
||||||
"Publish a file with no transformation of any kind.
|
|
||||||
FILENAME is the filename of the Org file to be published. PLIST
|
|
||||||
is the property list for the given project. PUB-DIR is the
|
|
||||||
publishing directory.
|
|
||||||
Take care of minimizing the pictures using imagemagick.
|
|
||||||
Return output file name."
|
|
||||||
(unless (file-directory-p pub-dir)
|
|
||||||
(make-directory pub-dir t))
|
|
||||||
(or (equal (expand-file-name (file-name-directory filename))
|
|
||||||
(file-name-as-directory (expand-file-name pub-dir)))
|
|
||||||
(let ((dst-file (expand-file-name (file-name-nondirectory filename) pub-dir)))
|
|
||||||
(cond ((string-match-p ".*\\.\\(png\\|jpg\\|jpeg\\|gif\\)$" filename)
|
|
||||||
(compress-image filename dst-file))
|
|
||||||
((string-match-p ".*\\.css$" filename)
|
|
||||||
(compress-css root-dir filename dst-file))
|
|
||||||
(t (copy-file filename dst-file t))))))
|
|
||||||
|
|
||||||
(defalias 'org-blog-posts-sitemap-fn
|
|
||||||
(apply-partially 'org-blog-sitemap-fn-descr ""))
|
|
||||||
|
|
||||||
(setq org-html-htmlize-output-type 'css)
|
|
||||||
(setq org-html-htmlize-font-prefix "org-")
|
|
||||||
(setq org-publish-project-alist
|
|
||||||
`(("orgfiles"
|
|
||||||
:base-directory ,base-dir
|
|
||||||
:exclude ".*drafts/.*"
|
|
||||||
:base-extension "org"
|
|
||||||
:publishing-directory ,publish-dir
|
|
||||||
:recursive t
|
|
||||||
:preparation-function org-blog-prepare
|
|
||||||
:publishing-function org-blog-publish-to-html
|
|
||||||
:with-toc nil
|
|
||||||
:with-title nil
|
|
||||||
:with-date t
|
|
||||||
:section-numbers nil
|
|
||||||
:html-doctype "html5"
|
|
||||||
:html-html5-fancy t
|
|
||||||
:html-head-include-default-style nil
|
|
||||||
:html-head-include-scripts nil
|
|
||||||
:htmlized-source t
|
|
||||||
:html-head-extra ,org-blog-head
|
|
||||||
:html-preamble org-blog-preamble
|
|
||||||
:html-postamble org-blog-postamble
|
|
||||||
|
|
||||||
:auto-sitemap t
|
|
||||||
:sitemap-filename "archive.org"
|
|
||||||
:sitemap-title "Articles"
|
|
||||||
:sitemap-style list
|
|
||||||
:sitemap-sort-files anti-chronologically
|
|
||||||
:sitemap-format-entry date-format-entry
|
|
||||||
:sitemap-function org-blog-posts-sitemap-fn)
|
|
||||||
|
|
||||||
("css"
|
|
||||||
:base-directory ,assets-dir
|
|
||||||
:base-extension "css"
|
|
||||||
:publishing-directory ,publish-assets-dir
|
|
||||||
:publishing-function org-blog-publish-attachment
|
|
||||||
:recursive t)
|
|
||||||
|
|
||||||
("img"
|
|
||||||
:base-directory ,assets-dir
|
|
||||||
:base-extension "(jpg|png|gif|jpeg)"
|
|
||||||
:publishing-directory ,publish-assets-dir
|
|
||||||
:publishing-function org-blog-publish-attachment
|
|
||||||
:recursive t)
|
|
||||||
|
|
||||||
("files"
|
|
||||||
:base-directory ,assets-dir
|
|
||||||
:base-extension ".*"
|
|
||||||
:exclude ".*\.(org|css|jpg|png|gif|jpeg)$"
|
|
||||||
:publishing-directory ,publish-assets-dir
|
|
||||||
:publishing-function org-blog-publish-attachment
|
|
||||||
:recursive t)
|
|
||||||
|
|
||||||
("draft-org-files"
|
|
||||||
:base-directory ,base-dir
|
|
||||||
:base-extension "org"
|
|
||||||
:publishing-directory ,draft-publish-dir
|
|
||||||
:recursive t
|
|
||||||
:preparation-function org-blog-prepare
|
|
||||||
:publishing-function org-blog-publish-to-html
|
|
||||||
:with-toc nil
|
|
||||||
:with-title nil
|
|
||||||
:with-date t
|
|
||||||
:section-numbers nil
|
|
||||||
:html-doctype "html5"
|
|
||||||
:html-html5-fancy t
|
|
||||||
:html-head-include-default-style nil
|
|
||||||
:html-head-include-scripts nil
|
|
||||||
:htmlized-source t
|
|
||||||
:html-head-extra ,org-blog-head
|
|
||||||
:html-preamble org-blog-preamble
|
|
||||||
:html-postamble org-blog-postamble)
|
|
||||||
("draft-css"
|
|
||||||
:base-directory ,assets-dir
|
|
||||||
:base-extension "css"
|
|
||||||
:publishing-directory ,draft-publish-assets-dir
|
|
||||||
:publishing-function org-blog-publish-attachment
|
|
||||||
:recursive t)
|
|
||||||
("draft-img"
|
|
||||||
:base-directory ,assets-dir
|
|
||||||
:base-extension "(jpg|png|gif|jpeg)"
|
|
||||||
:publishing-directory ,draft-publish-assets-dir
|
|
||||||
:publishing-function org-blog-publish-attachment
|
|
||||||
:recursive t)
|
|
||||||
("draft-files"
|
|
||||||
:base-directory ,assets-dir
|
|
||||||
:base-extension ".*"
|
|
||||||
:include ".*\.(org|css|jpg|png|gif|jpeg)$"
|
|
||||||
:publishing-directory ,draft-publish-assets-dir
|
|
||||||
:publishing-function org-blog-publish-attachment
|
|
||||||
:recursive t)
|
|
||||||
|
|
||||||
("assets" :components ("css" "img" "files"))
|
|
||||||
("blog" :components ("orgfiles" "assets"))
|
|
||||||
("draft-assets" :components ("draft-css" "draft-img" "draft-files"))
|
|
||||||
("draft" :components ("draft-org-files" "draft-assets"))))
|
|
||||||
|
|
||||||
;; add target=_blank and rel="noopener noreferrer" to all links by default
|
|
||||||
(defun my-org-export-add-target-blank-to-http-links (text backend info)
|
|
||||||
"Add target=\"_blank\" to external links."
|
|
||||||
(when (and
|
|
||||||
(org-export-derived-backend-p backend 'html)
|
|
||||||
(string-match "href=\"http[^\"]+" text)
|
|
||||||
(not (string-match "target=\"" text))
|
|
||||||
(not (string-match (concat "href=\"" websiteorigin "[^\"]*") text)))
|
|
||||||
(string-match "<a " text)
|
|
||||||
(replace-match "<a target=\"_blank\" rel=\"noopener noreferrer\" " nil nil text)))
|
|
||||||
|
|
||||||
(add-to-list 'org-export-filter-link-functions
|
|
||||||
'my-org-export-add-target-blank-to-http-links)
|
|
||||||
|
|
||||||
(defun my-add-link-to-tangled-files (backend)
|
|
||||||
"Add a link just before source code block with tangled files.
|
|
||||||
BACKEND is the export backend. Used as symbol."
|
|
||||||
(while ;; (re-search-forward )
|
|
||||||
(re-search-forward "^\\( *\\)#\\+begin_src .*:tangle \\([^\s\n]*\\)" nil t)
|
|
||||||
(replace-match "\\1#+CAPTION: [[./\\2][=\\2=]]\n\\&")))
|
|
||||||
|
|
||||||
(setq org-export-before-processing-hook nil)
|
|
||||||
(add-hook 'org-export-before-processing-hook
|
|
||||||
'my-add-link-to-tangled-files)
|
|
||||||
|
|
||||||
(provide 'her-esy-fun-publish)
|
|
BIN
project.el.sig
BIN
project.el.sig
Binary file not shown.
|
@ -293,7 +293,6 @@ Typically for Haskell projects.
|
||||||
[fn:direnv] https://direnv.net
|
[fn:direnv] https://direnv.net
|
||||||
[fn:lorri] https://github.com/target/lorri
|
[fn:lorri] https://github.com/target/lorri
|
||||||
|
|
||||||
|
|
||||||
** Install
|
** Install
|
||||||
:PROPERTIES:
|
:PROPERTIES:
|
||||||
:CUSTOM_ID: install
|
:CUSTOM_ID: install
|
||||||
|
|
|
@ -48,8 +48,7 @@ priority:
|
||||||
referrer for all external links, etc...)
|
referrer for all external links, etc...)
|
||||||
{{{br}}}
|
{{{br}}}
|
||||||
{{{br}}}
|
{{{br}}}
|
||||||
2. *Almost javascript free*; no js at all except for a single exception,
|
2. *javascript free*; no js at all (math is rendered with MathML).
|
||||||
pages containing Math formulæ are displayed using mathjax.
|
|
||||||
{{{br}}}
|
{{{br}}}
|
||||||
{{{br}}}
|
{{{br}}}
|
||||||
3. *Accessibility*; should be easy to read on a text browser so people with
|
3. *Accessibility*; should be easy to read on a text browser so people with
|
||||||
|
|
Loading…
Reference in a new issue