[O] How to convert a string to Org parsed tree
Hi, 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 iitalic/i Is there any existing Org-mode functions can help me to achieve this kind of functionality? Regards, Yujie
Re: [O] How to convert a string to Org parsed tree
On 07/28/2013 12:18 PM, Yujie Wen wrote: Hi, 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 iitalic/i Is there any existing Org-mode functions can help me to achieve this kind of functionality? Regards, Yujie Hi Yujie, how about applying the exporter to the string, e.g. something like (with-temp-buffer (insert (plist-get plist yout-property-string)) (org-html-export-as-html nil nil nil t new-plist) (buffer-string)) (didn't test, just typed this into the mail) Best regards Robert
Re: [O] How to convert a string to Org parsed tree
Hello, Yujie Wen yjwen...@gmail.com 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 iitalic/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
Re: [O] How to convert a string to Org parsed tree
Yujie Wen yjwen...@gmail.com writes: Hi, 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? Regards, Yujie Try out `org-export-string-as', that will probably do what you want... E
Re: [O] How to convert a string to Org parsed tree
Hi, Robert, Nicolas and Eric, Thanks to all of you for the kind answers. org-export-data-with-backend and org-element-parse-secondary-string best meet my requirements. They worked just as I expected. Thanks again. Regards, Yujie 2013/7/28 Eric Abrahamsen e...@ericabrahamsen.net Yujie Wen yjwen...@gmail.com writes: Hi, 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? Regards, Yujie Try out `org-export-string-as', that will probably do what you want... E