major changes
This commit is contained in:
294
build-site.el
Normal file → Executable file
294
build-site.el
Normal file → Executable file
@@ -11,8 +11,18 @@
|
||||
;;; Code:
|
||||
|
||||
(require 'package)
|
||||
(defvar site-root
|
||||
(file-name-directory
|
||||
(or load-file-name buffer-file-name)))
|
||||
|
||||
(add-to-list 'load-path "~/master-folder/org_files/org_web/lisp/")
|
||||
(defun site-path (path)
|
||||
(expand-file-name path site-root))
|
||||
|
||||
|
||||
(add-to-list 'load-path
|
||||
(expand-file-name "lisp"
|
||||
(file-name-directory
|
||||
(or load-file-name buffer-file-name))))
|
||||
|
||||
(require 'recently-updated)
|
||||
(require 'tags)
|
||||
@@ -28,6 +38,7 @@
|
||||
(require 'org)
|
||||
(require 'ox)
|
||||
(require 'ox-html)
|
||||
(require 'ox-md)
|
||||
|
||||
(package-initialize)
|
||||
(unless package-archive-contents
|
||||
@@ -205,6 +216,40 @@ A file has comments if:
|
||||
#'z/org-html-insert-comments-into-body)
|
||||
|
||||
|
||||
(defun z/publish-lima-file (plist filename pub-dir)
|
||||
"Publish Org or Markdown file from lima directory."
|
||||
(let* ((ext (file-name-extension filename))
|
||||
(base (file-name-base filename))
|
||||
(output-file (expand-file-name
|
||||
(concat base ".html")
|
||||
pub-dir)))
|
||||
|
||||
;; Ensure output directory exists
|
||||
(make-directory pub-dir t)
|
||||
|
||||
(cond
|
||||
;; ORG FILES
|
||||
((string= ext "org")
|
||||
(org-publish-org-to 'z-html filename ".html" plist pub-dir))
|
||||
|
||||
;; MARKDOWN FILES
|
||||
((string= ext "md")
|
||||
(message "Converting %s → %s" filename output-file)
|
||||
(let ((exit-code
|
||||
(call-process
|
||||
"pandoc"
|
||||
nil
|
||||
"*pandoc-output*"
|
||||
t
|
||||
filename
|
||||
"-o"
|
||||
output-file
|
||||
"--standalone")))
|
||||
(unless (eq exit-code 0)
|
||||
(error "Pandoc failed with exit code %s" exit-code)))))))
|
||||
|
||||
|
||||
|
||||
|
||||
(setq org-html-htmlize-output-type 'css)
|
||||
|
||||
@@ -222,36 +267,35 @@ A file has comments if:
|
||||
(setq org-publish-project-alist
|
||||
`(("org-main"
|
||||
:recursive t
|
||||
:base-directory "~/master-folder/org_files/org_web/"
|
||||
:base-directory ,(site-path "")
|
||||
:publishing-function z/z-publish-to-html
|
||||
:publishing-directory "~/master-folder/org_files/org_web/output"
|
||||
:publishing-directory ,(site-path "output/")
|
||||
:base-extension "org"
|
||||
:auto-sitemap t
|
||||
:sitemap-filename "sitemap.org"
|
||||
:sitemap-title "Sitemap"
|
||||
:sitemap-sort-files chronologically
|
||||
:auto-sitemap t
|
||||
:sitemap-filename "sitemap.org"
|
||||
:sitemap-title "Sitemap"
|
||||
:sitemap-sort-files chronologically
|
||||
:html-preamble ,z-preamble
|
||||
:html-postamble ,z-postamble
|
||||
:html-head ,z-shared-head
|
||||
:preparation-function z/org-main-prep
|
||||
)
|
||||
|
||||
("org-categories-sitemap"
|
||||
:html-head ,z-shared-head
|
||||
:preparation-function z/org-main-prep)
|
||||
|
||||
("org-categories-sitemap"
|
||||
:recursive t
|
||||
:base-directory "~/master-folder/org_files/org_web/home"
|
||||
:publishing-directory "~/master-folder/org_files/org_web/output/home"
|
||||
:base-directory ,(site-path "home/")
|
||||
:publishing-directory ,(site-path "output/home/")
|
||||
:base-extension "org"
|
||||
:auto-sitemap t
|
||||
:sitemap-filename "categories.org"
|
||||
:sitemap-title "Categories"
|
||||
:sitemap-function z/categories-sitemap
|
||||
:html-preamble ,z-preamble
|
||||
:auto-sitemap t
|
||||
:sitemap-filename "categories.org"
|
||||
:sitemap-title "Categories"
|
||||
:sitemap-function z/categories-sitemap
|
||||
:html-preamble ,z-preamble
|
||||
:html-postamble ,z-postamble
|
||||
:html-head ,z-shared-head
|
||||
)
|
||||
:html-head ,z-shared-head)
|
||||
|
||||
("org-posts"
|
||||
:base-directory "~/master-folder/org_files/org_web/posts"
|
||||
:publishing-directory "~/master-folder/org_files/org_web/output/posts/"
|
||||
:base-directory ,(site-path "posts/")
|
||||
:publishing-directory ,(site-path "output/posts/")
|
||||
:recursive t
|
||||
:base-extension "org"
|
||||
:publishing-function z/z-publish-to-html
|
||||
@@ -260,19 +304,19 @@ A file has comments if:
|
||||
:html-validation-link nil
|
||||
:with-toc t
|
||||
:section-numbers t
|
||||
:html-preamble ,z-preamble
|
||||
:html-preamble ,z-preamble
|
||||
:html-postamble ,z-postamble
|
||||
:auto-sitemap t
|
||||
:sitemap-filename "posts-list.org"
|
||||
:sitemap-title "Posts List"
|
||||
:sitemap-style list
|
||||
:sitemap-function z/posts-sitemap
|
||||
:sitemap-sort-files anti-chronologically
|
||||
:html-head ,z-shared-head
|
||||
)
|
||||
("org-blogs"
|
||||
:base-directory "~/master-folder/org_files/org_web/blogs"
|
||||
:publishing-directory "~/master-folder/org_files/org_web/output/blogs/"
|
||||
:auto-sitemap t
|
||||
:sitemap-filename "posts-list.org"
|
||||
:sitemap-title "Posts List"
|
||||
:sitemap-style list
|
||||
:sitemap-function z/posts-sitemap
|
||||
:sitemap-sort-files anti-chronologically
|
||||
:html-head ,z-shared-head)
|
||||
|
||||
("org-blogs"
|
||||
:base-directory ,(site-path "blogs/")
|
||||
:publishing-directory ,(site-path "output/blogs/")
|
||||
:recursive t
|
||||
:base-extension "org"
|
||||
:publishing-function z/z-publish-to-html
|
||||
@@ -281,131 +325,131 @@ A file has comments if:
|
||||
:html-validation-link nil
|
||||
:html-preamble ,z-preamble
|
||||
:html-postamble ,z-postamble
|
||||
:auto-sitemap t
|
||||
:sitemap-filename "blogs-list.org"
|
||||
:sitemap-title "Blogs List"
|
||||
:sitemap-style list
|
||||
:sitemap-function z/blogs-sitemap
|
||||
:sitemap-sort-files anti-chronologically
|
||||
:html-head ,z-shared-head
|
||||
)
|
||||
("org-books"
|
||||
:base-directory "~/master-folder/org_files/org_web/books/"
|
||||
:publishing-directory "~/master-folder/org_files/org_web/output/books/"
|
||||
:auto-sitemap t
|
||||
:sitemap-filename "blogs-list.org"
|
||||
:sitemap-title "Blogs List"
|
||||
:sitemap-style list
|
||||
:sitemap-function z/blogs-sitemap
|
||||
:sitemap-sort-files anti-chronologically
|
||||
:html-head ,z-shared-head)
|
||||
|
||||
("org-books"
|
||||
:base-directory ,(site-path "books/")
|
||||
:publishing-directory ,(site-path "output/books/")
|
||||
:recursive t
|
||||
:base-extension "org"
|
||||
:publishing-function z/z-publish-to-html
|
||||
:with-author nil
|
||||
:with-creator nil
|
||||
:html-validation-link nil
|
||||
:html-preamble ,z-preamble
|
||||
:html-postamble ,z-postamble
|
||||
:auto-sitemap t
|
||||
:sitemap-filename "books-list.org"
|
||||
:sitemap-title "Books List"
|
||||
:sitemap-style list
|
||||
:sitemap-function z/books-sitemap
|
||||
:sitemap-sort-files anti-chronologically
|
||||
:html-head ,z-shared-head
|
||||
)
|
||||
:auto-sitemap t
|
||||
:sitemap-filename "books-list.org"
|
||||
:sitemap-title "Books List"
|
||||
:sitemap-style list
|
||||
:sitemap-function z/books-sitemap
|
||||
:sitemap-sort-files anti-chronologically
|
||||
:html-head ,z-shared-head)
|
||||
|
||||
("org-2025"
|
||||
:base-directory "~/master-folder/org_files/org_web/blogs/2025/"
|
||||
:publishing-directory "~/master-folder/org_files/org_web/output/blogs/2025/"
|
||||
:base-directory ,(site-path "blogs/2025/")
|
||||
:publishing-directory ,(site-path "output/blogs/2025/")
|
||||
:recursive t
|
||||
:base-extension "org"
|
||||
:publishing-function z/z-publish-to-html
|
||||
:with-author nil
|
||||
:with-creator nil
|
||||
:html-validation-link nil
|
||||
:html-preamble ,z-preamble
|
||||
:html-postamble ,z-postamble
|
||||
:auto-sitemap t
|
||||
:sitemap-filename "2025-list.org"
|
||||
:sitemap-title "2025 List"
|
||||
:sitemap-style list
|
||||
:sitemap-function z/2025-sitemap
|
||||
:sitemap-sort-files anti-chronologically
|
||||
:html-head ,z-shared-head
|
||||
)
|
||||
("org-2026"
|
||||
:base-directory "~/master-folder/org_files/org_web/blogs/2026/"
|
||||
:publishing-directory "~/master-folder/org_files/org_web/output/blogs/2026/"
|
||||
:auto-sitemap t
|
||||
:sitemap-filename "2025-list.org"
|
||||
:sitemap-title "2025 List"
|
||||
:sitemap-style list
|
||||
:sitemap-function z/2025-sitemap
|
||||
:sitemap-sort-files anti-chronologically
|
||||
:html-head ,z-shared-head)
|
||||
|
||||
("org-2026"
|
||||
:base-directory ,(site-path "blogs/2026/")
|
||||
:publishing-directory ,(site-path "output/blogs/2026/")
|
||||
:recursive t
|
||||
:base-extension "org"
|
||||
:publishing-function z/z-publish-to-html
|
||||
:with-author nil
|
||||
:with-creator nil
|
||||
:html-validation-link nil
|
||||
:html-preamble ,z-preamble
|
||||
:html-postamble ,z-postamble
|
||||
:auto-sitemap t
|
||||
:sitemap-filename "2026-list.org"
|
||||
:sitemap-title "2026 List"
|
||||
:sitemap-style list
|
||||
:sitemap-function z/2026-sitemap
|
||||
:sitemap-sort-files anti-chronologically
|
||||
:html-head ,z-shared-head
|
||||
)
|
||||
("org-career"
|
||||
:base-directory "~/master-folder/org_files/org_web/posts/career/"
|
||||
:publishing-directory "~/master-folder/org_files/org_web/output/posts/career/"
|
||||
:auto-sitemap t
|
||||
:sitemap-filename "2026-list.org"
|
||||
:sitemap-title "2026 List"
|
||||
:sitemap-style list
|
||||
:sitemap-function z/2026-sitemap
|
||||
:sitemap-sort-files anti-chronologically
|
||||
:html-head ,z-shared-head)
|
||||
|
||||
("org-career"
|
||||
:base-directory ,(site-path "posts/career/")
|
||||
:publishing-directory ,(site-path "output/posts/career/")
|
||||
:recursive t
|
||||
:base-extension "org"
|
||||
:publishing-function z/z-publish-to-html
|
||||
:with-author nil
|
||||
:with-creator nil
|
||||
:html-validation-link nil
|
||||
:html-preamble ,z-preamble
|
||||
:html-postamble ,z-postamble
|
||||
:auto-sitemap t
|
||||
:sitemap-filename "career-list.org"
|
||||
:sitemap-title "Career List"
|
||||
:sitemap-style list
|
||||
:sitemap-function z/career-sitemap
|
||||
:sitemap-sort-files anti-chronologically
|
||||
:html-head ,z-shared-head
|
||||
)
|
||||
("wip-pages"
|
||||
:base-directory "~/master-folder/org_files/org_web/"
|
||||
:publishing-directory "~/master-folder/org_files/org_web/output/"
|
||||
:auto-sitemap t
|
||||
:sitemap-filename "career-list.org"
|
||||
:sitemap-title "Career List"
|
||||
:sitemap-style list
|
||||
:sitemap-function z/career-sitemap
|
||||
:sitemap-sort-files anti-chronologically
|
||||
:html-head ,z-shared-head)
|
||||
|
||||
("wip-pages"
|
||||
:base-directory ,(site-path "")
|
||||
:publishing-directory ,(site-path "output/")
|
||||
:recursive t
|
||||
:base-extension "org"
|
||||
:publishing-function z/z-publish-to-html
|
||||
:with-author nil
|
||||
:with-creator nil
|
||||
:html-validation-link nil
|
||||
:html-preamble ,z-preamble
|
||||
:html-postamble ,z-postamble
|
||||
:auto-sitemap t
|
||||
:sitemap-filename "wip.org"
|
||||
:sitemap-title "Work in progress"
|
||||
:sitemap-style list
|
||||
:sitemap-function z/wip-sitemap
|
||||
:sitemap-sort-files anti-chronologically
|
||||
:html-head ,z-shared-head
|
||||
)
|
||||
("org-tags"
|
||||
:base-directory "~/master-folder/org_files/org_web/tags"
|
||||
:publishing-directory "~/master-folder/org_files/org_web/output/tags"
|
||||
:auto-sitemap t
|
||||
:sitemap-filename "wip.org"
|
||||
:sitemap-title "Work in progress"
|
||||
:sitemap-style list
|
||||
:sitemap-function z/wip-sitemap
|
||||
:sitemap-sort-files anti-chronologically
|
||||
:html-head ,z-shared-head)
|
||||
|
||||
("org-tags"
|
||||
:base-directory ,(site-path "tags/")
|
||||
:publishing-directory ,(site-path "output/tags/")
|
||||
:recursive t
|
||||
:base-extension "org"
|
||||
:publishing-function org-html-publish-to-html
|
||||
:html-preamble ,z-preamble
|
||||
:html-postamble ,z-postamble
|
||||
:html-head ,z-shared-head)
|
||||
|
||||
("org-lima"
|
||||
:base-directory ,(site-path "lima/")
|
||||
:publishing-directory ,(site-path "output/lima/")
|
||||
:recursive t
|
||||
:base-extension "org"
|
||||
:publishing-function org-html-publish-to-html
|
||||
:base-extension "org\\|md"
|
||||
:publishing-function z/publish-lima-file
|
||||
:with-author nil
|
||||
:with-creator nil
|
||||
:html-validation-link nil
|
||||
:html-preamble ,z-preamble
|
||||
:html-postamble ,z-postamble
|
||||
:auto-sitemap t
|
||||
:sitemap-filename "lima-list.org"
|
||||
:sitemap-title "Lima"
|
||||
:sitemap-style list
|
||||
:sitemap-sort-files anti-chronologically
|
||||
:html-head ,z-shared-head)
|
||||
("org-assets"
|
||||
:base-directory "~/master-folder/org_files/org_web/assets/"
|
||||
|
||||
("org-assets"
|
||||
:base-directory ,(site-path "assets/")
|
||||
:base-extension "css\\|js\\|png\\|jpg\\|gif\\|svg\\|pdf\\|woff\\|woff2\\|ttf"
|
||||
:publishing-directory "~/master-folder/org_files/org_web/output/assets/"
|
||||
:publishing-directory ,(site-path "output/assets/")
|
||||
:recursive t
|
||||
:publishing-function org-publish-attachment)
|
||||
))
|
||||
:publishing-function org-publish-attachment)))
|
||||
|
||||
|
||||
(delete-directory "~/master-folder/org_files/org_web/output/" t)
|
||||
(delete-directory "~/master-folder/org_files/org_web/tags/" t)
|
||||
(delete-directory (site-path "output/") t)
|
||||
(delete-directory (site-path "tags/") t)
|
||||
(message "Directory deleted")
|
||||
|
||||
(z/write-tag-pages)
|
||||
|
||||
Reference in New Issue
Block a user