~kota/gemgen

1

Feature Request: Recursive Generation

Details
Message ID
<bbb5f18c-eb05-04b8-f046-4637357ec573@noraa.gay>
DKIM signature
pass
Download raw message
Hello!

I'd like to be able to point gemgen at a directory of markdown files and 
have it generate gemtext files for all of them in a different directory. 
While preserving the directory structure of the input directories. I 
would also like it to copy other files it finds to the output directory. 
And possible ignore certain files.

For instance, my site looks like this:
├── faering-report
│  ├── fig1.png
│  ├── fig2.png
│  ├── fig3.png
│  ├── fig4.png
│  ├── fig5.png
│  ├── fig6.png
│  └── index.md
├── generate.sh
├── index.md
├── LICENSE
├── README.md
├── stargazer.1.txt
├── stargazer.ini.5.txt
├── stargazer.md
└── upload.sh

It'd like gemgen to create an output folder with contents like this:

├── faering-report
│  ├── fig1.png
│  ├── fig2.png
│  ├── fig3.png
│  ├── fig4.png
│  ├── fig5.png
│  ├── fig6.png
│  └── index.gmi
├── index.gmi
├── stargazer.1.txt
├── stargazer.ini.5.txt
└── stargazer.gmi

This might be a lot to ask but I figured I'd at least suggest it.

Thanks,
Sasha
Details
Message ID
<CKC27JC141IR.3I7XYNZ7BB7AL@agar>
In-Reply-To
<bbb5f18c-eb05-04b8-f046-4637357ec573@noraa.gay> (view parent)
DKIM signature
fail
Download raw message
DKIM signature: fail
I think this is a good idea! I've been inching in that direction for a
little while now. At the moment I personally use a shell script for my
own blog; it's a mess and pretty hacky. I thought about this today and
came up with two different approaches.

The simpler one would be to make gemgen to look for .gitignore and
".gemignore" files to skip over certain files/subdirectories.

This presents the question about if whether or not it should copy all
files by default or be toggled on/off with a CLI flag. I'm leaning
towards not having a flag at all and just making this the new behavior. 

The other more comples approach would be creating a new config file
format (probably toml) and having gemgen look for this config file in
the source directory, falling back to one in $HOME/.config/gemgen and
finally falling back to default settings.

This could be very powerful and allow configuring templating, link
options, and any new features in a single file. This could even allow
you to use different settings for different files. For example, in my
script I use `--heading-links auto` on most pages, but use
`--heading-links off` on my about page which means I currently run
gemgen twice. The config file would allow pattern matching file names
and applying any output setting to any file you'd like.

This would probably make the code more complicated and maybe make gemgen
a bit harder to "setup". Although I think if the defaults are quite good
it could be alieviated and this might prove to be more user friendly
than having all the same functionality tucked away behind strange CLI
flags.

Any thoughts?

- kota
Reply to thread Export thread (mbox)