Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Convert HTML code to JS
Perl
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib/Template/Plugin
.github_mirror
.gitignore
Changes
README.mkdn
dist.ini

README.mkdn

NAME

Template::Plugin::HTMLToJS - Convert HTML To JS

VERSION

version 0.5

SYNOPSIS

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>

DESCRIPTION

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 :

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.

METHODS

filter

Convert html into javascript

BUGS

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.

AUTHOR

celogeek me@celogeek.com

COPYRIGHT AND LICENSE

This software is copyright (c) 2014 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.

Something went wrong with that request. Please try again.