I'm working on a blog published via org-publish but one things got me stumped:
accessing user defined keywords while publishing to HTML:
Each post is in an orgmode file, and has a simple structure. E.g. one post starts with:
#+title: Fix for Sparkfun Arduino Pro Micro
#+date: <2009-03-05 13:55>
#+filetags: Arduino
#+category: electronics
#+draft: true
I want to access the last two keywords values when publishing but despite lots of
searching, can't find out how:
Part of my publish-project-alist:
(setq org-publish-project-alist
`(
("blog-posts"
:base-directory "~/projects/3-blog/"
:base-extension "org"
:recursive t
--- lots omitted
:html-preamble *my-blog-page-preamble*
)
and /my-blog-page-preamble/ function is:
(defun *my-blog-page-preamble* (arg)
(with-temp-buffer
(insert-file-contents my-blog-page-preamble-file) ; Insert preamble from file
(concat (buffer-string)
(format "
Tags: %s" (car (plist-get arg :filetags))) *;* *<< WORKS*
(format "
Category: %s " (car (plist-get arg :category))) *;<< returns nil*
(format "
Draft: %s" (car (plist-get arg :draft))))))*;<< returns nil*
I can access/the values of :title/ or /:filetags/ and other predefined keywords but
not ones I define myself.
My keywords are being passed to the preamble-function as displaying 'arg' shows:
--LOTS OMITTED--#2 (keyword (:key DATE :value <2009-03-05 13:55> :begin 81 :end
108 :post-blank 0 :post-affiliated 81 :parent #4)) (keyword (:key CATEGORY :value
electronics :begin 108 :end 132 :post-blank 0 :post-affiliated 108 :parent #4))
(keyword (:key FILETAGS :value Arduino :begin 132 :end 152 :post-blank 0
:post-affiliated 132 :parent #4)) (keyword (:key DRAFT :value true :begin 152
:end 166 :post-blank 0 :post-affiliated 152 :parent #4)) -- LOTS MORE
I tried capitalizing -- (plist-get arg :CATEGORY) -- but that returns /nil/ too.
Given that /(plist-get arg :category)/ and /(plist-get arg :draft)/ don't return the
expected values, what's the correct way to access the values of /#+category:/ and
user-defined keywords such as /#+draft:/ keywords?
Many thanks
Giovanni*
*