From 94d6f67524eefcc76012adc2f14a4f933424e95f Mon Sep 17 00:00:00 2001 From: eneller Date: Thu, 3 Apr 2025 11:15:37 +0200 Subject: [PATCH] feat: display variables --- index.html | 27 +++++++++++++++------------ main.py | 8 ++++++++ pyproject.toml | 1 + uv.lock | 27 ++++++++++++++++++++++++++- 4 files changed, 50 insertions(+), 13 deletions(-) create mode 100644 main.py diff --git a/index.html b/index.html index 5da3a32..d77c771 100644 --- a/index.html +++ b/index.html @@ -8,26 +8,29 @@ -

Mein Name

-

Beruf

+

{{ name }}

+

{{ occupation }}

- Adresse + {{ address }}

- - - noreply@example.org + + + {{ email }} +

- - - Telefon: 01234/56789 + + + {{ phone }} +

- - - Whatsapp + + + Whatsapp +

\ No newline at end of file diff --git a/main.py b/main.py new file mode 100644 index 0000000..3e14312 --- /dev/null +++ b/main.py @@ -0,0 +1,8 @@ +from jinja2 import Environment, FileSystemLoader, meta + +env = Environment(loader=FileSystemLoader('.')) +template_source = env.loader.get_source(env, 'index.html') +parsed_content = env.parse(template_source) +vars = meta.find_undeclared_variables(parsed_content) +vars = dict.fromkeys(vars, None) +print(vars) \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index a3ca231..1426c8b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,5 +5,6 @@ description = "Plain HTML Placeholder Website for People that need an Internet P readme = "README.md" requires-python = ">=3.12" dependencies = [ + "click>=8.1.8", "jinja2>=3.1.6", ] diff --git a/uv.lock b/uv.lock index 10b5e1b..b14eeee 100644 --- a/uv.lock +++ b/uv.lock @@ -2,6 +2,27 @@ version = 1 revision = 1 requires-python = ">=3.12" +[[package]] +name = "click" +version = "8.1.8" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "colorama", marker = "sys_platform == 'win32'" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/b9/2e/0090cbf739cee7d23781ad4b89a9894a41538e4fcf4c31dcdd705b78eb8b/click-8.1.8.tar.gz", hash = "sha256:ed53c9d8990d83c2a27deae68e4ee337473f6330c040a31d4225c9574d16096a", size = 226593 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/7e/d4/7ebdbd03970677812aac39c869717059dbb71a4cfc033ca6e5221787892c/click-8.1.8-py3-none-any.whl", hash = "sha256:63c132bbbed01578a06712a2d1f497bb62d9c1c0d329b7903a866228027263b2", size = 98188 }, +] + +[[package]] +name = "colorama" +version = "0.4.6" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/d8/53/6f443c9a4a8358a93a6792e2acffb9d9d5cb0a5cfd8802644b7b1c9a02e4/colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44", size = 27697 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/d1/d6/3965ed04c63042e047cb6a3e6ed1a63a35087b6a609aa3a15ed8ac56c221/colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6", size = 25335 }, +] + [[package]] name = "jinja2" version = "3.1.6" @@ -57,8 +78,12 @@ name = "placeholder-html" version = "0.1.0" source = { virtual = "." } dependencies = [ + { name = "click" }, { name = "jinja2" }, ] [package.metadata] -requires-dist = [{ name = "jinja2", specifier = ">=3.1.6" }] +requires-dist = [ + { name = "click", specifier = ">=8.1.8" }, + { name = "jinja2", specifier = ">=3.1.6" }, +]