From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: How to convert a string to Org parsed tree Date: Sun, 28 Jul 2013 13:07:31 +0200 Message-ID: <87iozv0wp8.fsf@gmail.com> References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:60263) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V3Op1-0000mX-Ll for emacs-orgmode@gnu.org; Sun, 28 Jul 2013 07:07:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V3Ooq-0005lW-0F for emacs-orgmode@gnu.org; Sun, 28 Jul 2013 07:07:31 -0400 Received: from mail-wi0-x235.google.com ([2a00:1450:400c:c05::235]:61993) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V3Oop-0005lQ-QX for emacs-orgmode@gnu.org; Sun, 28 Jul 2013 07:07:19 -0400 Received: by mail-wi0-f181.google.com with SMTP id en1so2112435wid.2 for ; Sun, 28 Jul 2013 04:07:19 -0700 (PDT) In-Reply-To: (Yujie Wen's message of "Sun, 28 Jul 2013 18:18:27 +0800") 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: Yujie Wen Cc: "emacs-orgmode@gnu.org Mode" Hello, Yujie Wen writes: > I am working on the org-reveal exporter and I need to convert a string > get from org-element-property into HTML format. The property string have > some Org-mode markups that need to be converted to relevant HTML labels. > For example, a string of "/italic/" to "italic" > > Is there any existing Org-mode functions can help me to achieve this kind > of functionality? For interactive functions, you can use `org-export-string-as'. E.g., (org-export-string-as "/italic/" 'html 'body-only) If you don't want the surronding paragraph, you can use the same function with an anonymous export back-end derived from HTML: (org-export-string-as "/italic/" (org-export-create-backend :parent 'html :transcoders '((paragraph . (lambda (e c i) c)))) 'body-only) But, from within an export back-end, there are probably other ways that will not require to collect export options again. E.g, (org-export-data-with-backend (org-element-parse-secondary-string "/italic/" org-element-all-successors) 'html info) Regards, -- Nicolas Goaziou