Fixed text sigle legacy support
Change-Id: I227b855b80bf1bc7d9c59e1d2347adfed622774b
diff --git a/Changes b/Changes
index 21117e6..2aba707 100755
--- a/Changes
+++ b/Changes
@@ -1,9 +1,10 @@
-0.22 2017-06-01
+0.22 2017-06-26
- Added user authentification using Kustvakts LDAP
connection.
- Added X-Forwarded-For.
- Introduced proxy_prefix as a configuration option.
- Added support for more rewrite options in js.
+ - Fixed legacy sigle parsing.
0.21 2017-02-01
- Use textSigle for API communication instead of
diff --git a/dev/demo/all.html b/dev/demo/all.html
index ba08738..369ec2c 100644
--- a/dev/demo/all.html
+++ b/dev/demo/all.html
@@ -225,6 +225,23 @@
</div>
<p class="ref"><strong>High Definition Television</strong> by ArtMechanic,TheK,Andreas -horn- Hornig; published on 2005-03-28 as HHH.06056 (WPD)</p>
</li>
+
+ <li data-match-id="p367-368"
+ data-text-sigle="Corola-journal/Journalistic/16438_a_17763"
+
+ data-available-info="dereko/s=spans drukola/l=tokens drukola/m=tokens drukola/p=tokens"
+ data-info="{"UID":0,"author":"Irina Coroiu","availability":"QAO-NC","corpusID":null,"corpusSigle":"Corola-journal","docID":null,"docSigle":"Corola-journal\/Journalistic","layerInfos":"dereko\/s=spans drukola\/l=tokens drukola\/m=tokens drukola\/p=tokens","license":"QAO-NC","matchID":"p367-368","pubDate":"2001","textClass":"Film","textID":null,"textSigle":"Corola-journal\/Journalistic\/16438_a_17763","title":"DRACULA revine!"}"
+ id="Corola-journal/Journalistic/16438_a_17763#p367-368">
+ <div class="meta flop">Corola-journal/Journalistic/16438_a_17763</div>
+ <div class="match-main">
+ <div class="match-wrap">
+ <div class="snippet startMore endMore"><span class="context-left"><span class="more"></span>ntrînd în joc, Richard Corliss spunea:"Acest film savuros redă personajului noblețea pentru a-l lăsa să se odihnească în pace". La sfîrșit de veac, în octombrie 2000, la final de psihoză milenaristă, Compania Kushner-Locke oferă această nouă versiune.Scenariul lui Tom </span><span class="match"><mark>Baum</mark></span><span class="context-right"> pretinde a fi cît mai aproape de realitate;regizorul Joe Chappelle a ambiționat o ultramodernă înfățișare a "Patimilor lui Țepeș" o suită de flash-back-uri iscate tot de un interogatoriu la care este supus eroul de către un sinod de preoți ortodocși<span class="more"></span></span></div>
+ </div>
+ </div>
+ <p class="ref"><strong>DRACULA revine!</strong> von Irina Coroiu (<time datetime="2001">2001</time>) <span class="sigle">[Corola-journal/Journalistic/16438_a_17763]</span> </p>
+ </li>
+
+
</div>
<div id="menu"></div>
diff --git a/dev/demo/alldemo.js b/dev/demo/alldemo.js
index 28d683b..427dbdb 100644
--- a/dev/demo/alldemo.js
+++ b/dev/demo/alldemo.js
@@ -542,6 +542,9 @@
// Parse and show the table
// Override getMatchInfo API call
KorAP.API.getMatchInfo = function(match, callObj, cb) {
+
+ console.log(match);
+
if (callObj["spans"] !== undefined && callObj["spans"] === true) {
cb({ "snippet": treeSnippet2 });
}
diff --git a/dev/demo/match.html b/dev/demo/match.html
index e00e1d2..b863975 100644
--- a/dev/demo/match.html
+++ b/dev/demo/match.html
@@ -45,6 +45,7 @@
<div class="snippet startMore endMore"><span class="context-left"><span class="more"></span>in Wolken halb versteckt, an die sich in Nordwest die vicentinischen anschließen, endlich gegen Westen die näheren Gebirge von Este, deren Gestalten und Vertiefungen man deutlich sehen kann. gegen Südost ein grünes Pflanzenmeer, ohne eine Spur von Erhöhung, Baum an </span><span class="match"><mark>Baum</mark></span><span class="context-right">, Busch an Busch, Pflanzung an Pflanzung, unzählige weiße Häuser, Villen und Kirchen aus dem Grünen hervorblickend. am Horizont sah ich ganz deutlich den Markusturm zu Venedig und andere geringere Türme. endlich habe ich die Werke des Palladio erlangt, zwar nicht<span class="more"></span></span></div>
</div>
<p class="ref"><strong>Italienische Reise</strong> von Goethe, Johann Wolfgang von (<time datetime="1982">1982</time>) <span class="sigle">[GOE/AGI/00000]</span> </p>
+ </li>
</ol>
</div>
</body>
diff --git a/dev/js/src/api.js b/dev/js/src/api.js
index 5b30870..2767015 100644
--- a/dev/js/src/api.js
+++ b/dev/js/src/api.js
@@ -24,7 +24,7 @@
url += '/' + match.textID;
*/
- var legacySigle = new RegExp('^([^_]+)_([^\.]+)\.(.+?)$');
+ var legacySigle = new RegExp('^([^_]+)_([^\\.]+)\\.(.+?)$');
// This is for legacy support
var legacy = legacySigle.exec(match.textSigle);
diff --git a/lib/Kalamar.pm b/lib/Kalamar.pm
index 2511e68..eea8bfe 100644
--- a/lib/Kalamar.pm
+++ b/lib/Kalamar.pm
@@ -7,7 +7,7 @@
use File::Temp qw/tmpnam/;
# Minor version - may be patched from package.json
-our $VERSION = '0.21';
+our $VERSION = '0.22';
# TODO: Use CSRF!!!
# TODO: The FAQ-Page has a contact form for new questions
diff --git a/lib/Kalamar/API.pm b/lib/Kalamar/API.pm
index 2a8806c..51273f8 100644
--- a/lib/Kalamar/API.pm
+++ b/lib/Kalamar/API.pm
@@ -1,6 +1,7 @@
package Kalamar::API;
use Mojo::Base 'Mojolicious::Plugin';
use Scalar::Util qw/blessed weaken/;
+use Mojo::JSON qw/true false/;
use strict;
use warnings;
@@ -542,8 +543,12 @@
# Cleanup single match
sub _map_match {
my $x = shift or return;
- $x->{matchID} =~ s/^match\-(?:[^!]+!|[^_]+_)[^\.]+?\.[^-]+?-// or
- $x->{matchID} =~ s!^match\-(?:[^\/]+\/){2}[^-]+?-!!;
+
+ # legacy match id
+ if ($x->{matchID}) {
+ $x->{matchID} =~ s/^match\-(?:[^!]+!|[^_]+_)[^\.]+?\.[^-]+?-// or
+ $x->{matchID} =~ s!^match\-(?:[^\/]+\/){2}[^-]+?-!!;
+ };
(
$x->{corpusID},
diff --git a/package.json b/package.json
index af67d99..117edb7 100755
--- a/package.json
+++ b/package.json
@@ -2,7 +2,7 @@
"name": "Kalamar",
"description": "Mojolicious-based Frontend for KorAP",
"license" : "BSD-2-Clause",
- "version": "0.21.3",
+ "version": "0.22.1",
"repository" : {
"type": "git",
"url": "https://github.com/KorAP/Kalamar.git"