Template::Plugin::HTMLToJS - Convert HTML To JS
version 0.3
my $tt = Template->new; $tt->process('htmltojs-template.tt'); # htmltojs-template.tt [% USE HTMLToJS %] [% FILTER $HTMLToJS %] <a href="http://www.test.com">Test</a> <script src="/test.js"></script> [% END %] #Will produce document.write('<a href="http://www.test.com">Test</a>\n <scr'+'ipt> src="/test.js"></scr'+'ipt>'); #could be use easily with on distant site <script src="http://www.test.com/yourhtmltojstemplate"></script>
I have made this module to give an easy way to send html formated content to a javascript call.
For ex: you have a distant web site, and you want to display a top10 with all information,
on distant : <script src="http://yousite.com/top10"></script>
on yoursite : top10.tt :
[% USE HTMLToJS %] [%FILTER $HTMLToJS %] <ul> <li><b>Rank 1 :</b> Test1</li> <li>...</li> </ul> [%END%]
This will convert it in a proper document.write form will al escape you need.
Convert html into javascript
Please report any bugs or feature requests on the bugtracker website https://github.com/celogeek/Template-Plugin-HTMLToJS/issues
When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.
celogeek <me@celogeek.com>
This software is copyright (c) 2011 by celogeek <me@celogeek.com>.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Template::Plugin::HTMLToJS, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Template::Plugin::HTMLToJS
CPAN shell
perl -MCPAN -e shell install Template::Plugin::HTMLToJS
For more information on module installation, please visit the detailed CPAN module installation guide.