blob: 038a73075a4a4f4ca6e70d47794f37abf968fe51 [file] [log] [blame]
Akron30ee5142015-06-26 01:50:14 +02001% use Mojo::JSON qw/encode_json/;
2% my $match = stash('match') || {};
3% my %match_data = %$match;
4% delete @match_data{qw/snippet startMore endMore field/};
Akron0a6768f2016-07-13 18:00:43 +02005% my $text_sigle = $match->{textSigle} // join('/', $match->{corpusID}, $match->{docID}, $match->{textID});
6% my $id = $text_sigle . '#' . $match->{matchID};
Akrondffa9392018-10-12 16:26:09 +02007% # Legacy:
8% my $layer_infos = $match->{layerInfos} // $match->{layerInfo} // 'cnx/c=spans corenlp/ne=tokens corenlp/p=tokens mate/l=tokens mate/m=tokens mate/p=tokens opennlp/p=tokens tt/l=tokens tt/p=tokens xip/c=spans';
Akron0a6768f2016-07-13 18:00:43 +02009<li data-match-id="<%= $match->{matchID} %>"
10 data-text-sigle="<%= $text_sigle %>"
Akrondffa9392018-10-12 16:26:09 +020011 data-available-info="<%= $layer_infos %>"
Akron30ee5142015-06-26 01:50:14 +020012 data-info="<%== b(encode_json(\%match_data))->decode->xml_escape %>"
Akrondffa9392018-10-12 16:26:09 +020013 id="<%= $id %>"<% if (current_route eq 'match') { %> class="active"<% } =%>>
Akron46b9f212017-05-01 13:55:17 +020014%# This should be done using JavaScript
15% my ($show_sigle, $flip) = ('', stash('flip') // 'flip');
Akronccede022017-05-02 12:54:51 +020016% if ($text_sigle ne (stash('last_sigle') // '')) {
Akron46b9f212017-05-01 13:55:17 +020017% $show_sigle = $text_sigle;
18% stash(last_sigle => $text_sigle);
19% $flip = $flip eq 'flip' ? 'flop' : 'flip';
20% stash(flip => $flip);
Akrondffa9392018-10-12 16:26:09 +020021% }
Akron46b9f212017-05-01 13:55:17 +020022 <div class="meta <%= $flip %>"><%= $show_sigle %></div>
Akron08b82d62016-12-05 15:06:05 +010023 <div class="match-main">
24 <div class="match-wrap">
Nils Diewaldfccfbcb2015-04-29 20:48:19 +000025%# --- Snippet
Akron08b82d62016-12-05 15:06:05 +010026 <div class="snippet<%= $match->{startMore} ? ' startMore' : '' %><%= $match->{endMore} ? ' endMore' : '' %>"><%== $match->{snippet} %></div>
27 </div>
Nils Diewald4af3f0b2014-06-25 01:43:17 +000028 </div>
Nils Diewald996aa552014-12-02 03:26:44 +000029%# -- Reference string
Nils Diewaldfccfbcb2015-04-29 20:48:19 +000030 <p class="ref">\
31<% if ($match->{title}) { %><strong><%= $match->{title} %></strong><% }; %>\
32<%= $match->{author} ? ' ' . loc('by') . ' ' . $match->{author} : '' %>\
Akron30ee5142015-06-26 01:50:14 +020033% if ($match->{pubDate}) {
34 (<time datetime="<%= $match->{pubDate} %>"><%= $match->{pubDate} %></time>)\
35% };
Akron0a6768f2016-07-13 18:00:43 +020036 <span class="sigle">[<%= $text_sigle %>]</span> \
Nils Diewald996aa552014-12-02 03:26:44 +000037</p>
Nils Diewald4af3f0b2014-06-25 01:43:17 +000038</li>