2022-07-13 16:26:16 +08:00
|
|
|
|
;; this file and Makefile from:
|
|
|
|
|
;; https://www.cnblogs.com/banjia/archive/2012/09/29/2708966.html
|
2022-09-15 11:33:55 +08:00
|
|
|
|
;; CSDN, 阿里云, 这些垃圾都在未授权盗搬, 结果这个东西有些地方都过时了. 能不能有点创新...
|
|
|
|
|
|
|
|
|
|
;; System Crafter's video: https://youtu.be/AfkrzFodoNw
|
2022-07-13 16:26:16 +08:00
|
|
|
|
|
2022-12-10 14:05:00 +08:00
|
|
|
|
(require 'package)
|
|
|
|
|
(package-initialize)
|
|
|
|
|
(when (not package-archive-contents)
|
|
|
|
|
(package-refresh-contents))
|
2022-12-18 12:59:59 +08:00
|
|
|
|
(dolist (p '(webfeeder htmlize))
|
2022-12-10 14:05:00 +08:00
|
|
|
|
(when (not (package-installed-p p))
|
|
|
|
|
(package-install p)))
|
2022-07-13 19:33:17 +08:00
|
|
|
|
|
2022-12-10 14:05:00 +08:00
|
|
|
|
(eval-when-compile
|
2023-05-29 16:59:51 +08:00
|
|
|
|
(require 'org)
|
2023-05-29 16:10:46 +08:00
|
|
|
|
(require 'ox-publish)
|
2023-05-29 16:59:51 +08:00
|
|
|
|
(require 'ox-html)
|
|
|
|
|
(require 'htmlize)
|
2022-10-21 20:07:00 +08:00
|
|
|
|
(require 'webfeeder))
|
|
|
|
|
|
|
|
|
|
(setq org-html-validation-link nil
|
2023-05-29 16:59:51 +08:00
|
|
|
|
;; https://emacs-china.org/t/org-emacs-script-org-publish-all/20782
|
|
|
|
|
org-html-htmlize-output-type 'css
|
2023-01-09 18:07:16 +08:00
|
|
|
|
org-export-with-toc 1
|
2022-12-02 20:36:53 +08:00
|
|
|
|
org-export-with-sub-superscripts '{})
|
2023-05-29 16:10:46 +08:00
|
|
|
|
|
2022-11-06 15:41:33 +08:00
|
|
|
|
(setq org-html-postamble-format
|
|
|
|
|
'(("en"
|
|
|
|
|
"
|
2023-04-20 21:37:24 +08:00
|
|
|
|
<p>dongdigua(dongdigua.github.io) CC BY-NC-SA, 禁止转载到私域(公众号,非自己托管的博客等)</p>
|
2023-04-07 15:45:27 +08:00
|
|
|
|
<p class=\"date\">Date: %d Build: %T</p>
|
2023-01-20 20:54:09 +08:00
|
|
|
|
<p>Proudly made with Emacs Org mode</p>
|
2022-12-03 11:25:45 +08:00
|
|
|
|
<p>If you have any idea, please contact me! I may add your comment</p>
|
2022-11-06 15:41:33 +08:00
|
|
|
|
")))
|
|
|
|
|
|
2023-06-06 16:07:17 +08:00
|
|
|
|
(setq org-html-home/up-format "
|
|
|
|
|
<div id=\"org-div-home-and-up\">
|
|
|
|
|
<a accesskey=\"h\" href=\"%s\"> ../ </a>
|
|
|
|
|
|
|
|
|
|
|
<a accesskey=\"H\" href=\"%s\"> ~dongdigua </a>
|
|
|
|
|
</div>")
|
|
|
|
|
|
2022-07-13 16:26:16 +08:00
|
|
|
|
(setq org-publish-project-alist
|
|
|
|
|
'(("org-pages"
|
|
|
|
|
:base-directory "."
|
|
|
|
|
:base-extension "org"
|
2022-09-11 11:20:31 +08:00
|
|
|
|
:publishing-directory "./../"
|
2022-07-13 16:26:16 +08:00
|
|
|
|
:recursive t
|
2022-07-13 19:33:17 +08:00
|
|
|
|
:publishing-function org-html-publish-to-html
|
2022-09-10 22:00:14 +08:00
|
|
|
|
:preserve-breaks t
|
2022-09-15 11:33:55 +08:00
|
|
|
|
|
|
|
|
|
:org-html-validation-link nil
|
2023-05-29 16:59:51 +08:00
|
|
|
|
:html-head "<link rel='stylesheet' href='css/main.css' />"
|
2022-12-02 16:02:55 +08:00
|
|
|
|
;; :html-head-include-default-style nil
|
2022-09-10 22:00:14 +08:00
|
|
|
|
:html-link-home "https://dongdigua.github.io"
|
2022-10-30 15:09:37 +08:00
|
|
|
|
:html-link-up "./../posts"
|
2022-11-06 15:41:33 +08:00
|
|
|
|
:html-postamble t
|
2022-07-13 16:26:16 +08:00
|
|
|
|
)))
|
|
|
|
|
|
2023-02-11 13:50:46 +08:00
|
|
|
|
|
2022-09-25 12:53:07 +08:00
|
|
|
|
;; from .emacs
|
|
|
|
|
(defun my/orgurl (proto)
|
|
|
|
|
(defvar proto proto) ;; important
|
|
|
|
|
(org-link-set-parameters proto
|
|
|
|
|
:export
|
|
|
|
|
(lambda (link description format _)
|
|
|
|
|
(let ((url (format "%s:%s" proto link)))
|
|
|
|
|
(format "<a href=\"%s\">%s</a>" url (or description url))))))
|
|
|
|
|
(my/orgurl "gopher")
|
|
|
|
|
(my/orgurl "gemini")
|
|
|
|
|
|
2023-02-11 13:50:46 +08:00
|
|
|
|
;; https://emacs.stackexchange.com/questions/36366/disable-auto-id-generation-in-org-mode-html-export
|
|
|
|
|
;; BUG: will cause toc not working, but I don't use much, so just add id manually
|
|
|
|
|
(defun html-body-id-filter (output backend info)
|
|
|
|
|
"Remove random ID attributes generated by Org."
|
|
|
|
|
(when (eq backend 'html)
|
|
|
|
|
(replace-regexp-in-string
|
|
|
|
|
" href=\"#org[[:alnum:]]\\{7\\}\""
|
|
|
|
|
""
|
|
|
|
|
(replace-regexp-in-string
|
|
|
|
|
" id=\"[[:alpha:]-]*org[[:alnum:]]\\{7\\}\""
|
|
|
|
|
""
|
|
|
|
|
output t)
|
|
|
|
|
t)))
|
|
|
|
|
(add-to-list 'org-export-filter-final-output-functions 'html-body-id-filter)
|
|
|
|
|
|
|
|
|
|
|
2022-07-13 16:26:16 +08:00
|
|
|
|
(defun myweb-publish ()
|
|
|
|
|
"Publish myweb."
|
|
|
|
|
(interactive)
|
|
|
|
|
(setq debug-on-error t)
|
2022-09-10 22:00:14 +08:00
|
|
|
|
(org-publish-all)
|
|
|
|
|
|
|
|
|
|
(webfeeder-build
|
2022-10-23 16:54:07 +08:00
|
|
|
|
"feed.xml"
|
2022-09-11 11:20:31 +08:00
|
|
|
|
"./../"
|
2022-09-10 22:00:14 +08:00
|
|
|
|
"https://dongdigua.github.io"
|
2023-05-03 12:08:02 +08:00
|
|
|
|
(delete "kernel.html" (delete "404.html" (delete "xmr.html" (delete "index.html" (directory-files "./../" nil ".*\.html$")))))
|
2022-09-10 22:00:14 +08:00
|
|
|
|
:title "dongdigua's blog"
|
|
|
|
|
:description "Blog!"
|
|
|
|
|
:builder 'webfeeder-make-rss)
|
2023-05-29 16:10:46 +08:00
|
|
|
|
|
|
|
|
|
(kill-emacs))
|
2022-07-13 16:26:16 +08:00
|
|
|
|
|