blob: f6e73be89137378cbe6640adb697ff8d44232c9d [file] [log] [blame]
Nils Diewald02df9912014-06-03 16:08:07 +00001% use JSON::XS;
Nils Diewaldf2e02a92014-11-12 18:31:05 +00002% use Mojo::JSON;
Nils Diewald02df9912014-06-03 16:08:07 +00003
Nils Diewald2fe12e12015-03-06 16:47:06 +00004% if (search->query_jsonld && kalamar_test_port()) {
Nils Diewald7cad8402014-07-08 17:06:56 +00005% my $action;
6% if (param('action') && param('action') eq 'inspect') {
7% $action = ' active" style="cursor: default';
8% };
9% state $json = JSON::XS->new->allow_blessed->pretty->canonical(1);
Nils Diewalde99d9042014-11-20 23:36:54 +000010<pre class="query serial<%== $action // '' %>" <% unless ($action) { %>onclick="this.classList.toggle('active')"<% } %>>
Nils Diewald034ea702015-01-16 19:41:52 +000011 <span>JSON-LD Serialization for &quot;<%= param 'q' %>&quot;<% if (param('ql')) { %> (<%= param 'ql' %>)<% } %></span>
Nils Diewald7cad8402014-07-08 17:06:56 +000012 <code>
Nils Diewaldf2e02a92014-11-12 18:31:05 +000013%# Workaround to keep true, false, and null intact
Nils Diewald8f4b5da2014-12-03 22:13:39 +000014%= $json->encode($json->decode(Mojo::JSON::encode_json(search->query_jsonld)))
Nils Diewald7cad8402014-07-08 17:06:56 +000015 </code>
16</pre>
17%= javascript begin
18hljs.initHighlightingOnLoad();
Nils Diewald7cad8402014-07-08 17:06:56 +000019% end
Nils Diewald44a72782014-06-20 16:03:21 +000020% };