Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Glob syntax for "chapters" in foliant.yml config #66

Open
v4dkou opened this issue Dec 2, 2022 · 0 comments
Open

Glob syntax for "chapters" in foliant.yml config #66

v4dkou opened this issue Dec 2, 2022 · 0 comments

Comments

@v4dkou
Copy link

v4dkou commented Dec 2, 2022

We have two cases, where it would be desirable to forgo explicit enumeration of chapters:

  1. When we already use numbers/alphabetic order on the file system level
  2. When we don't care about the order of chapters at all

If pyyaml supports multiple tags, this syntax would be desirable

chapters: !glob !path chapters/**/*.md
// or when we care about order of chapters _surrounding_ some block of chapters
chapters: 
   - index.md
   - !glob !path chapters/**/*.md
   - last_chapter.md

If pyyaml does not support multiple tags, something like !glob_path would be nice, or even just accept glob syntax by default.

Temporary solutions

Currently we use this snippet to automatically add chapters to config

find src -type f -name "*.md" | sort --numeric-sort | sed "s/src\// - /" >> foliant.yml

Alternatively, one could use a snippet to form a different file completely automated, but

find src -type f -name "*.md" | sort --numeric-sort | sed "s/src\// - /" > chapters.yml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants