From: Richard Lawrence <richard.lawrence@berkeley.edu>
To: emacs-orgmode@gnu.org
Subject: Re: ePub and Org mode
Date: Sun, 20 Feb 2011 17:34:40 -0800 [thread overview]
Message-ID: <87ei725fwv.fsf@berkeley.edu> (raw)
In-Reply-To: 877hcv83fe.fsf@gmail.com
"Eric Schulte" <schulte.eric@gmail.com> writes:
>> The only thing missing is a function to export all (not excluded)
>> subtrees one by one and honor the properties slapped onto each subtree.
>>
>
> `org-map-entries' should satisfy this need. -- Eric
I have been doing something similar with LaTeX export. Here is my
(pretty hacky) code; it should be easy to adapt to HTML export. It
does the following:
1) export each subtree of the current tree as a separate PDF (there's
some validation here, to make sure each of these trees has properties
that I need to produce the output I want)
2) concatenates the resulting PDFs into a single PDF for printing (this
requires the pdftk package)
Good luck!
Richard
;;;;
(defun org-export-individual-pdfs-and-concat ()
(interactive)
(setq export-files nil
pdf-files nil
; point must be in main tree to be exported (not a subtree)
concat-pdf-name (get-property-or-fail (point) "CONCATENATED_PDF_NAME"))
(progn
(org-map-entries
(lambda ()
(setq org-map-continue-from (outline-next-heading))
(org-mark-subtree)
; org-map-entries positions point at the beginning of each subtree
(let ((org-trust-scanner-tags t))
(push (get-property-or-fail (point) "EXPORT_FILE_NAME") export-files))
(org-export-as-pdf nil))
nil 'tree)
(concat-pdfs (nreverse (mapcar 'tex-name-to-pdf-name export-files))
concat-pdf-name)))
(defun get-property-or-fail (pom property)
(or
; probably some opportunity for optimization here...see function
; documentation for org-map-entries
(org-entry-get pom property)
(error (format "Entry at %s does not define property %s" (org-heading-components) property))))
(defun tex-name-to-pdf-name (filename)
(concat (file-name-sans-extension filename) ".pdf"))
(defun concat-pdfs (in-files out-file)
(shell-command
(format "pdftk %s cat output %s"
(mapconcat (lambda (s) s) in-files " ") ; join pdf names with spaces
out-file)))
next prev parent reply other threads:[~2011-02-21 1:33 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-19 9:25 ePub and Org mode Alan L Tyree
2011-02-19 10:54 ` Bastien
2011-02-19 19:14 ` Alan L Tyree
2011-02-19 21:46 ` Christian Moe
2011-02-19 22:15 ` Alan L Tyree
2011-02-20 7:53 ` Achim Gratz
2011-02-20 8:17 ` Eric Schulte
2011-02-21 1:34 ` Richard Lawrence [this message]
2011-02-20 9:54 ` Alan Tyree
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=87ei725fwv.fsf@berkeley.edu \
--to=richard.lawrence@berkeley.edu \
--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).