This commit is contained in:
@@ -414,6 +414,15 @@ Created with %c on <a href=\"https://www.archlinux.org/\">Arch</a> \
|
||||
(make-directory target t)
|
||||
(copy-directory d target t t t)))))
|
||||
|
||||
(defun z/markdown-h1-title (filename fallback)
|
||||
"Return the first Markdown H1 title in FILENAME, or FALLBACK."
|
||||
(with-temp-buffer
|
||||
(insert-file-contents filename nil 0 4096)
|
||||
(goto-char (point-min))
|
||||
(if (re-search-forward "^# +\\(.+?\\)\\s-*$" nil t)
|
||||
(match-string 1)
|
||||
fallback)))
|
||||
|
||||
(defun z/publish-lima-file (plist filename pub-dir)
|
||||
"Publish an Org or Markdown file from the lima directory."
|
||||
(let* ((ext (downcase (or (file-name-extension filename) "")))
|
||||
@@ -440,7 +449,7 @@ Created with %c on <a href=\"https://www.archlinux.org/\">Arch</a> \
|
||||
(insert-file-contents temp-org)
|
||||
(goto-char (point-min))
|
||||
(insert (format "#+TITLE: %s\n#+OPTIONS: num:nil\n#+DATE: %s\n#+COMMENTS: t\n#+SLUG: %s\n\n"
|
||||
base
|
||||
(z/markdown-h1-title filename base)
|
||||
(format-time-string "<%Y-%m-%d %a %H:%M>")
|
||||
base))
|
||||
(write-region (point-min) (point-max) temp-org))
|
||||
@@ -491,7 +500,7 @@ Created with %c on <a href=\"https://www.archlinux.org/\">Arch</a> \
|
||||
|
||||
("org-assets"
|
||||
:base-directory ,(site-path "assets/")
|
||||
:base-extension "css\\|js\\|png\\|jpg\\|gif\\|svg\\|pdf\\|woff\\|woff2\\|ttf"
|
||||
:base-extension "css\\|js\\|png\\|jpg\\|jpeg\\|gif\\|webp\\|svg\\|pdf\\|mp4\\|webm\\|mov\\|woff\\|woff2\\|ttf"
|
||||
:publishing-directory ,(site-path "output/assets/")
|
||||
:recursive t
|
||||
:publishing-function org-publish-attachment)
|
||||
|
||||
Reference in New Issue
Block a user