I have a Drupal site and I want to format the address in TWIG.
How do I delete spaces before and after the address?
How to replace the tags "<br>"
by " - "
?
Here is the TWIG code :
<strong>Adresse postale :</strong> {{ store.address }}
Here is the rendering :
<pre class="text-left"><strong>Raison sociale :</strong> Poupette & Cacahuète.
<strong>Adresse postale :</strong>
<div class="field field--name-address field--type-address field--label-hidden field--item"><p class="address" translate="no"><span class="address-line1">rue du vermont</span><br>
<span class="postal-code">14600</span> <span class="locality">Honfleur</span><br>
<span class="country">France</span></p></div>
<strong>Téléphone :</strong> .
<strong>Adresse électronique :</strong> poupette.cacahuete14@gmail.com
<strong>Boutique :</strong> https://www.s1biose.com/fr/boutique/poupette-cacahuete
Immatriculé au de sous le numéro .
</pre>
` with `" - "` + by deleting the spaces before and after. – Jan 14 '20 at 16:37
': ' - '})|raw }}` but I have to remove all the tags to put on a single line (like raw text but with "-"). – Jan 14 '20 at 17:48
': ' - '})|striptags|raw }}` I found but there is still a problem, you must put the address on one line https://ibb.co/zfC5Rn8 – Jan 14 '20 at 17:54
': ' - '})` or `|replace({'
': ' - '})` to solve it after `nl2br` – doydoy44 Jan 14 '20 at 21:13