aboutsummaryrefslogtreecommitdiffstats
path: root/project-config.el
diff options
context:
space:
mode:
Diffstat (limited to 'project-config.el')
-rw-r--r--project-config.el90
1 files changed, 0 insertions, 90 deletions
diff --git a/project-config.el b/project-config.el
deleted file mode 100644
index b41fb1e..0000000
--- a/project-config.el
+++ /dev/null
@@ -1,90 +0,0 @@
-(require 'ox-publish)
-(require 'ox-rss)
-
-(setq org-export-exclude-tags '("noexport" "draft"))
-
-(setq org-publish-project-alist
- '(("ryuslash.org"
- :base-directory "."
- :publishing-directory "public_html"
- :exclude "\\`README.org\\'"
- :base-extension "org"
- :publishing-function org-html-publish-to-html
- :html-head "<link rel=\"stylesheet\" href=\"assets/css/main.css\" type=\"text/css\"/>"
- :html-link-home "https://ryuslash.gitlab.io/ryuslash.org/"
- :html-link-up nil
- :html-link-user-abs-url t)
- ("ryuslash.org Posts"
- :base-directory "posts"
- :publishing-directory "public_html/posts"
- :exclude "\\`README.org\\'"
- :base-extension "org"
- :publishing-function org-html-publish-to-html
- :html-head "<link rel=\"stylesheet\" href=\"../assets/css/main.css\" type=\"text/css\"/>"
- :html-link-home "https://ryuslash.gitlab.io/ryuslash.org/"
- :html-link-up "../"
- :html-link-user-abs-url t
- :html-preamble (lambda (_)
- (project-config-print-reading-time
- (project-config-reading-time (buffer-file-name)))))
- ("ryuslash-rss"
- :base-directory "."
- :publishing-directory "public_html"
- :exclude ".*"
- :include ("index.org")
- :base-extension "org"
- :publishing-function org-rss-publish-to-rss)))
-
-(defun publish-ryuslash.org ()
- (with-current-buffer (find-file "index.org")
- (org-update-all-dblocks)
- (save-buffer))
- (org-publish-all))
-
-(defun project-config-parse-element (org-element)
- (pcase org-element
- (`(keyword ,something) (cons (intern (plist-get something :key))
- (plist-get something :value)))
- (`(paragraph ,something) (cons
- 'BODY
- (buffer-substring-no-properties
- (plist-get something :contents-begin)
- (plist-get something :contents-end))))))
-
-(defun project-config-parse-document (document)
- (with-current-buffer (find-file document)
- (goto-char (point-min))
- (let (alist)
- (while (not (alist-get 'BODY alist nil nil #'equal))
- (setq alist (cons (project-config-parse-element (org-element-at-point))
- alist))
- (org-forward-element))
- alist)))
-
-(defun project-config-print-reading-time (time)
- (format "%d minute%s"
- time
- (if (= time 1) "" "s")))
-
-(defun project-config-print-element (alist)
- (format "* %s\n :PROPERTIES:\n :ID: %s\n :PUBDATE: %s\n :END:\n\n %s\n[[file:%s][Read more (%s)]]\n"
- (alist-get 'TITLE alist)
- (alist-get 'ID alist)
- (alist-get 'PUBDATE alist)
- (alist-get 'BODY alist)
- (alist-get 'NAME alist)
- (project-config-print-reading-time (alist-get 'LENGTH alist))))
-
-(defun project-config-reading-time (file)
- (with-current-buffer (find-file file)
- (max 1 (/ (count-words (point-min) (point-max)) 228))))
-
-(defun project-config-print-file (file)
- (project-config-print-element
- (append `((NAME . ,(concat "posts/" file))
- (LENGTH . ,(project-config-reading-time (concat "posts/" file))))
- (project-config-parse-document (concat "posts/" file)))))
-
-(defun org-dblock-write:blog-posts (params)
- (let ((files (cl-remove-if (lambda (item) (string-prefix-p "." item)) (directory-files "posts"))))
- (insert (format "%s" (apply #'concat (mapcar #'project-config-print-file files))))))