#tera, #jinja2, #twig, and #liquid are all very similar template languages. #HelixEditor has support for twig, but not the others, so I set the language manually to get the others. I did a little digging and there is a #treesitter grammar for liquid and jinja2, but not tera. It seems to me like there should be a standard set up with a common grammar that can be extended by each so they aren't starting from scratch. Also shouldn't there be a common standard to those templating engines altogether?
#tera #jinja2 #twig #liquid #HelixEditor #treesitter
Here is an example of an implementation similar to the welcoming-message functionality used by @3dprinting to welcome new users.
The function is automatically called for every new follow. The account information of the user can then be used to render a #Jinja2 template and send a message to the user.
# Python
J’ai du mal avec #Python épisode trente douze mille
name= "machin"
print(f"{name.upper()}") ⮕ "MACHIN"
vs
template = "{name.upper()}"
print(template.format(name=name)) ⮕ AttributeError: 'str' object has no attribute 'upper()'
Nan mais sérieusement ! Avec la syntaxe f'{bidule}' tu interprète bien ce qui est entre accolades mais pas avec ''.format()
Bon, ben on va sortir #Jinja2 alors, pour un pauvre truc à 2 balles… 🤦
Has anyone come across a Pelican SSG plug-in or a way to filter articles with Jinja2 that would allow me to filter out a single category from a template?
I suspect this is a solved problem, but I can’t come across it.
I need the date in about a month in the future for a #jinja2 template in a #ansible deployment... 🤷
- there seems to be no function to create a timedelta object
- date objects can be created from strings (via to_datetime filter) or by the yaml parser (d1, d2)
- substracting date objects exposes a timedelta object 🏴☠️
THIS FEELS KIND OF WEIRD 🥴 🤪
is there a more reasonable solution❓
Pushed some changes to the #PyFoam development repository that allow pyFoamPrepareCase.py the popular #Jinja2 as a templating language instead of the built-in #pyratemp
Will be in the #nextRelease
#pyfoam #jinja2 #pyratemp #nextrelease
For #selfhosting or #singleuserinstance s, @dev (homepage https://microblog.pub/) seems rather appealing. #Python + #fastapi + #sqlite + #jinja2 templates (and #nginx ) seems appropriate for a hackable and straightforward setup for a single user server.
I looked at masto.host but was disappointed at the lack of hackability, while a setup from scratch seems like too much work.
#nginx #jinja2 #sqlite #fastapi #Python #singleuserinstance #selfhosting
I dug in an old #jinja2 code I made 3years ago. Oh boy that was a mistake :(
WTF I was thinking back then….
Last day of work in 2022 has been utterly boring. In the afternoon, I didn't know what else to do, so I started reading tutorials of #jinja2. I need to spend more time with it.
I don't know about you, but I think there are few things in the world of computing as infuriating as combining a whitespace-sensitive format like #YAML with a whitespace-insensitive templating system like #Jinja2. I dread having to touch most #Python applications because of this combo.
An #Introduction:
I'm a #Python #SoftwareEngineer by day, but after that I interact with a lot of #FOSS and other #OpenSource projects.
I maintain and own #Select2, the #JavaScript library that I joke is keeping #jQuery alive. I'm also a maintainer on #DjangoRestFramework and #Jinja2 but I'll admit I do less with them now that I don't use #Django for work.
I have a lot of #HomeAutomation projects that make heavy use of #HomeAssistant (#ESPHome, #ZigBee).
#introduction #python #softwareengineer #foss #opensource #select2 #javascript #jquery #djangorestframework #jinja2 #django #homeautomation #homeassistant #esphome #zigbee
Über #Ansible #automatisieren das #Zabbix #postgresql auf einem #debian mit separater #datenbank überwacht, brauchte gerade folgendes Wissen:
* Eigenheiten von Zabbix
* Eigenheiten des #zabbix_agent2
* Eigenheiten der Maintainer von Zabbix für die debian pakete.
* Eigenheiten … Configurationsstruktur der Distro Maintainer
* Eigenheiten … Ansible community.zabbix repo
* #YAML
* #jinja2
Und ich glaube das war es, mehr musste ich dafür heute nicht weiter, sehr gut kennen. o.O
Ps. Ja, tat weh.
#ansible #automatisieren #zabbix #postgresql #debian #datenbank #zabbix_agent2 #yaml #jinja2
My #ansible hot pick of the day: slurp (https://docs.ansible.com/ansible/latest/collections/ansible/builtin/slurp_module.html). Reading a file with slurp in combination with #Jinja2 filters (https://docs.ansible.com/ansible/latest/user_guide/playbooks_filters.html) gives you the power to check for the contents of a file.
Having just thrown out a clunky limited string substitution engine for producing e-mail and replaced it with #Jinja2, I can confidently say:
Jinja2 all the things!