emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* derived exporter EXPORT_... options
@ 2013-11-26 17:46 Robert Klein
  2013-11-26 19:49 ` Nicolas Goaziou
  0 siblings, 1 reply; 3+ messages in thread
From: Robert Klein @ 2013-11-26 17:46 UTC (permalink / raw)
  To: Org Mode

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

Hi,

I'm trying to user EXPORT_... options in subtree export in a derived
exporter.

Using attached ox-hans exporter and the org file hans.org,
I only get "Wurst" as :hans-option, never "Bratwurst", as given under
the heading "Two", using both options with subtree export (C-c C-e C-d j
h  and C-c C-e C-d j H.

Do I misunderstand subtree export?

Thanks for any help.

Best regards
Robert



-- 
Robert Klein
UNIX Operations, Max Planck-Institut für Polymerforschung
Ackermannweg 10
55218 Mainz

[-- Attachment #2: hans.org --]
[-- Type: application/vnd.lotus-organizer, Size: 78 bytes --]

[-- Attachment #3: ox-hans.el --]
[-- Type: text/x-emacs-lisp, Size: 1475 bytes --]

;; hans example derived exporter
(require 'ox-html)

(org-export-define-derived-backend
 'hans 'html
 :menu-entry
 '(?j "Export w/ HTML-derived hans exporter"
      ((?h "To temporary buffer (wurst)" org-hans-export-as-wurst)
       (?H "To temporary buffer (bratwurst)" org-hans-export-as-bratwurst)))
 :options-alist
 '((:hans-option "HANS_OPTION" nil nil t)))


(defun org-hans-export-as-wurst (&optional a subtreep v b ext-plist)
  (interactive)
  (let* ((doc-env (org-export-get-environment 'hans subtreep ext-plist)))
    (message "HANS-OPTION: %s"
             (org-element-interpret-data
              (plist-get doc-env :hans-option)))
    (message "EXPORT-HANS-OPTION: %s"
             (org-element-interpret-data
              (plist-get doc-env :export-hans-option)))))


(defun org-hans-export-as-bratwurst (&optional a subtreep v b ext-plist)
  (interactive)
  (save-excursion
    (save-restriction
      (when subtreep
        (org-narrow-to-subtree)
        (goto-char (point-min))
        (forward-line)
        (narrow-to-region (point) (point-max)))
        (let* ((doc-env (org-export-get-environment 'hans subtreep ext-plist)))
          (message "HANS-OPTION: %s"
                   (org-element-interpret-data
                    (plist-get doc-env :hans-option)))
          (message "EXPORT-HANS-OPTION: %s"
                   (org-element-interpret-data
                    (plist-get doc-env :export-hans-option)))))))

        

(provide 'ox-hans)

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

* Re: derived exporter EXPORT_... options
  2013-11-26 17:46 derived exporter EXPORT_... options Robert Klein
@ 2013-11-26 19:49 ` Nicolas Goaziou
  2013-11-27 18:49   ` Robert Klein
  0 siblings, 1 reply; 3+ messages in thread
From: Nicolas Goaziou @ 2013-11-26 19:49 UTC (permalink / raw)
  To: Robert Klein; +Cc: Org Mode

Hello,

Robert Klein <kleinrob@mpip-mainz.mpg.de> writes:

> I'm trying to user EXPORT_... options in subtree export in a derived
> exporter.
>
> Using attached ox-hans exporter and the org file hans.org,
> I only get "Wurst" as :hans-option, never "Bratwurst", as given under
> the heading "Two", using both options with subtree export (C-c C-e C-d j
> h  and C-c C-e C-d j H.
>
> Do I misunderstand subtree export?

Keyword are global. Subtree export options are expected to be properties
attached to the root headline:

  * Two
    :PROPERTIES:
    :EXPORT_HANS_OPTION: Bratwurst
    :END:

Also, the property name will still be :hans-option (i.e. no "export-"
appended). During a subtree export the property has precedence over the
keyword.


Regards,

-- 
Nicolas Goaziou

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

* Re: derived exporter EXPORT_... options
  2013-11-26 19:49 ` Nicolas Goaziou
@ 2013-11-27 18:49   ` Robert Klein
  0 siblings, 0 replies; 3+ messages in thread
From: Robert Klein @ 2013-11-27 18:49 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Org Mode

Thanks a lot, I was still thinking in old exporter terms.

Best regards
Robert


On 11/26/2013 08:49 PM, Nicolas Goaziou wrote:
> Hello,
> 
> Robert Klein <kleinrob@mpip-mainz.mpg.de> writes:
> 
>> I'm trying to user EXPORT_... options in subtree export in a derived
>> exporter.
>>
>> Using attached ox-hans exporter and the org file hans.org,
>> I only get "Wurst" as :hans-option, never "Bratwurst", as given under
>> the heading "Two", using both options with subtree export (C-c C-e C-d j
>> h  and C-c C-e C-d j H.
>>
>> Do I misunderstand subtree export?
> 
> Keyword are global. Subtree export options are expected to be properties
> attached to the root headline:
> 
>   * Two
>     :PROPERTIES:
>     :EXPORT_HANS_OPTION: Bratwurst
>     :END:
> 
> Also, the property name will still be :hans-option (i.e. no "export-"
> appended). During a subtree export the property has precedence over the
> keyword.
> 
> 
> Regards,
> 


-- 
Robert Klein
UNIX Operations, Max Planck-Institut für Polymerforschung
Ackermannweg 10
55218 Mainz

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

end of thread, other threads:[~2013-11-27 18:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-26 17:46 derived exporter EXPORT_... options Robert Klein
2013-11-26 19:49 ` Nicolas Goaziou
2013-11-27 18:49   ` Robert Klein

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).