Template to forms
I think Jinja makes sense for building this, in particular because it contains a full-on lexer and parser. You can leverage those to derive your own versions of this that do what you need.
I'd like to do somehow the contrary to what a template is used for: I want to write templates and programmatically derive a representation of the different tags and placeholders present in the template, to ultimately generate a form.
To put it another way, when you usually have the data and populate the template with it, I want to have the template and ask the user the right data to fill it.
Example (with pseudo-syntax): Hello {{ name_of_entity only-in ['World', 'Universe', 'Stackoverflow'] }}!
With that I could programatically derive that I should generate a form with a select tag named 'name_of_entity' and having 3 options ('World', 'Universe', 'Stackoverflow').
I looked into Jinja2, and it seems I can reach my goal using it and extending it (even if it's made to do things the other way). But I am still unsure how I should do in some cases, eg.:

if I want to represent that {{ weekday }} has values only in ['Mo', 'Tu', ...]
if I want to represent in the template that the {{ amount }} variable is accepting only integers...

Is Jinja a good base to reach these goals? If yes, how would you recommend to do that?