I wanted to call images id with a variable like
<img src="{{ settings.custom_info_{{ i }}}_img1 | img_url: 'master' }}">
Obviously no handle are aloud inside a handle so I came with this solution. How can I clean my code so I don't have to make if for every element from the loop ?
<div class="custom_info__wrapper">
<div class="container">
<div class="row">
{% for i in (1..3) %}
{% capture text1 %}custom_info_{{ i }}_text1{% endcapture %}
{% capture text1_lang %}custom_blocks.custom_info_block_{{ i }}.text_1{% endcapture %}
{% capture text2 %}custom_info_{{ i }}_text2{% endcapture %}
{% capture text2_lang %}custom_blocks.custom_info_block_{{ i }}.text_2{% endcapture %}
{% capture img1 %}custom_info_{{i}}_img1{% endcapture %}
<div class="col-sm-4 custom_info custom_info__{{ i }}">
{% assign A = text1_lang | t %}{% if A.size > 0 %}<h6 class="heading_border-old">{{ A }}</h6>{% else %}<h6 class="heading_border-old">{{ settings[text1] }}</h6>{% endif %}
{% if i == 1 %}
<img src="{{ settings.custom_info_1_img1 | img_url: 'master' }}" />
{% elsif i == 2 %}
<img src="{{ settings.custom_info_2_img1 | img_url: 'master' }}" />
{% elsif i ==3 %}
<img src="{{ settings.custom_info_3_img1 | img_url: 'master' }}" />
{% endif %}
{% assign B = text2_lang | t %}{% if B.size > 0 %}<p>{{ B }}</p>{% else %}<p>{{ settings[text2] }}</p>{% endif %}
</div>
{% endfor %}
</div>
</div>
</div>