base generator with askama templating, toml config and json writing

This commit is contained in:
2025-12-01 18:19:15 +01:00
commit bdfa359702
8 changed files with 1918 additions and 0 deletions
+51
View File
@@ -0,0 +1,51 @@
body {
font-family: system-ui, -apple-system, Roboto, "Segoe UI", Arial;
padding: 2rem;
max-width: 800px;
margin: auto;
}
h1 {
color: #333;
}
label {
font-weight: 600;
display: block;
margin-bottom: 0.2rem;
}
.field {
margin-bottom: 1.5rem;
}
.desc {
color: #666;
font-size: 0.9rem;
margin-bottom: 0.4rem;
}
input,
textarea,
select {
width: 100%;
padding: 0.4rem;
margin-top: 0.2rem;
box-sizing: border-box;
border: 1px solid #ccc;
border-radius: 4px;
}
button {
padding: 0.6rem 1rem;
font-size: 1rem;
background-color: #007acc;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
}
button:hover {
background-color: #005fa3;
}
+16
View File
@@ -0,0 +1,16 @@
<!DOCTYPE html>
<html lang="{{ lang }}">
<head>
<meta charset="utf-8"/>
<title>{% block title %}Dynamic Form{% endblock %}</title>
<style>
/*<![CDATA[*/
{%~ include "_layout.css" ~%}
/*]]>*/
</style>
</head>
<body>
{% block content %}{% endblock %}
</body>
</html>
+24
View File
@@ -0,0 +1,24 @@
{% extends "_layout.html" %}
{% block title %}Form{% endblock %}
{% block content %}
<h1>Dynamic Form</h1>
<form action="/submit" method="POST" autocomplete="off">
{% for f in fields %}
<div class="field">
<label for="{{ f.name }}">{{ f.description }}</label>
<div class="desc">{{ f.description }}</div>
{% if f.answer_type == "textarea" %}
<textarea id="{{ f.name }}" name="{{ f.name }}" rows="5"></textarea>
{% elif f.answer_type == "select" %}
<select id="{{ f.name }}" name="{{ f.name }}"><option value="">(no options)</option></select>
{% else %}
<input id="{{ f.name }}" name="{{ f.name }}" type="{{ f.answer_type }}">
{% endif %}
</div>
{% endfor %}
<div><button type="submit">Submit</button></div>
</form>
{% endblock %}