Nils Diewald | 02df991 | 2014-06-03 16:08:07 +0000 | [diff] [blame] | 1 | % use JSON::XS; |
Nils Diewald | f2e02a9 | 2014-11-12 18:31:05 +0000 | [diff] [blame] | 2 | % use Mojo::JSON; |
Nils Diewald | 02df991 | 2014-06-03 16:08:07 +0000 | [diff] [blame] | 3 | |
Nils Diewald | e758151 | 2014-12-04 16:12:10 +0000 | [diff] [blame^] | 4 | % if (search->query_jsonld && korap_test_port()) { |
Nils Diewald | 7cad840 | 2014-07-08 17:06:56 +0000 | [diff] [blame] | 5 | % 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 Diewald | e99d904 | 2014-11-20 23:36:54 +0000 | [diff] [blame] | 10 | <pre class="query serial<%== $action // '' %>" <% unless ($action) { %>onclick="this.classList.toggle('active')"<% } %>> |
Nils Diewald | 44a7278 | 2014-06-20 16:03:21 +0000 | [diff] [blame] | 11 | <span>JSON-LD Serialization for <%= param 'q' %> (<%= param 'ql' %>)</span> |
Nils Diewald | 7cad840 | 2014-07-08 17:06:56 +0000 | [diff] [blame] | 12 | <code> |
Nils Diewald | f2e02a9 | 2014-11-12 18:31:05 +0000 | [diff] [blame] | 13 | %# Workaround to keep true, false, and null intact |
Nils Diewald | 8f4b5da | 2014-12-03 22:13:39 +0000 | [diff] [blame] | 14 | %= $json->encode($json->decode(Mojo::JSON::encode_json(search->query_jsonld))) |
Nils Diewald | 7cad840 | 2014-07-08 17:06:56 +0000 | [diff] [blame] | 15 | </code> |
| 16 | </pre> |
| 17 | %= javascript begin |
| 18 | hljs.initHighlightingOnLoad(); |
Nils Diewald | 7cad840 | 2014-07-08 17:06:56 +0000 | [diff] [blame] | 19 | % end |
Nils Diewald | 44a7278 | 2014-06-20 16:03:21 +0000 | [diff] [blame] | 20 | % }; |