[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] How to convert a string to Org parsed tree
From: |
Nicolas Goaziou |
Subject: |
Re: [O] How to convert a string to Org parsed tree |
Date: |
Sun, 28 Jul 2013 13:07:31 +0200 |
Hello,
Yujie Wen <address@hidden> 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 "<i>italic</i>"
>
> 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