emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Shiyuan <gshy2014@gmail.com>
To: "emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org>
Subject: define a new export backend
Date: Thu, 31 Jul 2014 00:11:56 -0700	[thread overview]
Message-ID: <CAOm4EMtxYEko1g=+DW=4ZG44YQ3tRSWHf0ZA98gYF_KP7WCVAQ@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1455 bytes --]

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 "<span style=\"color: #a020f0\"> %s </span>"
  contents))

[-- Attachment #2: Type: text/html, Size: 2133 bytes --]

             reply	other threads:[~2014-07-31  7:12 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-31  7:11 Shiyuan [this message]
2014-07-31  7:27 ` define a new export backend Thorsten Jolitz
2014-07-31  8:08   ` Nicolas Richard
2014-07-31  8:39     ` Nicolas Goaziou
2014-07-31  9:17       ` Nicolas Richard
2014-07-31 11:41         ` Nicolas Goaziou
2014-07-31 22:04           ` Shiyuan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAOm4EMtxYEko1g=+DW=4ZG44YQ3tRSWHf0ZA98gYF_KP7WCVAQ@mail.gmail.com' \
    --to=gshy2014@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).