Re: [O] Exporter: Derived backend options-alist

2015-03-02 Thread James Harkins

On March 3, 2015 12:51:31 AM Nicolas Goaziou  wrote:


> 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


Gah... doubled colons, which are part of scdoc syntax but not org. That's a 
10:30 PM brain failure. Thanks for the second pair of eyes.


I have another question about source blocks, but, separate question, 
separate thread.


hjh

Sent with AquaMail for Android
http://www.aqua-mail.com







Re: [O] Exporter: Derived backend options-alist

2015-03-02 Thread Nicolas Goaziou
Hello,

James Harkins  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



[O] Exporter: Derived backend options-alist

2015-03-02 Thread James Harkins
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

  ,* 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.

Obviously I've done something wrong, but... what? "(let ((title 
(org-export-data (plist-get info :title) info)))...)" is copied from 
ox-latex.el, and ox-latex clearly has no problem accessing the title.

Thanks in advance. I'm sure I'll have other questions later.

hjh