Sun Mar 12 15:02 EDT; goldblum
==============================
I think I figured out a good workflow for publishing straight from org
capture. Here's the bit of config in my emacs init:
,----
| (require 'org-element)
|
| (let ((gopher-dir (concat (getenv "HOME") "/gopher/"))
| (entry-file "first.org")
| (log-file "log.org")
| (sdf-dir "/ssh:sdf:~/gopher/"))
|
| (defun j0ni/prepare-first-entry (plist filename dst-dir)
| (let* ((org-inhibit-startup t)
| (visiting (find-buffer-visiting filename))
| (work-buffer (or visiting (find-file-noselect filename)))
| (dst-file (expand-file-name entry-file dst-dir)))
| (with-current-buffer work-buffer
| (let ((entry (org-element-map (org-element-parse-buffer) 'headline
| (lambda (hl)
| (when (= (org-element-property :level hl) 2)
| hl))
| nil t)))
| (with-temp-buffer
| (insert "#+OPTIONS: toc:nil H:1 num:nil title:nil author:nil creator:nil")
| (newline)
| (insert "#+ATTR_ASCII: width:60")
| (newline)
| (insert (org-element-interpret-data entry))
| (write-region (point-min) (point-max) dst-file))))))
|
| (setopt org-publish-project-alist
| ;; This makes a markdown version of this file.
| `(("notwithstanding"
| :base-directory ,user-emacs-directory
| :publishing-directory ,user-emacs-directory
| :publishing-function org-md-publish-to-md)
| ("captains-phlog"
| :include ("log.org")
| :exclude "first.org"
| :base-directory ,gopher-dir
| :publishing-directory ,gopher-dir
| :publishing-function (org-ascii-publish-to-ascii j0ni/prepare-first-entry))
| ("first-entry"
| :include ("first.org")
| :exclude "log.org"
| :base-directory ,gopher-dir
| :publishing-directory ,sdf-dir
| :publishing-function org-ascii-publish-to-ascii)
| ("phlog" :components ("captains-phlog" "first-entry")))))
`----
Note that the "notwithstanding" part is unrelated, but ¯\_(ツ)_/¯.
Let's see how it goes, and if this is just too much text.