Author: kake Date: 2012-04-18 18:24:25 +0100 (Wed, 18 Apr 2012) New Revision: 1358
Modified: trunk/Build.PL trunk/Changes trunk/t/94_leaflet.t trunk/templates/json_index.tt trunk/templates/map_index_leaflet.tt Log: Use Template::Plugin::JSON::Escape instead of Template::Plugin::JSON (fixes #288).
Modified: trunk/Build.PL =================================================================== --- trunk/Build.PL 2012-04-18 17:10:02 UTC (rev 1357) +++ trunk/Build.PL 2012-04-18 17:24:25 UTC (rev 1358) @@ -321,7 +321,7 @@ $search_module => 0, 'POSIX' => 0, 'Template' => '2.24', # for .lower vmethod - 'Template::Plugin::JSON' => 0, + 'Template::Plugin::JSON::Escape' => 0, 'Time::Piece' => 0, 'URI::Escape' => 0, 'XML::RSS' => 0,
Modified: trunk/Changes =================================================================== --- trunk/Changes 2012-04-18 17:10:02 UTC (rev 1357) +++ trunk/Changes 2012-04-18 17:24:25 UTC (rev 1358) @@ -23,7 +23,7 @@ Added project metadata to Build.PL (#285). Added a basic stylesheet, installed into the static_path directory. Fixed the JSON output for action=index (using a new dependency on - Template::Plugin::JSON). + Template::Plugin::JSON::Escape).
0.66 12 April 2012 All templates now have access to the "username" TT variable.
Modified: trunk/t/94_leaflet.t =================================================================== --- trunk/t/94_leaflet.t 2012-04-18 17:10:02 UTC (rev 1357) +++ trunk/t/94_leaflet.t 2012-04-18 17:24:25 UTC (rev 1358) @@ -113,8 +113,9 @@ # markers to the map. $output = $guide->show_index( type => "locale", value => "Waddon", format => "map", return_output => 1 ); -like( $output, qr/name:\s*'Red\s+Lion'/, "Name added to JavaScript object." ); -like( $output, qr/address:\s*'High\s+Street'/, +like( $output, qr/name:\s*["']Red\s+Lion["']/, + "Name added to JavaScript object." ); +like( $output, qr/address:\s*["']High\s+Street["']/, "Address added to JavaScript object." );
# Make sure nodes with no geodata get linked to despite not being on the map.
Modified: trunk/templates/json_index.tt =================================================================== --- trunk/templates/json_index.tt 2012-04-18 17:10:02 UTC (rev 1357) +++ trunk/templates/json_index.tt 2012-04-18 17:24:25 UTC (rev 1358) @@ -1 +1 @@ -[% USE JSON %][% nodes.json %] \ No newline at end of file +[% USE JSON.Escape %][% nodes.json %] \ No newline at end of file
Modified: trunk/templates/map_index_leaflet.tt =================================================================== --- trunk/templates/map_index_leaflet.tt 2012-04-18 17:10:02 UTC (rev 1357) +++ trunk/templates/map_index_leaflet.tt 2012-04-18 17:24:25 UTC (rev 1358) @@ -1,3 +1,5 @@ +[% USE JSON.Escape %] + [% page_title = "Map of $criteria_title - $site_name" %] [% INCLUDE header.tt %] [% INCLUDE banner.tt %] @@ -63,14 +65,14 @@ [% i = i + 1 %] [% IF node.has_geodata %] node = { - name: '[% node.name | html %]', - param: '[% node.param %]', + name: [% node.name.json %], + param: [% node.param.json %], [% address = node.node_data.metadata.address.list.first %] [% IF address %] - address: '[% address | html %]', + address: [% address.json %], [% END %] - lat: [% node.wgs84_lat %], - long: [% node.wgs84_long %], + lat: [% node.wgs84_lat.json %], + long: [% node.wgs84_long.json %], }; add_marker( [% i %], node ); [% END %]