From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kaushal Modi Subject: What's the canonical way to pass information within an Org exporter? Date: Tue, 06 Feb 2018 23:35:04 +0000 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="94eb2c0660b4804bc5056493a1ab" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:43016) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ejCli-0005qa-FE for emacs-orgmode@gnu.org; Tue, 06 Feb 2018 18:35:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ejClh-00012d-El for emacs-orgmode@gnu.org; Tue, 06 Feb 2018 18:35:18 -0500 Received: from mail-yw0-x235.google.com ([2607:f8b0:4002:c05::235]:43032) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ejClh-00010r-AN for emacs-orgmode@gnu.org; Tue, 06 Feb 2018 18:35:17 -0500 Received: by mail-yw0-x235.google.com with SMTP id x190so2627713ywd.10 for ; Tue, 06 Feb 2018 15:35:17 -0800 (PST) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-org list --94eb2c0660b4804bc5056493a1ab Content-Type: text/plain; charset="UTF-8" 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 --94eb2c0660b4804bc5056493a1ab Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hello,

I be= lieve 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' ch= annel 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-bloc= k (special-block contents info)
=C2=A0 (let ((block-type (org-element-pr= operty :type special-block))
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 = (contents (org-trim contents)))
=C2=A0=C2=A0=C2=A0 (cond
=C2=A0=C2=A0= =C2=A0=C2=A0 ((string=3D block-type "description")
=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 (setq org-hugo--description contents)
=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 nil)
=C2=A0=C2=A0=C2=A0=C2=A0 ;; -- snip --
=C2=A0= =C2=A0=C2=A0=C2=A0 )))

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

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

I know that this is very ugly, but it works.<= br>
Now I am looking for a way to optimize this bit of code.. to f= igure out how to add/update :description in the `info' channel from wit= hin 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.githubuserconte= nt.com/kaushalmodi/ox-hugo/master/ox-hugo.el
--

Kaushal Modi

--94eb2c0660b4804bc5056493a1ab--