From: David Maus <dmaus@ictsoc.de>
To: Ulf Stegemann <ulf-news@zeitform.de>
Cc: emacs-orgmode@gnu.org
Subject: Re: Exporting to single LaTeX file and multiple HTML files
Date: Fri, 07 May 2010 20:55:44 +0200 [thread overview]
Message-ID: <87hbmjwngv.wl%dmaus@ictsoc.de> (raw)
In-Reply-To: <zf.upn633jzhfd.fsf@zeitform.de>
[-- Attachment #1.1: Type: text/plain, Size: 2592 bytes --]
Ulf Stegemann wrote:
>I'm wondering what's the best way to export a single org file to a
>/single/ LaTeX file but also to /multiple/ HTML files. Think of lengthy
>manuals and things like that where such a strategy may be sensible. What
>came to my mind were include commands or publishing functions that
>post-process the export but this seems all rather cumbersome. Has anyone
>a better idea?
The function below could be a starting point of a more general
functionality: It takes a file and splits copys all headlines with a
certain level to a separate output file.
The more general functionality I am thinking of would be: Create
multiple output files for one or more input files that contain
headlines that match a certain criteria.
E.g.: Create output file "TODO.org" with all headlines with todo
keyword TODO or put all files with the tag "tag" into a output file
"tag.org" etc.
Things to consider:
- escape sequences for output file names
("%number" -> counter, "%tag" -> tag etc.)
- functions to move headline from here to there
(copy, cut, cut and insert link)
- maybe provide template for the output file's in file options
(e.g. #+TITLE etc.)
For the splitting-by-level there is one caveat: The numbering of the
headlines is lost.
Definitively something that should be cooked up a little more.
,----
| (defun org-split-file (file level outfmt)
| "Split FILE into multiple files.
| FILE is Org file to split.
| LEVEL is outline level of headlines.
| OUTFMT is a template for output files."
| (let ((visiting (find-buffer-visiting file))
| (cnt 1)
| cand hl out)
| (with-current-buffer (or visiting (find-file-noselect file))
| (save-excursion
| (save-restriction
| (setq cand (org-map-entries 'point
| (format "LEVEL=%s" level)
| 'file))
| (while (setq hl (pop cand))
| (goto-char hl)
| (setq out (concat
| (org-replace-escapes outfmt
| `(("%n" . ,(format "%s" cnt))))
| ".org"))
| (org-copy-subtree)
| (with-current-buffer (find-file-noselect out)
| (erase-buffer)
| (org-paste-subtree level)
| (save-buffer))
| (kill-buffer (find-buffer-visiting out))
| (setq cnt (1+ cnt))
| (print out)))))))
`----
HTH
-- David
--
OpenPGP... 0x99ADB83B5A4478E6
Jabber.... dmjena@jabber.org
Email..... dmaus@ictsoc.de
[-- Attachment #1.2: Type: application/pgp-signature, Size: 230 bytes --]
[-- Attachment #2: Type: text/plain, Size: 201 bytes --]
_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode
next prev parent reply other threads:[~2010-05-07 19:09 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-22 14:32 Exporting to single LaTeX file and multiple HTML files Ulf Stegemann
2010-04-22 15:17 ` Sebastian Rose
2010-04-22 15:44 ` Ulf Stegemann
2010-05-07 18:55 ` David Maus [this message]
2010-05-10 8:21 ` Ulf Stegemann
2010-05-07 19:25 ` Eric Schulte
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=87hbmjwngv.wl%dmaus@ictsoc.de \
--to=dmaus@ictsoc.de \
--cc=emacs-orgmode@gnu.org \
--cc=ulf-news@zeitform.de \
/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).