Liquid, its like Jinja, but not

So in my recent foray into templating languages I ran across liquid.

It has many of the halmarks of Jinja2, however its only kind of similar.

Jinja2 is handy because so many pythonisms can come through.

For instance:

Take the string, ‘debug-this-pal’

In Python

string.split('-')[0]

would yield you: ‘debug’

In Jinja2 is not terribly different:

{{ string.split('-')[0] }}

See what I mean, just a few curly braces!

Liquid disagrees.

Granted, liquid is based on Ruby, whereas Jinja2 is based on python, but take the following ruby:

string.split('-')[0]

Whoa. It’s literally the exact same as the python. That’s handy.

Now we diverge. You see liquid isn’t interested in being that handy.

{{ string.split("-") | first }}

Juuuust similar enough to ruin your (my) day.

No referencing the index position inline.

In fact, as near I can tell if you wanted anything but the first or last element of the newly created list/array you’d have to use two lines!

{% assign split_list = string.split("-") %}
{{ split_list[1] }}

Which, from the aforementioned string, would yield ‘this’.

The fact that the backbone of this blog makes use of liquid is a source of crankiness at the moment.

Tagged #liquid, #jekyll, #code, #python, #jinja, #rant

2021

Back to top ↑

2020

Self Service with Satellite

less than 1 minute read

Recently I had a customer who was running into some legacy infrastructure challenges with VM consistency, meeting (internal) customer expectations, and gener...

Winning with Soft Tokens

2 minute read

Well, I’d call that a sabbatical, but I think that would mean I was relaxing. Time to revive this thing (again).

Back to top ↑

2018

Back to top ↑

2017

Using Powershell and Posh-SSH to GSD.

5 minute read

I’m a guy who thinks you should use the right tool for the job. For instance, if you’re in a Windows environment, and you need to script something, installi...

iDrac, RACADM, sshpass, and BASH

8 minute read

If it were up to me, I suppose that the only thing that I’d really be responsible for would be core networking infrastructure (and consumption of craft brews...

Dynamic DNS and you

3 minute read

Okay, so I know the popular thing with network engineers is to remember the IP of EVERYTHING.  I’m pretty good at it too.  But having a lab at home and needi...

Back to top ↑