tinted-theming / tinted-builder-rust

A base16 and base24 builder written in Rust, focused on convenience for template maintainers.
Apache License 2.0
1 stars 1 forks source link

Index File #12

Open RobLoach opened 2 months ago

RobLoach commented 2 months ago

While tinted-builder-rust does process all the mustache templates, is there a method in order to create an index file for all of the templates?

For example...

base16:
    extension: .html
    output: out

base24:
    extension: .html
    output: out
    supported-systems: [base24]

index:
    extension: .html
    output: out
    supported-systems: [index]

index.mustache

<ul>
  {{#schemes}}
    <li><a href="base16-{{name}}.html">{{name}}</a></li>
  {{/schemes}}
</ul>

Result


<ul>
    <li><a href="base16-dracula.html">Dracula</a></li>
    <li><a href="base16-tomorrow.html">Tomorrow</a></li>
    <!-- ... -->
</ul>
JamyGolden commented 2 months ago

What is your use case for this? I'm not opposed to adding this, but if it's something that is very niche then it might be easier to do this with a shell script for example.

RobLoach commented 2 months ago

Did a quick search, and found two cases in the org where it may be helpful...

  1. tinted-sublime-text/themes.py: Be able to create the THEMES array dynamically, rather than hard-coding it.
  2. Possibly tinty/schemes.txt: Use builder-rust to build out the schemes.txt so we don't have to update it manually ourselves.

For my usage, been considering having a dynamic index to list them in C for https://robloach.github.io/nuklear_base16/

A shell script could certainly do it, and likely what has been used. But would be nice to officiate it.

JamyGolden commented 2 months ago

Thanks for looking into it. Yeah I agree that this would be useful. I'm not 100% sure if it will be accepted into the builder spec, but I'm willing to add it to tinted-builder-rust as an extra feature if that's the case. Would you be willing to help figure out the details of the feature?

RobLoach commented 1 month ago

I could have a look at an implementation. You're right about it being out of the spec.