emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] [RFC] About `org-export-with-\(fixed-width\|tables\)'


From: Florian Beck
Subject: Re: [O] [RFC] About `org-export-with-\(fixed-width\|tables\)'
Date: Wed, 08 Jan 2014 08:23:32 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0

On 07.01.2014 19:17, Eric S Fraga wrote:
Eric Abrahamsen <address@hidden> 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 via email to

[Prev in Thread] Current Thread [Next in Thread]