aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Tom Willemse2020-02-25 23:32:48 -0800
committerGravatar Tom Willemse2020-02-25 23:35:57 -0800
commit10cf6bbc49155a719d0eb4d360b72ad340074f65 (patch)
treea4345092f0bc31631985ed3bf906f37a6816dff3
parent9bdcc275491c3d46d563981088d72c889d04d999 (diff)
downloadnew-ryuslash.org-10cf6bbc49155a719d0eb4d360b72ad340074f65.tar.gz
new-ryuslash.org-10cf6bbc49155a719d0eb4d360b72ad340074f65.zip
Update reading time generation
-rw-r--r--posts/a-very-important-blog-post.org1
-rw-r--r--posts/my-new-emacs-configuration.org1
-rw-r--r--posts/new-blog.org1
-rw-r--r--posts/wdocker-compose.org1
-rw-r--r--project-config.el16
5 files changed, 13 insertions, 7 deletions
diff --git a/posts/a-very-important-blog-post.org b/posts/a-very-important-blog-post.org
index 866f564..df9609e 100644
--- a/posts/a-very-important-blog-post.org
+++ b/posts/a-very-important-blog-post.org
@@ -1,5 +1,4 @@
#+TITLE: A very important blog post
-#+SUBTITLE: Reading time: 0 minutes
#+ID: a-very-important-blog-post
#+PUBDATE: <2020-02-23 Sun 18:28>
diff --git a/posts/my-new-emacs-configuration.org b/posts/my-new-emacs-configuration.org
index 9162f0c..56902a2 100644
--- a/posts/my-new-emacs-configuration.org
+++ b/posts/my-new-emacs-configuration.org
@@ -1,5 +1,4 @@
#+TITLE: My new Emacs configuration
-#+SUBTITLE: Reading time: 0 minutes
#+ID: my-new-emacs-configuration
#+PUBDATE: <2019-10-06 Sun 18:18>
#+TAGS: draft
diff --git a/posts/new-blog.org b/posts/new-blog.org
index 496b0f3..68bc483 100644
--- a/posts/new-blog.org
+++ b/posts/new-blog.org
@@ -1,5 +1,4 @@
#+TITLE: New Blog
-#+SUBTITLE: Reading time: 4 minutes
#+ID: new-blog
#+PUBDATE: <2019-10-06 Sun 12:55>
diff --git a/posts/wdocker-compose.org b/posts/wdocker-compose.org
index 32a65f1..eaa13e4 100644
--- a/posts/wdocker-compose.org
+++ b/posts/wdocker-compose.org
@@ -1,5 +1,4 @@
#+TITLE: Making docker-compose easier with wdocker
-#+SUBTITLE: Reading time: 3 minutes
#+PUBDATE: <2016-02-21>
#+FILE_TAGS: wdocker docker docker-compose
#+OPTIONS: num:nil toc:nil
diff --git a/project-config.el b/project-config.el
index 96cb365..b41fb1e 100644
--- a/project-config.el
+++ b/project-config.el
@@ -12,6 +12,7 @@
: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"
@@ -21,7 +22,11 @@
: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-user-abs-url t)
+ :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"
@@ -56,14 +61,19 @@
(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 (%d minutes)]]\n"
+ (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)
- (alist-get 'LENGTH alist)))
+ (project-config-print-reading-time (alist-get 'LENGTH alist))))
(defun project-config-reading-time (file)
(with-current-buffer (find-file file)