emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Florian Beck <fb@miszellen.de>
To: Eric Abrahamsen <eric@ericabrahamsen.net>, emacs-orgmode@gnu.org
Subject: Re: [RFC] About `org-export-with-\(fixed-width\|tables\)'
Date: Wed, 08 Jan 2014 08:23:32 +0100	[thread overview]
Message-ID: <52CCFCF4.4060401@miszellen.de> (raw)
In-Reply-To: <87vbxvd5c6.fsf@ucl.ac.uk>

On 07.01.2014 19:17, Eric S Fraga wrote:
> Eric Abrahamsen <eric@ericabrahamsen.net> writes:

>> Hey, are you actually exporting to an epub? How are you doing that?
>
> I'd be curious to know as well.  I export to epub in two ways, both by
> first exporting to HTML.  Then either use calibre to convert the HTML
> document or load the HTML document in firefox and use the "dotepub"
> addon.  I haven't done this enough to say which is better.

If you are copying your file to a device, conversion with calibre is the 
simplest option.

> I would guess that defining an epub exporter, derived from the HTML
> exporter, may not be that difficult.  If only I had the time :-(


(org-export-define-derived-backend 'fb/org-export-epub 'html
   :menu-entry '(?h 99 ((?p "As epub file" fb/org-export-epub))))

(defun fb/convert-html-to-epub (infile)
   (let ((outfile (concat (file-name-sans-extension infile)
			 ".epub"))
	(max-toc-links "0")
	(level1 "//h:h2")
	(level2 "//h:h3")
	(chapter "\"//*[name()='h1' or name()='h2']\"")
	(chapter-mark "pagebreak"))
     (shell-command
      (format "ebook-convert %s %s --max-toc-links=%s --use-auto-toc 
--level1-toc=%s --level2-toc=%s --chapter=%s --chapter-mark=%s 
--input-encoding=utf8 -v -v -v --authors=\"%s\" --title=\"%s\""
	     infile outfile
	     max-toc-links level1 level2 chapter chapter-mark
	     (user-full-name)
	     (file-name-base outfile)))
     outfile))

(defun fb/org-export-epub (&optional async subtreep visible-only
				     body-only ext-plist)
   (interactive)
   (let* ((extension (concat "." org-html-extension))
	 (file (org-export-output-file-name extension subtreep))
	 (org-export-coding-system org-html-coding-system))
     (org-export-to-file 'fb/org-export-epub file
       async subtreep visible-only body-only ext-plist
       (lambda (file) (fb/convert-html-to-epub file)))))

  reply	other threads:[~2014-01-08  7:23 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-18 20:36 [RFC] About `org-export-with-\(fixed-width\|tables\)' Nicolas Goaziou
2013-12-18 20:44 ` Nick Dokos
2013-12-18 21:19 ` Rasmus
2013-12-18 21:49 ` Thomas S. Dye
2013-12-18 21:58   ` Nicolas Goaziou
2013-12-18 22:24     ` Thomas S. Dye
2013-12-19 22:08 ` Florian Beck
2014-01-03 15:03   ` Bastien
2014-01-05  0:18     ` Nicolas Goaziou
2014-01-05  6:36       ` Bastien
2014-01-05 17:00       ` Florian Beck
2014-01-05 22:14         ` Nicolas Goaziou
2014-01-04 15:11   ` Eric Abrahamsen
2014-01-07 18:17     ` Eric S Fraga
2014-01-08  7:23       ` Florian Beck [this message]
2014-01-08  8:17         ` Eric Abrahamsen
2014-01-08 12:00         ` Eric S Fraga

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=52CCFCF4.4060401@miszellen.de \
    --to=fb@miszellen.de \
    --cc=emacs-orgmode@gnu.org \
    --cc=eric@ericabrahamsen.net \
    /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).