emacs-orgmode
[Top][All Lists]
Advanced

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

Re: Splitting large org file into smaller ones


From: Diego Zamboni
Subject: Re: Splitting large org file into smaller ones
Date: Sun, 31 May 2020 00:23:24 +0200

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



reply via email to

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