From e7bc490bca3a742537156029b801ef4bc67b299b Mon Sep 17 00:00:00 2001 From: Massimiliano Assante Date: Mon, 6 Oct 2014 20:34:38 +0000 Subject: [PATCH] fixed superposed textarea to include suggestions for hashtags was buggy when #test and test were both present git-svn-id: https://svn.research-infrastructures.eu/d4science/gcube/trunk/portlets/user/share-updates@100472 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../user/shareupdates/server/ShareUpdateServiceImpl.java | 1 - .../user/shareupdates/server/TextTransfromUtils.java | 6 ++++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/gcube/portlets/user/shareupdates/server/ShareUpdateServiceImpl.java b/src/main/java/org/gcube/portlets/user/shareupdates/server/ShareUpdateServiceImpl.java index d786fa1..4ac1211 100644 --- a/src/main/java/org/gcube/portlets/user/shareupdates/server/ShareUpdateServiceImpl.java +++ b/src/main/java/org/gcube/portlets/user/shareupdates/server/ShareUpdateServiceImpl.java @@ -603,7 +603,6 @@ public class ShareUpdateServiceImpl extends RemoteServiceServlet implements Shar for (HashTagAndOccurrence wrapper : toSort) { String hashtag = wrapper.getHashtag(); toReturn.add(new ItemBean(hashtag, hashtag, hashtag, null)); - _log.trace(hashtag); } return toReturn; } diff --git a/src/main/java/org/gcube/portlets/user/shareupdates/server/TextTransfromUtils.java b/src/main/java/org/gcube/portlets/user/shareupdates/server/TextTransfromUtils.java index 97a367d..196e82d 100644 --- a/src/main/java/org/gcube/portlets/user/shareupdates/server/TextTransfromUtils.java +++ b/src/main/java/org/gcube/portlets/user/shareupdates/server/TextTransfromUtils.java @@ -96,11 +96,13 @@ public class TextTransfromUtils { String taggedHTML = ""+hashtag+""; - + //TODO: does not work if the word is no preceeded by # //dirty trick: double replace because \\boundaries do not accept # char - final String placeholder = "TO_REPLACE_4321234"; + final String placeholder = "ñöñö-ñöñö"; String first = escapedFeedText.replaceAll("(?i)\\b"+hashtag.substring(1)+"\\b", placeholder); escapedFeedText = first.replaceAll("#"+placeholder, taggedHTML); + //this is needed if there is a word equal to an hashtagged one without '#' e.g. #job and job + escapedFeedText = escapedFeedText.replaceAll(placeholder, hashtag.substring(1)); } return escapedFeedText; }