Interested in Org but not enough to monitor the mailing list? In this blog I digest developments, and each month regurgitate what I consider the highlights, along with anything else Org-related I consider nifty.
Posts are published in
.html
,.org
,.org.html
,.txt
, and
First we need to get all the posts. To get a recent-first ordering we just need to reverse the sorted directory listing.
(setq posts (nreverse
(directory-files (expand-file-name "../content" default-directory)
t "^[0-9]\\{4\\}-[0-9][0-9]-[0-9][0-9]-.+\\.org")))
Then we want to format the content for inclusion. Each file can be visited and modified for inclusion.
(defun format-post (file &optional truncate-length)
(with-temp-buffer
(insert-file-contents file)
;; increace heading levels
(goto-char (point-min))
(while (re-search-forward "^\\(\\*+\\)" nil t)
(replace-match "*\\1"))
;; convert keyword info to L1 heading
(setq keywords (org-collect-keywords '("TITLE" "DATE")))
(goto-char (point-min))
;; delete up to first double newline
(delete-region (point-min) (search-forward "\n\n"))
(insert (format "* @@html:<a href='%s.html' style='text-decoration:none;color:inherit'>@@ %s @@html:<span class='tag'><span>%s</span></span></a>@@"
(file-name-base file)
(cadr (assoc "TITLE" keywords))
(cadr (assoc "DATE" keywords)))
"\n")
(when (and truncate-length (> (point-max) (+ truncate-length (point))))
(goto-char (+ truncate-length (point)))
(org-backward-element)
(delete-region (point) (point-max))
(insert (format "[[file:%s.html][Read more...]]" (file-name-base file))))
;; Remove undefined footnotes
(goto-char (point-min))
(while (re-search-forward "\\[fn:\\(.+?\\)\\]" nil t)
(replace-match "^{[\\1]}"))
(buffer-string)))