'How to replace spaces from parameters in Fandom's Wikitext?

I want to create an infobox template using Fandom's Wikitext that has data which links to Wikipedia. So, if someone uses the template like:

{{Person Infobox
| city=Los Angeles
}}

it would be display in the infobox as:
City: Los Angeles

I tried:

<infobox>
    <data source="city">
        <label>City</label>
        <format>[https://en.wikipedia.org/wiki/{{{city}}} {{{city}}}]</format>
    </data>
</infobox>

but the link breaks if the data has spaces.

How do I replace the spaces in {{{city}}} with %20 or is it impossible?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source