From mboxrd@z Thu Jan 1 00:00:00 1970 From: Robert Klein Subject: Re: [Exporter] How to save 'info' plist for later use? Date: Wed, 10 Jul 2013 13:34:51 +0200 Message-ID: <51DD46DB.8080803@mpip-mainz.mpg.de> References: <87a9lur8d0.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:32986) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uwsg9-0005hY-IU for emacs-orgmode@gnu.org; Wed, 10 Jul 2013 07:35:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Uwsg6-0008OB-Qu for emacs-orgmode@gnu.org; Wed, 10 Jul 2013 07:35:24 -0400 Received: from gate1.mpip-mainz.mpg.de ([194.95.63.248]:34221) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uwsg6-0008O0-DP for emacs-orgmode@gnu.org; Wed, 10 Jul 2013 07:35:22 -0400 Received: from [10.20.2.71] (port=48330 helo=vmmail1.mpip-mainz.mpg.de) by gate1.mpip-mainz.mpg.de with esmtps (TLSv1:AES256-SHA:256) (Exim 4.76) (envelope-from ) id 1Uwsfx-00089V-2k for emacs-orgmode@gnu.org; Wed, 10 Jul 2013 13:35:13 +0200 Received: from pckr143.mpip-mainz.mpg.de ([10.20.70.83]) by vmmail1.mpip-mainz.mpg.de with esmtp (Exim 4.72) (envelope-from ) id 1Uwsfb-0005Zm-8b for emacs-orgmode@gnu.org; Wed, 10 Jul 2013 13:34:51 +0200 In-Reply-To: <87a9lur8d0.fsf@gmail.com> 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-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Hi Thorsten, I'm currently playing around with retrieving options, e.g. functions like: #+begin_src elisp (defun org-find-export-option (file option-name &optional backend) "Find the OPTION of FILE." (let* ((org-inhibit-startup t) (visiting (find-buffer-visiting file)) (buffer (or visiting (find-file-noselect file))) option) (with-current-buffer buffer (org-mode) (setq option (plist-get (org-export-get-environment backend) option-name))) (unless visiting (kill-buffer buffer)) option)) (defun org-get-comma-separated-options-as-list (file option) "Fetch OPTION from FILE as a list." (split-string (replace-regexp-in-string ", *" "," (org-find-export-option file option 'blog)) "[,\n]" t)) #+end_src org-get-comma-separated-options-as-list description: If you got options in MYFILE inthe form of #+OPTION_NAME: a, b, two words, something else #+OPTION_NAME: and, comma, at end, #+OPTION_NAME: for, example call (org-get-comma-separated-options-as-list MYFILE :option-name) (:option-name is the KEYWORD in the options alist, cf. ox.el) you will get them now as '( "a" "b" "two words" "something else" "and" "comma" "at end" "for" "example"). " The code is some copy and pasting of a current project, but should give you some ideas. org-find-export-option is also a slightly changed copy of ox-publish.el's org-publish-find-title. Best regards Robert On 07/10/2013 12:56 PM, Thorsten Jolitz wrote: > > Hi List, > > how do I get my hands on the 'info' plist (i.e. the communication-channel) > when I try to export data that is (only an isolated) part of a parse-tree? > > Say that originally a whole buffer was parsed, thus the full tree and > options info was available at that point. But then parts of the > resulting parse-tree are extracted with org-element-map and are exported > separately as data later on. > > In that case, I don't know how to pass the original 'info' plist to the > export function, so export results are not complete due to the missing > context information. > > Here is a minimal example: > > With file minimal.org > > #+begin_src org > * A > B > #+end_src > > I call > > #+begin_src emacs-lisp > (setq parse-tree > (with-current-buffer > (find-file-noselect > "/path/to/minimal.org") > (org-element-parse-buffer))) > > (let ((elem (org-element-map parse-tree 'headline 'identity nil t))) > (insert (format "\n\n%s\n\n" elem)) > ;; nil instead of info as 3rd parameter > (insert (org-export-data-with-backend elem 'html nil))) > #+end_src > > and get (note the incomplete IDs in the html) > > #+begin_quote > (headline (:raw-value A :begin 1 :end 7 :pre-blank 0 :hiddenp > nil :contents-begin 5 :contents-end 7 :level 1 :priority > nil :tags nil :todo-keyword nil :todo-type nil :post-blank > 0 :footnote-section-p nil :archivedp nil :commentedp nil :quotedp > nil :CATEGORY nil :title (A) :parent (org-data nil > #0)) (section (:begin 5 :end 7 :contents-begin 5 :contents-end > 7 :post-blank 0 :parent #0) (paragraph (:begin 5 :end > 7 :contents-begin 5 :contents-end 7 :post-blank > 0 :post-affiliated 5 :parent #1) B ))) > > >

A

>
>

> B >

>
>
> #+end_quote > > How could I get my hands on the 'info' plist during the buffer parsing > and save it for later use in calls like > > #+begin_src emacs-lisp > (org-export-data-with-backend elem 'html info) > #+end_src > > ? > -- Robert Klein - Max Planck-Institut für Polymerforschung Ackermannweg 10 55128 Mainz