From mboxrd@z Thu Jan 1 00:00:00 1970 From: Shiyuan Subject: define a new export backend Date: Thu, 31 Jul 2014 00:11:56 -0700 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=089e011763aff3084604ff77fc7f Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:47102) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XCkWs-00015C-Sz for emacs-orgmode@gnu.org; Thu, 31 Jul 2014 03:12:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XCkWr-0002V0-KU for emacs-orgmode@gnu.org; Thu, 31 Jul 2014 03:11:58 -0400 Received: from mail-vc0-x231.google.com ([2607:f8b0:400c:c03::231]:33211) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XCkWr-0002Un-Fd for emacs-orgmode@gnu.org; Thu, 31 Jul 2014 03:11:57 -0400 Received: by mail-vc0-f177.google.com with SMTP id hy4so3513396vcb.36 for ; Thu, 31 Jul 2014 00:11:56 -0700 (PDT) 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" --089e011763aff3084604ff77fc7f Content-Type: text/plain; charset=UTF-8 Hi, I try to define a new export backend in the new export framework. My export backend should behaves like the html except that it transcodes *bold* differently. I try to following the Worg tutorial http://orgmode.org/worg/dev/org-export-reference.html , ox-html.el and use org-export-define-derived-backend. I can see the new backend showing up in the export menu(C-c C-e), but my transcoder for bold is not used. Any help or reference pointer is appreciated. Shiyuan ------------------------- (org-export-define-derived-backend 'my-html-enlish 'html :traslate-alist '((bold . my-org-html-english-bold)) :menu-entry '(?E "Export to HTML-ENGLISH" ((?H "As HTML buffer" my-org-html-english-export-as-html) ))) ------------------------------ (defun my-org-html-english-export-as-html (&optional async subtreep visible-only body-only ext-plist) "This is almost copied from org-html-export-as-html except using my newly defined backend" (interactive) (org-export-to-buffer 'my-html-enlish "*Org HTML-ENG Export*" async subtreep visible-only body-only ext-plist (lambda () (set-auto-mode t)))) ------------------- (defun my-org-html-english-bold (bold contents info) "Transcode BOLD from Org to HTML. Intead of using ordinary bold, we use color to highlight the CONTENTS is the text with bold markup. INFO is a plist holding contextual information." (format " %s " contents)) --089e011763aff3084604ff77fc7f Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi,=C2=A0
=C2=A0 =C2=A0 I try to define a new export b= ackend in the new export framework. My export backend should behaves like t= he html except that it transcodes *bold* differently. =C2=A0I try to follow= ing the Worg tutorial=C2=A0http://orgmode.org/worg/dev/org-export-= reference.html=C2=A0, ox-html.el and use org-export-define-derived-back= end. I can see the new backend showing up in the export menu(C-c C-e), but = my transcoder for bold is not used. =C2=A0Any help or reference pointer is = appreciated.=C2=A0

Shiyuan=C2=A0


-----------= --------------
(org-export-define-derived-backend 'my-html-en= lish 'html
=C2=A0 :traslate-alist '((bold . my-org-html-e= nglish-bold))
=C2=A0 =C2=A0:menu-entry
=C2=A0 '(?E "Export to HTM= L-ENGLISH"
=C2=A0 =C2=A0 =C2=A0 =C2=A0((?H "As HTML buf= fer" my-org-html-english-export-as-html)
)))
------------------------------
(defun my-org-html-english-ex= port-as-html
=C2=A0 (&optional async subtreep visible-only bo= dy-only ext-plist)
=C2=A0"This is almost copied from org-htm= l-export-as-html except using my newly defined backend"
=C2=A0 (interactive)
=C2=A0 (org-export-to-buffer '= ;my-html-enlish "*Org HTML-ENG Export*"
=C2=A0 =C2=A0 a= sync subtreep visible-only body-only ext-plist
=C2=A0 =C2=A0 (lam= bda () (set-auto-mode t))))
-------------------
(defun my-org-html-engli= sh-bold (bold contents info)
=C2=A0 "Transcode BOLD from Org= to HTML. Intead of using ordinary bold, we use color to highlight the=C2= =A0
CONTENTS is the text with bold markup. =C2=A0INFO is a plist holding
contextual information."
=C2=A0 (format "<s= pan style=3D\"color: #a020f0\"> %s </span>"
=C2=A0=C2=A0contents)= )
--089e011763aff3084604ff77fc7f--