From: Kaushal Modi <kaushal.modi@gmail.com>
To: emacs-org list <emacs-orgmode@gnu.org>
Subject: What's the canonical way to pass information within an Org exporter?
Date: Tue, 06 Feb 2018 23:35:04 +0000 [thread overview]
Message-ID: <CAFyQvY31j6Du5zKO8iq6sa0ErABQy8_Xm60-MgH7YW-kKDxsug@mail.gmail.com> (raw)
[-- 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 --]
next reply other threads:[~2018-02-06 23:35 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-06 23:35 Kaushal Modi [this message]
2018-02-09 4:45 ` What's the canonical way to pass information within an Org exporter? Yasushi SHOJI
2018-02-10 15:48 ` Kaushal Modi
2018-02-12 2:24 ` Kaushal Modi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAFyQvY31j6Du5zKO8iq6sa0ErABQy8_Xm60-MgH7YW-kKDxsug@mail.gmail.com \
--to=kaushal.modi@gmail.com \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.