]> granicus.if.org Git - docbook-dsssl/commitdiff
Automatically limit the size of the search description to something 140 characters
authorKasun Gajasinghe <kasunbg@gmail.com>
Fri, 7 Oct 2011 09:48:44 +0000 (09:48 +0000)
committerKasun Gajasinghe <kasunbg@gmail.com>
Fri, 7 Oct 2011 09:48:44 +0000 (09:48 +0000)
xsl-webhelpindexer/src/com/nexwave/nquindexer/WriteJSFiles.java
xsl/webhelp/docsrc/readme.xml

index 859fe6b76bd2641ab2a983f6e00e25a4b5a75b4e..f0fd3eaa25c4ce4e5277f19086162cc52f1f48bb 100755 (executable)
@@ -128,10 +128,15 @@ public class WriteJSFiles {
                     tempShortdesc = tempShortdesc.replaceAll("\\\\", "\\\\\\\\");
                 }
                 if (tempShortdesc != null) {
-                    String stripNonAlphabeticalChars = stripNonAlphabeticalChars(tempShortdesc);
-                    //stripNonAlphabeticalChars = stripWords(stripNonAlphabeticalChars);
-                    stripNonAlphabeticalChars = stripNonAlphabeticalChars + "...";
-                    out.write("fil[\"" + i + "\"]" + "= \"" + tempPath + "@@@" + tempTitle + "@@@" + stripNonAlphabeticalChars + "\";\n");
+                    String strippedNonAlphaCharsShortDesc = stripNonAlphabeticalChars(tempShortdesc);
+                    //Limit the characters to 140
+                    if (strippedNonAlphaCharsShortDesc.length() > 140) { //why 140? Think Twitter ;-)
+                        strippedNonAlphaCharsShortDesc = strippedNonAlphaCharsShortDesc.substring(0,137);
+                            //another 3 letters "..." get added at next execution line
+                    }
+                    //strippedNonAlphaCharsShortDesc = stripWords(strippedNonAlphaCharsShortDesc);
+                    strippedNonAlphaCharsShortDesc = strippedNonAlphaCharsShortDesc + "...";
+                    out.write("fil[\"" + i + "\"]" + "= \"" + tempPath + "@@@" + tempTitle + "@@@" + strippedNonAlphaCharsShortDesc + "\";\n");
                     i++;
                 } else {
                     out.write("fil[\"" + i + "\"]" + "= \"" + tempPath + "@@@" + tempTitle + "@@@null" + "\";\n");
index b6a384b4e05c4e8e2d42df5ca3dcbf844c07af45..e79047611338d709786f9ad9290b0aa0a4ce3034 100644 (file)
               <para>Automatically use the first non-heading content as the summary in the search
                 results.</para>
             </listitem>
-            <listitem>
-              <para>Automatically limit the size of the search description to something 140
-                characters.</para>
-            </listitem>
           </itemizedlist>
         </listitem>
         <listitem>