From 17dff9818da4c860dac804c20d79868ce01b4d0b Mon Sep 17 00:00:00 2001 From: john Date: Thu, 18 Apr 2002 08:58:57 +0000 Subject: [PATCH] added another "virtual member" to content entities, this one does some easy string manipulation to return content.description_sentence, the first sentence of the description with all html tags stripped. used for RSS right now. works analogously to content.description_parsed --- source/mircoders/entity/EntityContent.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/source/mircoders/entity/EntityContent.java b/source/mircoders/entity/EntityContent.java index eedd1f90..2033fb60 100755 --- a/source/mircoders/entity/EntityContent.java +++ b/source/mircoders/entity/EntityContent.java @@ -152,6 +152,8 @@ public class EntityContent extends Entity } else if (field.equals("description_parsed")) returnField = getDescriptionParsed(); + else if (field.equals("description_sentence")) + returnField = getDescriptionSentence(); else if (field.equals("content_data_parsed")) returnField = getContentDataParsed(); else @@ -279,6 +281,17 @@ public class EntityContent extends Entity return returnField; } + private String getDescriptionSentence() { + String returnField = getValue("description"); + if (returnField != null && returnField.length()>0) { + returnField = StringUtil.removeHTMLTags(returnField); + int endOfFirstSentence=StringUtil.findEndOfSentence(returnField,0); + if (endOfFirstSentence > 0){ + returnField = returnField.substring(0,endOfFirstSentence); + } + } + return returnField; + } private String getDescriptionParsed() { String returnField = getValue("description"); -- 2.11.0