Splitting large text files

Does anyone know a way to split large text files into unique posts for a Grav site?

For instance, I want to use the RTFM template to publish a book, which is divided into chapters, sections, and subsections. I have the book properly formatted as a single text document or HTML file.

Is there a tool to automatically break down the larger document into chapter, sections, and subsections, with the smaller units nested under the larger ones?

I can add the necessary metadata for each would-be Markdown file. I just a way to break down the larger file without having to manually create hundreds of folders, subfolders, and files.

Thank you, — GM

Certainly nothing exists for Grav specifically. However this chunking functionality you are asking about is done for all kinds of reasons on all kinds of platforms.

You could probably find a suitable script to chunk you large HTML files. Either modify this script to automatically add some metadata, or do that after.


example here.

You might have a look at:

It chuncks large markdown into ‘sections’ only (no sub-sections); I preferred a simple mechanism on top of markdown. It’s in github, not in the official gpm catalogue gpm, maintained by rhukster. It was developed against an older version of Grav (and not tested against the latest 0.9.43). Feel free to submit bugs/requests for improvements …

If you ensure it works with the latest version I would be glad to add it to GPM