Skip to content

Instantly share code, notes, and snippets.

@isummation
Created September 6, 2019 07:05
Show Gist options
  • Save isummation/b6433d69cf4ecbabdfa90e16e9af9a0a to your computer and use it in GitHub Desktop.
Save isummation/b6433d69cf4ecbabdfa90e16e9af9a0a to your computer and use it in GitHub Desktop.
<cfsavecontent variable="htmlcontent">
<!DOCTYPE html [ <!ENTITY nbsp "&#160;">
<!ENTITY reg "&#174;"> <!ENTITY uuml "&#220;">
<!ENTITY auml "&#196;"> <!ENTITY ouml "&#214;">
<!ENTITY rsquo "&#146;">]>
<body>
<table border="1" cellpadding="3" cellspacing="1" class="normalTable">
<thead>
<tr>
<th>First Name</th>
<th>Last Name</th>
<th>Email</th>
</tr>
</thead>
<tbody>
{{#Customer}}
<tr>
<td>{{firstname}}</td>
<td>{{lastname}}</td>
<td>{{email}}</td>
{{/Customer}}
</tr>
</tbody>
</table>
</body>
</cfsavecontent>
<!--- Convert to {{# ... }} to html tag--->
<cfset htmlcontent = reReplaceNoCase(htmlcontent, "\{\{##(.*?)\}\}", "<\1>","all")>
<!--- Convert to {{/ ... }} to html tag--->
<cfset htmlcontent = reReplaceNoCase(htmlcontent, "\{\{\/(.*?)\}\}", "</\1>","all")>
<!--- Convert to {{{ ... }}} to html tag--->
<cfset htmlcontent = reReplaceNoCase(htmlcontent, "\{\{\{(.*?)\}\}\}", "<\1/>","all")>
<!--- Convert to {{ ... }} to html tag--->
<cfset htmlcontent = reReplaceNoCase(htmlcontent, "\{\{(.*?)\}\}", "<\1/>","all")>
<cfset var validator = XmlValidate(htmlcontent)>
/// OUTPUT
["[Fatal Error] :20:7: The element type \"tr\" must be terminated by the matching end-tag \"</tr>\". "]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment