From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
To: James Harkins <jamshark70@qq.com>
Cc: orgmode <emacs-orgmode@gnu.org>
Subject: Re: Exporter: Derived backend options-alist
Date: Mon, 02 Mar 2015 17:52:38 +0100 [thread overview]
Message-ID: <87twy3bauh.fsf@nicolasgoaziou.fr> (raw)
In-Reply-To: <87d24rv5ph.wl-jamshark70@qq.com> (James Harkins's message of "Mon, 02 Mar 2015 22:23:22 +0800")
Hello,
James Harkins <jamshark70@qq.com> writes:
> I'm trying to derive an exporter backend from ASCII. I need to add some export options, so I have:
>
> #+BEGIN_SRC {emacs-lisp}
> (org-export-define-derived-backend 'scdoc 'ascii
> :translate-alist ... omitted for brevity...
> :options-alist
> '((:categories "CATEGORIES" nil nil t)
> (:related "RELATED" nil nil t)
> (:summary "SUMMARY" nil nil t)
> (:redirect "REDIRECT" nil nil t))
> )
>
> ... snip snip...
>
> (defun org-scdoc-template (contents info)
> "Return complete document string after SCDoc conversion.
> CONTENTS is the transcoded contents string. INFO is a plist
> holding export options."
> (let* ((title (org-export-data (plist-get info :title) info))
> (categories (org-export-data (plist-get info :categories) info))
> (related (org-export-data (plist-get info :related) info))
> (summary (org-export-data (plist-get info :summary) info))
> (redirect (org-export-data (plist-get info :redirect) info))
> (output (format "TITLE:: %s\n" title)))
> (if categories (setq output (concat output (format "CATEGORIES:: %s\n" categories))))
> (if related (setq output (concat output (format "RELATED:: %s\n" categories))))
> (if summary (setq output (concat output (format "SUMMARY:: %s\n" categories))))
> (if redirect (setq output (concat output (format "REDIRECT:: %s\n" categories))))
> (concat output "\n\n" contents)))
> #+END_SRC
>
> (Pardon the un-idiomatic Emacs-lisp.)
>
> Then I created an org file that begins:
>
> #+BEGIN_SRC org
> ,#+title:: PulseCount
> ,#+summary:: Pulse counter.
> ,#+related:: Classes/Stepper
> ,#+categories:: UGens>Triggers
It should be
#+title: PulseCount
...
#+categories: UGens>Triggers
>
> ,* Description
> Each trigger increments a counter which is output as a signal.
> #+END_SRC
>
> Then I run org-scdoc-export-as-scdoc, and I get as the first few lines:
>
> TITLE::
> CATEGORIES::
> RELATED::
> SUMMARY::
> REDIRECT::
>
> ... telling me that the template function retrieved empty strings for
> all the export options.
`org-export-data' always returns a string, even with a nil first
argument. If categories, related, etc. values are not parsed, just use
(categories (plist-get info :categories))
Regards,
--
Nicolas Goaziou
next prev parent reply other threads:[~2015-03-02 16:51 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-02 14:23 Exporter: Derived backend options-alist James Harkins
2015-03-02 16:52 ` Nicolas Goaziou [this message]
2015-03-03 1:31 ` James Harkins
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
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87twy3bauh.fsf@nicolasgoaziou.fr \
--to=mail@nicolasgoaziou.fr \
--cc=emacs-orgmode@gnu.org \
--cc=jamshark70@qq.com \
/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 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).