emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* What's the canonical way to pass information within an Org exporter?
@ 2018-02-06 23:35 Kaushal Modi
  2018-02-09  4:45 ` Yasushi SHOJI
  0 siblings, 1 reply; 4+ messages in thread
From: Kaushal Modi @ 2018-02-06 23:35 UTC (permalink / raw)
  To: emacs-org list

[-- Attachment #1: Type: text/plain, Size: 1270 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 1765 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-02-12  2:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-06 23:35 What's the canonical way to pass information within an Org exporter? Kaushal Modi
2018-02-09  4:45 ` Yasushi SHOJI
2018-02-10 15:48   ` Kaushal Modi
2018-02-12  2:24     ` Kaushal Modi

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).