Function Dynamic Contact
Contact

HTML to Deluge String

Paste plain HTML and get it back as Deluge string statements, one per line, ready to return from a Creator function for a page or an email.

Runs entirely in your browser. Nothing you paste is uploaded or stored.

HTML

Paste HTML, drop an .html file, or load the sample.

Deluge

Your Deluge appears here

Paste HTML on the left, or drop an .html file anywhere on this tool.

Statements appear as you type.

How to use it

Deluge has no template files, so a function that returns HTML for a Creator page, an email or a widget builds it as a string. This tool writes that string for you: the first line sets the variable, and each line after it adds to it with +=.

In a function

Paste the output into the function body, add your values, and return the variable.

string render_order_summary(int order_id)
{
    order = Orders[ID == order_id];
    html = "<div class='card'>";
    html += "<h2>Order " + order.Order_Number + "</h2>";
    html += "<p>Thanks, " + order.Customer_Name + ". Here is your summary.</p>";
    html += "</div>";
    return html;
}

In an email

Pass the same variable as the message of sendmail.

sendmail
[
    from: zoho.adminuserid
    to: order.Email
    subject: "Your order summary"
    message: html
]

Good to know

Quotes
Double quotes are escaped as \". Choose Single quotes to write attributes as class='card' instead, which is easier to read.
Values
Write {{Customer_Name}} where a value goes. It becomes " + Customer_Name + ", ready for a variable or a field such as {{order.Total}}.
Comments
HTML comments become Deluge comments: // note for one line, /* ... */ for several. Outlook's <!--[if mso]> comments stay in the HTML. Turn off "Convert HTML comments to Deluge comments" to keep every comment in the string.
Scripts
<script> tags are left out of the output, because joining lines breaks them.
Spacing
Where a line break falls inside text, a space is added to the end of the line so words don't run together.
Format and Minify
Format puts each block on its own line, so each becomes its own statement. Minify turns everything into a single statement.