Advanced Examples
Text Processing with Variables
@name = Jane Smith
@email = jane@example.com
@age = 28
User Profile:
Name: @name
Email: @email
Age: @age
Adult: :if(@age >= 18, Yes, No)
List Operations
@fruits = :list(apple, banana, orange)
@favorite_fruit = @fruits[1]
Available Fruits:
@fruits[0]
@fruits[1]
@fruits[2]
My favorite fruit is @favorite_fruit.
Dynamic Content Generation
@server = "prod"
@environment = :if(@server == prod, Production, Development)
@current_date = :date(today)
Environment Report - @current_date
Environment: @environment
Server: :uppercase(@server)
Status: :if(@environment == Production, CRITICAL, Normal)
Network Processing
@domain = example.com
@ip = :resolve(@domain)
@hostname = :hostname(@domain)
Network Information:
Domain: @domain
IP: @ip
Hostname: @hostname
Public IP: :if(:is_public(@ip), No, Yes)
Conditional Text Formatting
@users = :list(John, Mary, Peter)
@admin = Mary
System Users:
@users[0]: :if(@users[0] == @admin, ADMIN, User)
@users[1]: :if(@users[1] == @admin, ADMIN, User)
@users[2]: :if(@users[2] == @admin, ADMIN, User)
Math Processing
@values = :list(10, 20, 30, 40, 50)
@sum = :calc(@values[0] + @values[1] + @values[2] + @values[3] + @values[4])
@average = :calc(@sum / 5)
Value Analysis:
Sum: @sum
Average: @average
Rounded Down: :floor(@average)
Email Template
@recipient = Customer
@product = Product XYZ
@price = 199.99
@installments = 10
@installment_value = :calc(@price / @installments)
Subject: Purchase Confirmation - @product
Hello @recipient,
Thank you for purchasing @product for R$ @price.
Your payment has been approved and will be processed within 24 hours.
Payment Method: :if(@installments > 1, Installments, Full Payment)
:if(@installments > 1, Number of installments: @installments, )
:if(@installments > 1, Installment value: R$ :float(@installment_value), )
Sincerely,
Support Team