From 00820643584ac0b7b52d966053793a01220686d0 Mon Sep 17 00:00:00 2001 From: "Yann Esposito (Yogsototh)" Date: Thu, 12 Sep 2019 14:41:53 +0200 Subject: [PATCH] enhanced archive and rss --- project.el | 32 ++++++++++++++++++++++++++++++-- project.el.sig | Bin 586 -> 585 bytes src/archive.org | 11 ++++++----- src/posts/project-el/index.org | 1 + src/posts/troll-2/index.org | 2 +- 5 files changed, 38 insertions(+), 8 deletions(-) diff --git a/project.el b/project.el index cb552a1..e90f8fe 100644 --- a/project.el +++ b/project.el @@ -119,13 +119,30 @@ (menu '("↑ Top ↑")) "")) +(defun y/org-get-keywords () + (org-element-map (org-element-parse-buffer 'element) 'keyword + (lambda (keyword) (cons (org-element-property :key keyword) + (org-element-property :value keyword))))) + +(defun y/org-get-meta (keyword) + (cdr (assoc keyword (y/org-get-keywords)))) + +(defun y/get-meta (file meta-name) + "Return the value of the meta of an org-mode file. + +(y/get-meta file \"DESCRIPTION\") +" + (org-babel-with-temp-filebuffer file (y/org-get-meta meta-name))) + (defun date-format-entry (entry _style project) "Return string for each ENTRY in PROJECT." (when (string-match "posts/.*" entry) (let* ((file (org-publish--expand-file-name entry project)) (title (org-publish-find-title entry project)) - (date (format-time-string "%Y-%m-%d" (org-publish-find-date entry project)))) - (format "- [%s] [[file:%s][%s]]\n" date file title)))) + (date (format-time-string "%Y-%m-%d" (org-publish-find-date entry project))) + (keywords (y/get-meta file "KEYWORDS")) + (description (y/get-meta file "DESCRIPTION"))) + (format "- [%s] [[file:%s][%s]] /(%s)/ \n %s" date file title keywords description)))) (defun org-blog-sitemap-fn-descr (descr title list) "Return sitemap using TITLE and LIST returned by `org-blog-sitemap-format-entry'." @@ -207,6 +224,9 @@ Return output file name." (cond ((not (directory-name-p entry)) (let* ((file (org-publish--expand-file-name entry project)) (title (org-publish-find-title entry project)) + (subtitle (y/get-meta (format "%s/%s" posts-dir entry) "SUBTITLE")) + (keywords (y/get-meta (format "%s/%s" posts-dir entry) "KEYWORDS")) + (description (y/get-meta (format "%s/%s" posts-dir entry) "DESCRIPTION")) (date (format-time-string "%Y-%m-%d" (org-publish-find-date entry project))) (link (concat "posts/" (file-name-sans-extension entry) ".html"))) (with-temp-buffer @@ -214,6 +234,14 @@ Return output file name." (org-set-property "RSS_PERMALINK" link) (org-set-property "PUBDATE" date) (org-set-property "ID" (org-auto-id-format title)) + (when subtitle + (org-set-property "SUBTITLE" subtitle)) + (when keywords + (insert "Keywords: ") + (insert keywords) + (insert "\n\n")) + (when description + (insert description)) (buffer-string)))) ((eq style 'tree) (file-name-nondirectory (directory-file-name entry))))) diff --git a/project.el.sig b/project.el.sig index 23c4a039cde60e40dbea51ad4595ec070cc64568..8bad8dc6078878963037cb0b4e8543458db31d5d 100644 GIT binary patch delta 566 zcmV-60?GZ#1jz&@i2_Ch009aBF%}^N#o$ihO_s|vF@xXv%R&!;1@We01p-}qJpqv> zAb;(V5BEj&fCf}OPne5E=h$pYd1-vDPxF%>9h~ycB25n$mcueV5(jCrA?U^60O5H6 z5~8a?B3kw?h^`V5H1jAHFeEOQ;k;=ws|4$VQOF_;mZVP=VG{NhBsQKu>Zx5(8Io&x zDfnW_EH^TRQKXmN=00M-;nemq4Q(nzLw~+W(sFRs@hExRp7kZI>USnWr$FT3mue<1 zp>nBLcA4d6iqP>RWbjG22a;v*Tm)u?&^nyv4foTBkZ|uyHcPwnh}+Ca*1QvFpJMgN zHyij}WJMyiwzMb9>DG+}k{k&WIGk>`T zTWPBE)%t{53X{P$jCas7U^+ranbIy16x)tc>Dq%ce1_BAC6}$UiYX6D21yZh$6&6p zS}ukN%|uMUr0}4GrmIDfHCP#DAN+1fV?R^^Yg-ZzyO!Y&;|d{7c#x^H$%p~f{8^b{ z#fs$@iP-Yde*YXSgxs$wLbsU0$$u{!YkYM&&1Q{d8i6;#fqvP%!N={ZV|<}GI3A2d zh^-b)EQ6gURrQ7ww_*|2Yq>d$@E}$-#-F5iQ*}_uuu%%CSs>K?iR)+6SMgXJ&VRqt zG_Pt$T)-ItY!K+2l5-7wJnq#>9jyfyS$UK;lj(v;z@GLa%FE( z*>a8+W_AAn_Q$(`4=$u6lWj7YtgYXiFz5+qu9PhEY%QTpPkt{A+`Kt^T;;j*TxIg` zmX;lU!Mr?UUAbrcxJw6HDj5un)o`V{Qh#R>Uoa!6F^Z3a_r7_P74jPh$c|_+X5)zs zF&AoC;t7X6Sh!}1Am}vq-={}4z@cqA_C|H$=NvVYH`Ki5x_l%3kAyEG7Dl8|76iIt zFI0L*!*K#vKRSB%-D6!F_P!+nFNZHS@vad+!Wq2X3f$6*Cg&I!7EqfIdnnF}27l#j zP>hunp+FCBLLS7rR6wCsL`vo2Hqz1Wv@iVd9NT8Zk>ypX7Jsky+LNMhE-puwu3SuL zJaS?q7Oqjc1Q7ROVz97CWn=}DMmkH|{dVMFR0g@49oRO5UyLSugzwb|CdT+vqzAiuKGE1DjdVEo)XIEVlxYo>IkKm*EF0S FDSccJ34#Cs diff --git a/src/archive.org b/src/archive.org index ae37819..6aa7fad 100644 --- a/src/archive.org +++ b/src/archive.org @@ -2,8 +2,9 @@ #+AUTHOR: Yann Esposito #+EMAIL: yann@esposito.host #+DESCRIPTION: Articles -- [2019-08-18] [[file:/Users/yaesposi/y/her.esy.fun/src/posts/project-el/index.org][Autoload Script by project]] - -- [2019-08-17] [[file:/Users/yaesposi/y/her.esy.fun/src/posts/troll-2/index.org][Troll 2]] - -- [2019-08-17] [[file:/Users/yaesposi/y/her.esy.fun/src/posts/new-blog.org][New Blog]] +- [2019-08-18] [[file:/Users/yaesposi/y/her.esy.fun/src/posts/project-el/index.org][Autoload Script by project]] /(programming, blog, org-mode)/ + A script I use to load safely an eLISP file when entering a new project directory. +- [2019-08-17] [[file:/Users/yaesposi/y/her.esy.fun/src/posts/troll-2/index.org][Troll 2]] /(movie)/ + I watched what may be the worse movie of all time and I still enjoyed greatly the show. +- [2019-08-17] [[file:/Users/yaesposi/y/her.esy.fun/src/posts/new-blog.org][New Blog]] /(programming, blog, org-mode, web, css)/ + Meta article about how I generate this blog. \ No newline at end of file diff --git a/src/posts/project-el/index.org b/src/posts/project-el/index.org index 66824c2..8549ba2 100644 --- a/src/posts/project-el/index.org +++ b/src/posts/project-el/index.org @@ -4,6 +4,7 @@ #+EMAIL: yann@esposito.host #+DATE: [2019-08-18 Sun] #+KEYWORDS: programming, blog, org-mode +#+DESCRIPTION: A script I use to load safely an eLISP file when entering a new project directory. #+OPTIONS: auto-id:t #+begin_quote diff --git a/src/posts/troll-2/index.org b/src/posts/troll-2/index.org index c70f8dc..1c9a09e 100644 --- a/src/posts/troll-2/index.org +++ b/src/posts/troll-2/index.org @@ -4,7 +4,7 @@ #+Email: yann@esposito.host #+Date: [2019-08-17 Sat] #+KEYWORDS: movie -#+DESCRIPTION: +#+DESCRIPTION: I watched what may be the worse movie of all time and I still enjoyed greatly the show. #+LANGUAGE: en #+LANG: en #+OPTIONS: H:5 auto-id:t