reddit / emacs

Publish headlines into multiple individual files?

deafpolygon · 2022-12-16 10:02
I'm an emac / LISP newbie. I haven't really dug into it yet, but is it possible to take an org file.. take a series of 1st level or 2nd level headlines and generate .md (or .org) files based on its content? i.e. in `somecollection.org` * item1 # updated sometimes yesterday sometext ** item1 subheading somemore text * item2 something about item2 Then take that, and make item1.md, item2.md with the contents of `item1.md` looking like: # item1 Some text ## item1 subheading somemore text and `item2.md`: # item2 something about item2 My premise: I want to maintain some collection of data in a single file and publish it into another format for sharing/distribution. With comment blocks ignored and not shared. It doesn't have to be exactly like I described, if there's a reliable package that does something like this already.
akirakom · 2022-12-16 10:10
Check out `org-transclusion` package.
deafpolygon · 2022-12-16 10:29
Interesting package, but not what I need. I want to generate new files based on the headlines in my current ('master') file.
akirakom · 2022-12-16 10:35
It's simpler. You can use Org Exporting. It's builtin.
deafpolygon · 2022-12-16 10:47
> Org Exporting This only exports a single file. Is there a way to have it do mulitple files, one per headline?
akirakom · 2022-12-16 10:53
This is ox-hugo, but I think you can implement a similar functionality for yourself: https://ox-hugo.scripter.co/doc/auto-export-on-saving/
deafpolygon · 2022-12-16 11:30
I’ll take a look at it