diff options
author | Andreas Baumann <mail@andreasbaumann.cc> | 2017-03-11 18:22:09 +0100 |
---|---|---|
committer | Andreas Baumann <mail@andreasbaumann.cc> | 2017-03-11 18:22:09 +0100 |
commit | 18fa332b56e81c6a98601dfa418941e1408b403a (patch) | |
tree | ebdea0bd158de4735f1851a91c4697835f249577 /themes | |
parent | 5f51bd8bca61a5ad77d5680e8be9a2d96db9de91 (diff) | |
download | www-andreasbaumann-cc-18fa332b56e81c6a98601dfa418941e1408b403a.tar.gz www-andreasbaumann-cc-18fa332b56e81c6a98601dfa418941e1408b403a.tar.bz2 |
playing with sentences (dont work) and better ranklist abstracts
Diffstat (limited to 'themes')
-rw-r--r-- | themes/new_theme/layouts/partials/ranklist.html | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/themes/new_theme/layouts/partials/ranklist.html b/themes/new_theme/layouts/partials/ranklist.html index 9ed4877..47982d7 100644 --- a/themes/new_theme/layouts/partials/ranklist.html +++ b/themes/new_theme/layouts/partials/ranklist.html @@ -94,15 +94,17 @@ } else if( attribute.key == 'docid' ) { docid = attribute.value; } else if( attribute.key == 'text' ) { - abstract += ' ' + attribute.value; + abstract += ' ' + escapeHtml( attribute.value ); } } if( title == '' ) { title = title_attribute; } + title = title.replaceAll( /#SMARK#/, "<i>" ).replaceAll( /#EMARK#/, "</i>" ); html += "<div class='title'>" html += "<a href=\"" + docid + "\">" + title + "</a></div>"; if( abstract != '' ) { + abstract = abstract.replaceAll( /#SMARK#/, "<b>" ).replaceAll( /#EMARK#/, "</b>" ); html += "<div class='abstract'>" + abstract + "</div>"; } html += "</li>"; @@ -111,11 +113,20 @@ return html; } + String.prototype.replaceAll = function(search, replacement) { + var target = this; + return target.replace(new RegExp(search, 'g'), replacement); + }; + + function escapeHtml( text ) { + return text.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">" ); + } + function executeQuery( query ) { var request = { query: { first_rank: 0, - nof_ranks: 10, + nof_ranks: 100, features: get_features( query ), select: [ "sel" @@ -189,7 +200,7 @@ }, { key: "mark", - value: "<font color='black'>%1%</font>" + value: "#SMARK#%1%#EMARK#" } ], resultnames: [ @@ -219,13 +230,21 @@ key: "add_dots", value: 1 }, + //~ { + //~ key: "sentence", + //~ value: "sentence" + //~ }, + //~ { + //~ key: "nof_sentences", + //~ value: 3 + //~ }, { key: "start_first_match", - value: 0 + value: 1 }, { key: "mark", - value: "<b>%1%</b>" + value: "#SMARK#%1%#EMARK#" } ], resultnames: [ @@ -259,6 +278,7 @@ } else { msg = t; } + msg = escapeHtml( msg ); html = "<pre><font color='red'>There was an error communicating to the strusWebService, reason: " + msg + "</font></pre>\n"; $( '#ranklist' ).html( html ); |