Improve match demo
Change-Id: I252e63ed06c0b47824a7d05ba36d377483926a32
diff --git a/dev/demo/matchdemo.js b/dev/demo/matchdemo.js
index 7bffc50..8f99e6c 100644
--- a/dev/demo/matchdemo.js
+++ b/dev/demo/matchdemo.js
@@ -108,12 +108,66 @@
"</span>" +
"<span class=\"context-right\"></span>";
+
+ var relSnippet =
+ "<span class=\"context-left\"></span>"+
+ "<span class=\"match\">"+
+ " <span xml:id=\"token-WDD17/982/72848-p15836-15839\">"+
+ " <span xlink:title=\"lwc/d:NK\" xlink:show=\"none\" xlink:href=\"#token-WDD17/982/72848-p15838\">Ein</span>"+
+ " "+
+ " <span xlink:title=\"lwc/d:NK\" xlink:show=\"none\" xlink:href=\"#token-WDD17/982/72848-p15838\">letztes</span>"+
+ " "+
+ " <span xml:id=\"token-WDD17/982/72848-p15838\">"+
+ // s1464_n2 "ein" -> ":"
+ " <span xlink:title=\"lwc/d:--\" xlink:show=\"none\" xlink:href=\"#token-WDD17/982/72848-p15836-15839\">mal</span>"+
+ " </span>"+
+ ": "+
+ " <span xml:id=\"token-WDD17/982/72848-p15839-15840\">"+
+ " <span xlink:title=\"lwc/d:--\" xlink:show=\"none\" xlink:href=\"#token-WDD17/982/72848-p15839-15840\">AL</span>"+
+ " </span>"+
+ " </span>"+
+ " <span xlink:show=\"other\" data-action=\"join\" xlink:href=\"#token-WDD17/982/72848-p15839-15840\">"+
+ ":"+
+ " <span xml:id=\"token-WDD17/982/72848-p15840-15846\">"+
+ " <span xml:id=\"token-WDD17/982/72848-p15840\">"+
+ " <span xlink:title=\"lwc/d:--\" xlink:show=\"none\" xlink:href=\"#token-WDD17/982/72848-p15840-15846\">halt</span>"+
+ " </span>"+
+ " </span>"+
+ " </span>"+
+ " <span xlink:show=\"other\" data-action=\"join\" xlink:href=\"#token-WDD17/982/72848-p15840-15846\">"+
+ " "+
+ " <span xlink:title=\"lwc/d:NK\" xlink:show=\"none\" xlink:href=\"#token-WDD17/982/72848-p15842\">den</span>"+
+ " "+
+ " <span xml:id=\"token-WDD17/982/72848-p15842\">"+
+ " <span xlink:title=\"lwc/d:OA\" xlink:show=\"none\" xlink:href=\"#token-WDD17/982/72848-p15843\">Ball</span>"+
+ " </span>"+
+ " "+
+ " <span xml:id=\"token-WDD17/982/72848-p15843\">"+
+ " <span xlink:title=\"lwc/d:PD\" xlink:show=\"none\" xlink:href=\"#token-WDD17/982/72848-p15840\">flach</span>"+
+ " </span>"+
+ ", "+
+ " <mark>"+
+ " <span xlink:title=\"lwc/d:MO\" xlink:show=\"none\" xlink:href=\"#token-WDD17/982/72848-p15845\">ganz</span>"+
+ " "+
+ " <span xml:id=\"token-WDD17/982/72848-p15845\">"+
+ " <span xlink:title=\"lwc/d:CJ\" xlink:show=\"none\" xlink:href=\"#token-WDD17/982/72848-p15843\">flach</span>"+
+ " </span>"+
+ " </mark>"+
+ " </span>"+
+ "</span>"+
+ "<span class=\"context-right\"></span>";
+
// var treeSnippet = "<span class=\"context-left\"><\/span><span class=\"match\">In diesem <span title=\"cnx\/c:np\">Sinne<\/span> schrieb <span title=\"cnx\/c:np\">Brunschwicg<\/span>:"In <span title=\"cnx\/c:np\">Euklids<\/span> <span title=\"cnx\/c:np\">Elementen<\/span> <span title=\"cnx\/c:np\">spiegel<\/span> sich die <span title=\"cnx\/c:np\">Resultate<\/span> der <span title=\"cnx\/c:np\">Arbeit von Generationen vor Aristoteles<\/span> wider, nicht nur die <span title=\"cnx\/c:np\">technische Arbeit<\/span> der <span title=\"cnx\/c:np\">Entdecklung<\/span>, sondern auch die <span title=\"cnx\/c:np\">methodologische Arbeit<\/span> der <span title=\"cnx\/c:np\">Verbindung<\/span> und des <span title=\"cnx\/c:np\">Beweises<\/span>, die, in der <span title=\"cnx\/c:np\">Schule<\/span> des <span title=\"cnx\/c:np\">Phythagoras<\/span> begonnen, ihre <span title=\"cnx\/c:np\">Vollendung in den Schulen von Eudoxos von Cnidus<\/span> und <span title=\"cnx\/c:np\">Platon<\/span> gefunden hat"(5<\/span><span class=\"context-right\"><\/span>";
KorAP.API.getMatchInfo = function(match, callObj, cb) {
console.dir(callObj);
if (callObj["spans"] !== undefined && callObj["spans"] === true) {
- return cb({ "snippet": treeSnippet });
+ if (callObj["layer"] === "d") {
+ return cb({ "snippet": relSnippet });
+ }
+ else {
+ return cb({ "snippet": treeSnippet });
+ }
}
else {
return cb({ "snippet": snippet });