emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] What's the canonical way to pass information within an Org exporter?


From: Kaushal Modi
Subject: [O] What's the canonical way to pass information within an Org exporter?
Date: Tue, 06 Feb 2018 23:35:04 +0000

Hello,

I believe the info plist should be used ideally, but I cannot figure out how to tap in new information or update existing information in the `info' channel used throughout the exporter.

Here's an example:

(1) I am saving the "description" Special Block content to a global var org-hugo--description:

(defun org-hugo-special-block (special-block contents info)
  (let ((block-type (org-element-property :type special-block))
        (contents (org-trim contents)))
    (cond
     ((string= block-type "description")
      (setq org-hugo--description contents)
      nil)
     ;; -- snip --
     )))

(2) Then I am retrieving that saved variable inside a nested function call in org-hugo-body-filter, where I use it as:

(or org-hugo--description
                          (org-string-nw-p (plist-get info :description)))

I know that this is very ugly, but it works.

Now I am looking for a way to optimize this bit of code.. to figure out how to add/update :description in the `info' channel from within org-hugo-special-block. That way I need to do just the below inside org-hugo-body-filter:

(org-string-nw-p (plist-get info :description))


Thank you.


Full code: https://raw.githubusercontent.com/kaushalmodi/ox-hugo/master/ox-hugo.el
--

Kaushal Modi


reply via email to

[Prev in Thread] Current Thread [Next in Thread]