-(defun my-org-rss-publish-to-rss (plist filename pub-dir)
- "Publish RSS with PLIST, only when FILENAME is 'rss.org'.
-PUB-DIR is when the output will be placed."
- (if (equal "rss.org" (file-name-nondirectory filename))
- (org-rss-publish-to-rss plist filename pub-dir)))
-
-(defun my-format-rss-feed (title list)
- "Generate RSS feed, as a string.
-TITLE is the title of the RSS feed. LIST is an internal
-representation for the files to include, as returned by
-`org-list-to-lisp'. PROJECT is the current project."
- (concat "#+OPTIONS: ^:nil\n" ; do not use underscores as subscript
- "#+TITLE: " title "\n\n"
- (org-list-to-subtree list 0)))
-
-(defun my-format-rss-feed-entry (entry style project)
- "Format ENTRY for the RSS feed.
-ENTRY is a file name. STYLE is either 'list' or 'tree'.
-PROJECT is the current project."
- (cond ((not (directory-name-p 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)))
- (link (concat my-blog-target-url (file-name-sans-extension entry) ".html")))
- (with-temp-buffer
- (org-mode)
- (insert (format "* [[file:%s][%s]]\n" file title))
- (org-set-property "RSS_PERMALINK" link)
- (org-set-property "PUBDATE" date)
- (insert-file-contents file)
- (buffer-string))))
- ((eq style 'tree)
- ;; Return only last subdir.
- (file-name-nondirectory (directory-file-name entry)))
- (t entry)))
-
-
-(defun my-blog-publish-rss-sitemap (title list)
- "Create a simple site map, as a string.
-TITLE is the title of the site map. LIST is an internal
-representation for the files to include, as returned by
-`org-list-to-lisp'."
- (with-temp-buffer
- (message "Creating RSS index.")
- (org-mode)
- (let* ((filenames (my-blog-parse-sitemap-list list))
- (project-plist (assoc "posts" org-publish-project-alist))
- ;;(articles (my-blog-sort-article-list filenames project-plist))
- )
- (insert "#+AUTHOR: Frederik Vanrenterghem\n")
- (dolist (file filenames)
- (unless (eq (file-name-base file) "rss.org")
- (message "Processing %s for RSS index." file)
- (let* ((abspath (file-name-concat "/home/frederik/websites/stage.vanrenterghem.biz/source/posts" file))
- (relpath (file-relative-name abspath "/home/frederik/websites/stage.vanrenterghem.biz/source/"))
- (title (org-publish-find-title file project-plist))
- (date (format-time-string (car org-time-stamp-custom-formats) (org-publish-find-date file project-plist)))
- (rss-permalink (file-name-sans-extension relpath))
- (preview (my-blog-get-preview abspath)))
- (insert (concat "* [[file:" relpath "][" title "]]"))
- (org-set-property "RSS_PERMALINK" rss-permalink)
- (org-set-property "PUBDATE" date)
- (org-set-property "RSS_TITLE" title)
- (insert preview)
- (insert "\n"))))
- (goto-char (point-min))
- (insert "#+OPTIONS: ^:nil\n"))
- (write-file "~/websites/stage.vanrenterghem.biz/source/posts/rss.org")))
-
-