Wave changes
This commit is contained in:
88
lisp/build.el
Executable file → Normal file
88
lisp/build.el
Executable file → Normal file
@@ -153,6 +153,20 @@
|
||||
<script src=\"/assets/scripts/svg-pan-zoom.min.js\" defer></script>
|
||||
<script src=\"/assets/scripts/gallery-init.js\" defer></script>
|
||||
<script src=\"/assets/scripts/cookbook.js\" defer></script>
|
||||
|
||||
<script src=\"/assets/scripts/mermaid.min.js\"></script>
|
||||
<script>
|
||||
window.addEventListener('load', function() {
|
||||
mermaid.initialize({ startOnLoad: false, theme: 'neutral' });
|
||||
document.querySelectorAll('.mermaid').forEach(el => {
|
||||
el.innerHTML = el.innerHTML
|
||||
.replace(/>/g, '>')
|
||||
.replace(/</g, '<')
|
||||
.replace(/&/g, '&');
|
||||
});
|
||||
mermaid.run({ querySelector: '.mermaid' });
|
||||
});
|
||||
</script>
|
||||
"
|
||||
)
|
||||
|
||||
@@ -160,9 +174,6 @@
|
||||
"
|
||||
<div class=\"banner-header\">
|
||||
<div class=\"banner-left\">
|
||||
<a href=\"/20241210233721-brain_moc.html\"> <img src=\"/assets/gr.png\" alt=\"Site Logo\" class=\"banner-logo\" /> </a>
|
||||
|
||||
<div id=\"updated\">Updated: %C</div>
|
||||
</div>
|
||||
|
||||
<div class=\"banner-search\">
|
||||
@@ -213,6 +224,21 @@ Created with %c on <a href=\"https://www.archlinux.org/\">Arch</a> <a href=\"htt
|
||||
;; Configure LaTeX image generation
|
||||
(setq org-latex-create-formula-image-program 'imagemagick)
|
||||
|
||||
(defun z/org-html-mermaid-block (code _lang)
|
||||
"Export a mermaid src block as a mermaid div."
|
||||
(format "<div class=\"mermaid\">\n%s\n</div>" code))
|
||||
|
||||
;; Hook into ox-html's src block export
|
||||
(defun z/org-html-src-block-mermaid (orig-fun src-block contents info)
|
||||
(let ((lang (org-element-property :language src-block)))
|
||||
(if (string= lang "mermaid")
|
||||
(let ((code (org-remove-indentation
|
||||
(org-element-property :value src-block))))
|
||||
(format "<div class=\"mermaid\">\n%s\n</div>" code))
|
||||
(funcall orig-fun src-block contents info))))
|
||||
|
||||
(advice-add 'org-html-src-block :around #'z/org-html-src-block-mermaid)
|
||||
|
||||
(defun my/get-org-roam-backlinks (filename)
|
||||
"Return backlinks for the given org-roam file. FILENAME should be the full path to the org-roam file."
|
||||
(save-excursion
|
||||
@@ -291,6 +317,48 @@ Created with %c on <a href=\"https://www.archlinux.org/\">Arch</a> <a href=\"htt
|
||||
(insert "\n")))))
|
||||
(message "✅ all-files.org generated"))))
|
||||
|
||||
;; -------------------------------------------------------
|
||||
;; MOV → MP4 conversion
|
||||
;; Converts all .mov files found anywhere under assets/ to
|
||||
;; .mp4 siblings IN THE SOURCE directory before publishing.
|
||||
;; org-publish then copies both the .mov and the .mp4.
|
||||
;; Skips conversion if an up-to-date .mp4 already exists.
|
||||
;; -------------------------------------------------------
|
||||
|
||||
(defun z/convert-mov-to-mp4 (assets-dir)
|
||||
"Recursively convert every .mov under ASSETS-DIR to an .mp4 sibling.
|
||||
Skips files where the .mp4 already exists and is newer than the .mov."
|
||||
(message "🎬 Scanning %s for .mov files…" assets-dir)
|
||||
(let ((mov-files
|
||||
(directory-files-recursively assets-dir "\\.mov$" nil)))
|
||||
(if (null mov-files)
|
||||
(message " (no .mov files found)")
|
||||
(dolist (mov mov-files)
|
||||
(let* ((mp4 (concat (file-name-sans-extension mov) ".mp4"))
|
||||
(mov-mtime (float-time (nth 5 (file-attributes mov))))
|
||||
(mp4-mtime (if (file-exists-p mp4)
|
||||
(float-time (nth 5 (file-attributes mp4)))
|
||||
-1)))
|
||||
(if (> mp4-mtime mov-mtime)
|
||||
(message " [skip] %s (mp4 is up to date)" (file-name-nondirectory mov))
|
||||
(message " [convert] %s → %s"
|
||||
(file-relative-name mov assets-dir)
|
||||
(file-name-nondirectory mp4))
|
||||
(let ((exit-code
|
||||
(call-process "ffmpeg" nil nil nil
|
||||
"-i" mov
|
||||
"-c:v" "libx264"
|
||||
"-preset" "fast"
|
||||
"-crf" "23"
|
||||
"-c:a" "aac"
|
||||
"-b:a" "128k"
|
||||
"-movflags" "+faststart"
|
||||
"-y" mp4)))
|
||||
(if (= exit-code 0)
|
||||
(message " [done] %s" (file-name-nondirectory mp4))
|
||||
(message " [ERROR] ffmpeg exited %d for %s"
|
||||
exit-code (file-name-nondirectory mov))))))))))
|
||||
|
||||
(setq org-publish-project-alist
|
||||
`(
|
||||
("org-roam"
|
||||
@@ -311,7 +379,7 @@ Created with %c on <a href=\"https://www.archlinux.org/\">Arch</a> <a href=\"htt
|
||||
|
||||
("org-static"
|
||||
:base-directory "/home/zaine/master-folder/org_files/org_roam/assets/"
|
||||
:base-extension "css\\|js\\|png\\|jpg\\|gif\\|svg\\|mp4\\|mp3"
|
||||
:base-extension "css\\|js\\|png\\|jpg\\|gif\\|svg\\|mp4\\|mp3\\|mov"
|
||||
:publishing-directory "/home/zaine/master-folder/org_files/org_roam/output/assets/"
|
||||
:recursive t
|
||||
:publishing-function org-publish-attachment)))
|
||||
@@ -341,9 +409,12 @@ Created with %c on <a href=\"https://www.archlinux.org/\">Arch</a> <a href=\"htt
|
||||
(message "Starting full rebuild at %s"
|
||||
(format-time-string "%Y-%m-%d %H:%M:%S" start-time))
|
||||
|
||||
;; IMPORTANT: refresh roam DB after syncthing updates
|
||||
(org-id-update-id-locations)
|
||||
;(z/refresh-org-roam)
|
||||
|
||||
;; Convert any .mov files before publishing so org-publish
|
||||
;; picks up the .mp4 siblings automatically.
|
||||
(z/convert-mov-to-mp4
|
||||
"/home/zaine/master-folder/org_files/org_roam/assets/")
|
||||
|
||||
(setq z/build-full-rebuild t)
|
||||
(z/generate-all-files-org)
|
||||
@@ -356,6 +427,11 @@ Created with %c on <a href=\"https://www.archlinux.org/\">Arch</a> <a href=\"htt
|
||||
(defun z/build-fast ()
|
||||
"Fast rebuild: Org + assets only (no JSON)."
|
||||
(interactive)
|
||||
|
||||
;; Convert MOVs in fast builds too — cheap (skips up-to-date files).
|
||||
(z/convert-mov-to-mp4
|
||||
"/home/zaine/master-folder/org_files/org_roam/assets/")
|
||||
|
||||
(setq z/build-full-rebuild nil)
|
||||
(org-publish "org-roam" t)
|
||||
(org-publish "org-static" t)
|
||||
|
||||
0
lisp/macros.el
Executable file → Normal file
0
lisp/macros.el
Executable file → Normal file
Reference in New Issue
Block a user