This module allow you to convert a block of html into a proper JS syntax.
What kind of usage could you have of this ?
Let’s say you have a website that refer over website. And you have a Top10. So you want to be able to give to over site your Top10 widget.
Basically on the other website they will do :
- script balise (don’t write directly <script> in a document.write. It will be interpreted by the browser)
- special char like quote or double quote depending on what you start with your document write
- handle char return
Well, you cannot focus on your HTML code.
So with the plugin, you can just :
[% USE HTMLToJS %]
[%FILTER $HTMLToJS %]
<li><b>Rank 1 :</b> Test1</li>
It will do :
document.write('<ul>\n<li><b>Rank 1 :</b> Test1</li>\n<li>...</li>\n</ul>');
You can easily purpose a simple widget that send a JS template and you can write a big part of it in HTML.
Here some links :