Which is this code written in? [duplicate] - html

This question already has answers here:
HTML {% %} tags?
(4 answers)
Closed 8 years ago.
{% if booking.car_type %}<b>Car Type</b>: {{
I just want to know in which language is the code between the {% %} is written in
Thank you

Django templates ... for sure you must check in Google for much deeper knowledge.

Related

What does the modulus (%) mean in this context?

Currently a beginner using Jinja seeking some help understanding the syntax for this project. Referencing the code below, what does the % mean on both edges of the brackets? To provide context on what code below does, it's showing an search form and click to call link.
I understand it's including the html from that file, just seeking to understand the syntax.
<div class="ribbon-content">
{% include 'cms/plugins/getcare/search_form.html' %}
{% include "includes/call_pp.html" %}
</div>
The {% %} is just the language syntax which holds the logic when using jinja2.
I.E
{% insert logic here %}

How to replace a string with linebreaks in Jinja2 [duplicate]

This question already has answers here:
Passing HTML to template using Flask/Jinja2
(7 answers)
Closed 6 years ago.
I have some data in jinja2 like this
'item1|item2|item3'
And I want to turn it into rendered linebreaks. However, when I replace it with br/ tags, I get the br tags rendered on the page. So
{{ 'item1|item2|item3' | replace("|", "<br/>") }}
renders as
item1<br/>item2<br/>item3<br/>
When I want
item1
item2
item3
on my page. I feel like I'm missing some obvious trick here...
This has to do with autoescaping. Solution that worked for me was:
{% autoescape false %}
{{ 'item1|item2|item3' | replace("|", "<br/>") }}
{% endautoescape %}

Repeat loop of Jekyll Data [duplicate]

This question already has answers here:
How do a loop n.times in Liquid templating using an existing for loop
(3 answers)
Closed 7 years ago.
Is it possible to repeat loops of data? Something like so:
{% for competition in site.data.competitions loop:3 %}
Which would loop and export the the data 3 times?
It would just save me making lots of fake data =)
Thanks!
I don't think that there's a Liquid filter to do it, but you can always put a for in a for:
{% for i in (1..3) %}
{% for competition in site.data.competitions %}
...
{% endfor %}
{% endfor %}

HTML code with curly braces

I have recently seen one HTML page.The code is embed with curly braces.Values for tags and loops are closed by curly braces.
{% if authenticated %}
<h1>Current User</h1>
<p>{{user}}</p>
{% else %}
<h1>Current User</h1>
<p>None</p>
{% endif %}
What is the actaul use of these type of code?
Is HTML embedded with any other language?
This may be Django script templates. Find more here.
This looks like the HTML is enriched with underscore.js or a similar templating engine.
It's used for displaying JavaScript data in your HTML without the need to know how JavaScript works.

Build failure - Liquid Exception: Unknown tag 'block'

Been using Octopress for some days now. However recently met this error when using the following code block in my post:
<div class="container">
{% block content %}
{% endblock %}
</div>
The error returned is
Liquid Exception: Unknown tag 'block'
Looked around but cannot find a solution to this.
Why am I receiving a Liquid Exception?
I know this is very old, but for reference, the liquid template language in Jekyll is still rather limited. I've run across references to liquid templates with extends and block, but Jekyll doesn't support these tags.
There is no block plugin. That's the standard error you get when you are trying to use a plugin or YAML command that doesn't exist.
I think you may want one of the following:
{% blockquote %}
Four scores and sever years ago.
{% endblockquote %}
Or
{% codeblock %}
$ rake generate
$ rake deploy
{% endcodeblock %}
You should really REALLY read the documentation at Octopress. It lists everything it comes with, especially for the basics of blogging:
http://octopress.org/docs/blogging/plugins/
It has many many MANY options for just those two I posted above. For exammple, I often define the author of my blockquotes:
{% blockquote Abraham Lincoln http://www.abrahamlincolnonline.org/lincoln/speeches/gettysburg.htm The Gettysburg Address %}
Four score and seven years ago our fathers brought forth on this continent,
{% endblockquote %}
And that would show up very pretty with a nice <cite> at the bottom, with The Gettysburg Address as a link to that webpage.