John Resig Micro templating bug

So I am aiming to use John Resig's templating engine.

I need to pass the function a variable containing the "template". However, the problem is that I need to pass something like:

console.log("Double quotes");
<iframe src="<%=SOME_VARIABLE%>" frameborder="0"></iframe>
<div>I think I'm going to break</div>
<% for ( var i = 0; i < users.length; i++ ) { %>
<li><a href="<%=users[i]%>"><%=users[i]%></a></li>
<% } %>
<iframe src='<%=SOME_VARIABLE%>' frameborder="0"></iframe>
<div>I think I"m going to break</div>
<% for ( var i = 0; i < users.length; i++ ) { %>
<li><a href='<%=users[i]%>'><%=users[i]%></a></li>
<% } %>

The thing that seems to break is:


With this bit of code being passed through the Regex it fails. It is important that I am able to pass any of the above code and have it not break. Any ideas?


So I came across this article which has a fix for this (also changes the <% %> to <# #> FYI

str.replace(/[\r\t\n]/g, " ")
               .replace(/'(?=[^#]*#>)/g, "\t")
               .replace(/<#=(.+?)#>/g, "',$1,'")
               + "');}return p.join('');";

Need Your Help

SQL Joins with distinct columns

sql db2

Consider two (possibly temporary) tables X and Y each with many columns. In DB2, if I make a cross join like this,

How do I add a data-offset to a Bootstrap 4 fixed-top responsive navbar?

navigation navbar nav bootstrap-4 twitter-bootstrap-4

So, in Bootstrap v3, you would just add a data-offset attribute to the nav tag, with the pixel offset, in this case 54px,