The macro sets the amount to convert and the currencies for conversion, constructs an API URL to fetch the conversion rate, and calculates the converted amount.
#set($amount = $parameters.amount)
#set($fromCurrency = $StringUtils.lowerCase($parameters.fromCurrency))
#set($toCurrency = $StringUtils.lowerCase($parameters.toCurrency))
## API URL for conversion
#set($apiUrl = "https://api.coingecko.com/api/v3/simple/price?ids=$fromCurrency&vs_currencies=$toCurrency")
## Fetch conversion rate from the API
#set($response = $RequestManager.get($apiUrl))
## Check if response contains valid data
#if($response && $response[$fromCurrency] && $response[$fromCurrency][$toCurrency])
## Calculate the converted amount
#set($conversionRate = $response[$fromCurrency][$toCurrency])
#set($convertedAmount = $amount * $conversionRate)
## Display the conversion result
<span class="aui-lozenge aui-lozenge-subtle aui-lozenge-success">Conversion result:</span>
<p>
$amount $StringUtils.capitalize($fromCurrency) = $StringUtils.upperCase($toCurrency) $convertedAmount
</p>
#else
## Display error message if conversion fails
<p>
Unable to retrieve conversion rate
</p>
#endGet the latest cryptocurrency rates for major coins.
Retrieve and display current exchange rates for major currencies against a specified base currency.
Parses a table containing cost and currency columns, converts each row's value into a selected result currency, and appends a footer row showing the total sum. Useful for tracking multi-currency expenses and reporting totals in a unified currency.
Display information about how many users have access to each space
Macro that will show a "Delete me" message only for editors (in the Page Edit mode)
Shows H1 headings directly to children's topics for easy navigation.
Macro for generating ID in base32 format
The content of this macro will not go to the printing page
The content of this macro will be printed and exported but not rendered on the page in view mode