From d7259419f397450b256bfedddea29408efc88f88 Mon Sep 17 00:00:00 2001 From: reger Date: Sat, 28 Feb 2015 19:02:18 +0100 Subject: [PATCH] postpone raw snippet html encoding upon use instead of during init of snippet adressing http://mantis.tokeek.de/view.php?id=551 --- .../net/yacy/search/snippet/TextSnippet.java | 31 ++++++++++--------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/source/net/yacy/search/snippet/TextSnippet.java b/source/net/yacy/search/snippet/TextSnippet.java index 163141a3e..fb19b266d 100644 --- a/source/net/yacy/search/snippet/TextSnippet.java +++ b/source/net/yacy/search/snippet/TextSnippet.java @@ -131,7 +131,7 @@ public class TextSnippet implements Comparable, Comparator, Comparator... tags are kept as is. + * Init a snippet line for urlhash * * @param urlhash hash of the url for this snippet * @param line text to use as snippet @@ -361,15 +359,7 @@ public class TextSnippet implements Comparable, Comparator... html tags in place - this.line = CharacterCoding.unicode2html(line, false).replaceAll("<b>(.+?)</b>", "$1"); - } else { // otherwise encode all text for html display - this.line = CharacterCoding.unicode2html(line, false); - } - } else { - this.line = line; - } + this.line = line; this.isMarked = isMarked; this.resultStatus = errorCode; this.error = errortext; @@ -437,9 +427,22 @@ public class TextSnippet implements Comparable, Comparator.. + * + * @param queryGoal + * @return html encoded snippet line + */ public String descriptionline(QueryGoal queryGoal) { if (descriptionline != null) return descriptionline; - descriptionline = this.isMarked() ? this.getLineRaw() : this.getLineMarked(queryGoal); + if (this.isMarked) { + // html encode source, keep .. + descriptionline = CharacterCoding.unicode2html(this.getLineRaw(), false).replaceAll("<b>(.+?)</b>", "$1"); + } else { + descriptionline = this.getLineMarked(queryGoal); + } return descriptionline; }