spin-systems / quill

MIT License
0 stars 0 forks source link

staticjinja CLI #13

Closed lmmx closed 2 years ago

lmmx commented 2 years ago

staticjinja can be used to build a templates directory, and this can serve as a generic feature across all the sites. This would be nice to run through quill, simply at first.

from staticjinja import Site

if __name__ == "__main__":
    context = {'ARTICLE_LIST': [('title1', 'mod_date1', 'short_desc1'), ('title2', 'mod_date2', 'short_desc2')]}
    site = Site.make_site(contexts=[('index.html', context)])
    site.render()

in

<!-- templates/index.html -->
    <dl class="feed">
            {% for URL, ARTICLE_TITLE, FILE_MOD_DATE, SHORT_DESCRIPTION in ARTICLE_LIST %}
            <dt><a href="{{ URL }}" title="{{ ARTICLE_TITLE }} — updated {{ FILE_MOD_DATE }}"></a></dt>
            <dd>{{ SHORT_DESCRIPTION }}</dd>
            {% endfor %}
    </dl>

However this presupposes a single script per subdomain, hence a lot of duplication. Instead: a single interface through quill, providing all necessary context to each subdomain, and only editing the software for quill to build a template with the appropriate info (which should probably be loaded from config files rather than stored in the driver lib).

Whether to build the templates should be tied to whether the git repo is clean/dirty.

Reminder:

So it stands to reason that scan would gather the context info to provide to the jinja template renderer in fold