From: Diego Zamboni <diego@zzamboni.org>
To: "Marvin M. Doyley" <mdoyley@ur.rochester.edu>
Cc: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: Splitting large org file into smaller ones
Date: Sun, 31 May 2020 00:23:24 +0200 [thread overview]
Message-ID: <CAGY83EfcGkBo3ex+LK3+iFNeu=mZ3VThaQfsJWckHMacK-Emqg@mail.gmail.com> (raw)
In-Reply-To: <64119DDD-42BD-47AC-9EB6-DD25FE58BB37@ur.rochester.edu>
Hi Marvin,
I replied to a similar question some time ago, here's my answer (with
updated links since the files have changed in the meantime):
I do something similar in my ox-leanpub-book module [1], which exports
each top-level heading to a different file. The general idea is to use
=org-map-entries= to loop over the entire buffer [2]. The function you
call can then check whether the current entry is a header at the level
you want [3] and then export it to the corresponding file. The title
can be used to deduct the filename [4].
I found that I had to mark the entire subtree before calling the
export function [5], otherwise the headline was not getting included
in the export.
I based my code originally on this blog post, which might be a simpler
starting point:
https://medium.com/@lakshminp/publishing-a-book-using-org-mode-9e817a56d144
- this code does not select the entire subtree before exporting, which
means only the contents of the section is exported, but not the
headline itself.
I wrote a simplified function which puts the above ideas together,
feel free to use it:
https://gist.github.com/zzamboni/2e6ac3c4f577249d98efb224d9d34488
Hope this helps!
--Diego
[1] https://github.com/zzamboni/ox-leanpub/tree/book-and-markua
[2] https://github.com/zzamboni/ox-leanpub/blob/f7ae0f86f517a321a5150e1c712554b12acf144b/ox-leanpub-book.el#L216-L217
[3] https://github.com/zzamboni/ox-leanpub/blob/f7ae0f86f517a321a5150e1c712554b12acf144b/ox-leanpub-book.el#L145
[4] https://github.com/zzamboni/ox-leanpub/blob/f7ae0f86f517a321a5150e1c712554b12acf144b/ox-leanpub-book.el#L154-L158
[5] https://github.com/zzamboni/ox-leanpub/blob/f7ae0f86f517a321a5150e1c712554b12acf144b/ox-leanpub-book.el#L192
On Sat, May 30, 2020 at 12:08 PM Marvin M. Doyley
<mdoyley@ur.rochester.edu> wrote:
>
> Hi there,
>
> Is there an efficient way to split a large org file into smaller ones?
>
> Lets say I have a master file with the following
>
>
> * Notes
> ** Candidate A
> - Strong technical background
> - High H-factor
> - good funding
> - More established investigator
> - Huge startup need $$
>
> ** Candidate B
> - lower startup need
> - signal processing
> - young investigator
>
>
> How do I export the subtree to separate org files, say
>
> - Candidate-a.org
> - Candidate-b.org
>
>
> Thanks
>
> M
next prev parent reply other threads:[~2020-05-30 22:24 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-30 9:51 Splitting large org file into smaller ones Marvin M. Doyley
2020-05-30 13:13 ` Marcin Borkowski
2020-05-31 0:40 ` Marvin M. Doyley
2020-05-30 14:37 ` Tim Visher
2020-05-30 15:36 ` William Denton
2020-05-30 18:18 ` Julius Dittmar
2020-05-31 0:42 ` Marvin M. Doyley
2020-05-30 22:23 ` Diego Zamboni [this message]
2020-05-31 0:41 ` Marvin M. Doyley
2020-05-31 15:29 ` John Kitchin
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAGY83EfcGkBo3ex+LK3+iFNeu=mZ3VThaQfsJWckHMacK-Emqg@mail.gmail.com' \
--to=diego@zzamboni.org \
--cc=emacs-orgmode@gnu.org \
--cc=mdoyley@ur.rochester.edu \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.