Akron | 30ee514 | 2015-06-26 01:50:14 +0200 | [diff] [blame] | 1 | % 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/}; |
Akron | 0a6768f | 2016-07-13 18:00:43 +0200 | [diff] [blame] | 5 | % my $text_sigle = $match->{textSigle} // join('/', $match->{corpusID}, $match->{docID}, $match->{textID}); |
| 6 | % my $id = $text_sigle . '#' . $match->{matchID}; |
Akron | dffa939 | 2018-10-12 16:26:09 +0200 | [diff] [blame] | 7 | % # 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'; |
Akron | 0a6768f | 2016-07-13 18:00:43 +0200 | [diff] [blame] | 9 | <li data-match-id="<%= $match->{matchID} %>" |
| 10 | data-text-sigle="<%= $text_sigle %>" |
Akron | dffa939 | 2018-10-12 16:26:09 +0200 | [diff] [blame] | 11 | data-available-info="<%= $layer_infos %>" |
Akron | 30ee514 | 2015-06-26 01:50:14 +0200 | [diff] [blame] | 12 | data-info="<%== b(encode_json(\%match_data))->decode->xml_escape %>" |
Akron | dffa939 | 2018-10-12 16:26:09 +0200 | [diff] [blame] | 13 | id="<%= $id %>"<% if (current_route eq 'match') { %> class="active"<% } =%>> |
Akron | 46b9f21 | 2017-05-01 13:55:17 +0200 | [diff] [blame] | 14 | %# This should be done using JavaScript |
| 15 | % my ($show_sigle, $flip) = ('', stash('flip') // 'flip'); |
Akron | ccede02 | 2017-05-02 12:54:51 +0200 | [diff] [blame] | 16 | % if ($text_sigle ne (stash('last_sigle') // '')) { |
Akron | 46b9f21 | 2017-05-01 13:55:17 +0200 | [diff] [blame] | 17 | % $show_sigle = $text_sigle; |
| 18 | % stash(last_sigle => $text_sigle); |
| 19 | % $flip = $flip eq 'flip' ? 'flop' : 'flip'; |
| 20 | % stash(flip => $flip); |
Akron | dffa939 | 2018-10-12 16:26:09 +0200 | [diff] [blame] | 21 | % } |
Akron | 46b9f21 | 2017-05-01 13:55:17 +0200 | [diff] [blame] | 22 | <div class="meta <%= $flip %>"><%= $show_sigle %></div> |
Akron | 08b82d6 | 2016-12-05 15:06:05 +0100 | [diff] [blame] | 23 | <div class="match-main"> |
| 24 | <div class="match-wrap"> |
Nils Diewald | fccfbcb | 2015-04-29 20:48:19 +0000 | [diff] [blame] | 25 | %# --- Snippet |
Akron | 08b82d6 | 2016-12-05 15:06:05 +0100 | [diff] [blame] | 26 | <div class="snippet<%= $match->{startMore} ? ' startMore' : '' %><%= $match->{endMore} ? ' endMore' : '' %>"><%== $match->{snippet} %></div> |
| 27 | </div> |
Nils Diewald | 4af3f0b | 2014-06-25 01:43:17 +0000 | [diff] [blame] | 28 | </div> |
Nils Diewald | 996aa55 | 2014-12-02 03:26:44 +0000 | [diff] [blame] | 29 | %# -- Reference string |
Nils Diewald | fccfbcb | 2015-04-29 20:48:19 +0000 | [diff] [blame] | 30 | <p class="ref">\ |
| 31 | <% if ($match->{title}) { %><strong><%= $match->{title} %></strong><% }; %>\ |
| 32 | <%= $match->{author} ? ' ' . loc('by') . ' ' . $match->{author} : '' %>\ |
Akron | 22b008a | 2024-06-26 17:06:05 +0200 | [diff] [blame^] | 33 | % if ($match->{pubDate} || ($match->{pages} && ref $match->{pages} eq 'ARRAY')) { |
| 34 | (\ |
| 35 | % if ($match->{pubDate}) { |
| 36 | <time datetime="<%= $match->{pubDate} %>"><%= $match->{pubDate} %></time>\ |
| 37 | % }; |
| 38 | % if ($match->{pages}) { |
| 39 | % if ($match->{pubDate}) { |
| 40 | , \ |
| 41 | % }; |
| 42 | % if (@{$match->{pages}} == 1) { |
| 43 | <span class="pages"><%=loc 'page_sg' %> <%= $match->{pages}->[0] %></span>\ |
| 44 | % } else { |
| 45 | <span class="pages"><%=loc 'page_pl' %> <%= $match->{pages}->[0] %>–<%= $match->{pages}->[-1] %></span>\ |
| 46 | % }; |
| 47 | % }; |
| 48 | ) \ |
Akron | 30ee514 | 2015-06-26 01:50:14 +0200 | [diff] [blame] | 49 | % }; |
Akron | 22b008a | 2024-06-26 17:06:05 +0200 | [diff] [blame^] | 50 | <span class="sigle">[<%= $text_sigle %>]</span> \ |
Nils Diewald | 996aa55 | 2014-12-02 03:26:44 +0000 | [diff] [blame] | 51 | </p> |
Nils Diewald | 4af3f0b | 2014-06-25 01:43:17 +0000 | [diff] [blame] | 52 | </li> |