jakarta-taglibs-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bay...@apache.org
Subject cvs commit: jakarta-taglibs/string/xml intro.xml string.xml
Date Thu, 20 Feb 2003 12:51:44 GMT
bayard      2003/02/20 04:51:44

  Modified:    string/examples/conf Tag: string-1-0-1 web.xml
               string/examples/web Tag: string-1-0-1 string.jsp
               string/src/org/apache/taglibs/string Tag: string-1-0-1
                        ReplaceTag.java StringTagSupport.java
               string/src/org/apache/taglibs/string/util Tag: string-1-0-1
                        Metaphone.java StringW.java
               string/xml Tag: string-1-0-1 intro.xml string.xml
  Log:
  Rolling string-1-0 into string-1-0-1 because I was lame with cvs earlier.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.2.4.1   +2 -2      jakarta-taglibs/string/examples/conf/web.xml
  
  Index: web.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-taglibs/string/examples/conf/web.xml,v
  retrieving revision 1.2
  retrieving revision 1.2.4.1
  diff -u -r1.2 -r1.2.4.1
  --- web.xml	13 Nov 2001 15:04:14 -0000	1.2
  +++ web.xml	20 Feb 2003 12:51:43 -0000	1.2.4.1
  @@ -17,8 +17,8 @@
       </welcome-file-list>
   
       <taglib>
  -        <taglib-uri>http://jakarta.apache.org/taglibs/string-1.0</taglib-uri>
  -        <taglib-location>/WEB-INF/string.tld</taglib-location>
  +        <taglib-uri>http://jakarta.apache.org/taglibs/string-1.0.1</taglib-uri>
  +        <taglib-location>/WEB-INF/taglibs-string.tld</taglib-location>
       </taglib>
   
   </web-app>
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.3.4.1   +2 -2      jakarta-taglibs/string/examples/web/string.jsp
  
  Index: string.jsp
  ===================================================================
  RCS file: /home/cvs/jakarta-taglibs/string/examples/web/string.jsp,v
  retrieving revision 1.3
  retrieving revision 1.3.4.1
  diff -u -r1.3 -r1.3.4.1
  --- string.jsp	15 Aug 2002 07:23:03 -0000	1.3
  +++ string.jsp	20 Feb 2003 12:51:43 -0000	1.3.4.1
  @@ -10,7 +10,7 @@
   <h1>
   Jakarta STRING Taglib Example</h1></center>
   <br>
  -<%@ taglib uri="http://jakarta.apache.org/taglibs/string-1.0" prefix="str" %>
  +<%@ taglib uri="http://jakarta.apache.org/taglibs/string-1.0.1" prefix="str" %>
   
   <table border="1">
   <tr><th>Tag</th><th>Input</th><th>Expected</th><th>Actual</th></tr></td>
  @@ -91,7 +91,7 @@
   <tr><td>randomString:a , i z and B</td><td>n/a</td><td>n/a</td><td>'<str:randomString
count="5">ai,zB</str:randomString>'</td></tr>
   <tr><td colspan="4">&nbsp;</td></tr>
   
  -<tr><td>truncateNicely</td><td>'Incy wincy spider climbed up the
spout'</td><td>'Incy wincy...'</td><td>'<str:truncateNicely lower="13"
upper="20">Incy wincy spider climbed up the spout</str:truncateNicely>'</td></tr>
  +<tr><td>truncateNicely</td><td>'Incy wincy spider climbed up the
spout'</td><td>'Incy wincy spider...'</td><td>'<str:truncateNicely
lower="13" upper="20">Incy wincy spider climbed up the spout</str:truncateNicely>'</td></tr>
   <tr><td colspan="4">&nbsp;</td></tr>
   <!-- test wordWrap -->
   
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.3.4.1   +75 -9     jakarta-taglibs/string/src/org/apache/taglibs/string/ReplaceTag.java
  
  Index: ReplaceTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-taglibs/string/src/org/apache/taglibs/string/ReplaceTag.java,v
  retrieving revision 1.3
  retrieving revision 1.3.4.1
  diff -u -r1.3 -r1.3.4.1
  --- ReplaceTag.java	28 Jul 2002 00:11:15 -0000	1.3
  +++ ReplaceTag.java	20 Feb 2003 12:51:43 -0000	1.3.4.1
  @@ -62,6 +62,7 @@
   
   import org.apache.commons.lang.StringUtils;
   import org.apache.commons.lang.NumberUtils;
  +import javax.servlet.jsp.JspException;
   
   /**
    * Replace a specified substring with another string.
  @@ -81,15 +82,28 @@
    *             Number of times to replace.
    *             Default is all matches.
    * </dd>
  + * <dt>newlineToken</dt><dd>
  + *             Token to use as a newline.
  + *             This gets around the pain of haivng a literal newline in the jsp.
  + *             By default this is ignored.
  + * </dd>
  + * <dt>carriageToken</dt><dd>
  + *             Token to use as a carriage return.
  + *             This gets around the pain of haivng a literal carriage return 
  + *             in the jsp. 
  + *             By default this is ignored.
  + * </dd>
    * </dl>
    * 
    * @author bayard@generationjava.com
    */
   public class ReplaceTag extends StringTagSupport {
   
  -    private int count;
  +    private String count;
       private String replace;
       private String with;
  +    private String newlineToken;
  +    private String carriageToken;
   
       public ReplaceTag() {
           super();
  @@ -113,6 +127,42 @@
           this.replace = replace;
       }
   
  +    /**
  +     * Get the newlineToken property
  +     *
  +     * @return String property
  +     */
  +    public String getNewlineToken() {
  +        return this.newlineToken;
  +    }
  +
  +    /**
  +     * Set the newlineToken property
  +     *
  +     * @param newlineToken String property
  +     */
  +    public void setNewlineToken(String newlineToken) {
  +        this.newlineToken = newlineToken;
  +    }
  +
  +    /**
  +     * Get the carriageToken property
  +     *
  +     * @return String property
  +     */
  +    public String getCarriageToken() {
  +        return this.carriageToken;
  +    }
  +
  +    /**
  +     * Set the carriageToken property
  +     *
  +     * @param carriageToken String property
  +     */
  +    public void setCarriageToken(String carriageToken) {
  +        this.carriageToken = carriageToken;
  +    }
  +
   
       /**
        * Get the with property
  @@ -139,7 +189,7 @@
        * @return String property
        */
       public String getCount() {
  -        return ""+this.count;
  +        return this.count;
       }
   
       /**
  @@ -148,13 +198,27 @@
        * @param count String property
        */
       public void setCount(String count) {
  -        this.count = NumberUtils.stringToInt(count);
  +        this.count = count;
       }
   
   
   
       public String changeString(String text) {
  -        return StringUtils.replace(text, replace, with, count);
  +        String repl = replace;
  +        String wit = with;
  +        if(this.carriageToken != null) {
  +            repl = StringUtils.replace(replace, this.carriageToken, "\r");
  +            wit = StringUtils.replace(with, this.carriageToken, "\r");
  +        }
  +        if(this.newlineToken != null) {
  +            repl = StringUtils.replace(replace, this.newlineToken, "\n");
  +            wit = StringUtils.replace(with, this.newlineToken, "\n");
  +        }
  +        int ct = -1;
  +        if(count != null) {
  +            ct = NumberUtils.stringToInt(count);
  +        }
  +        return StringUtils.replace(text, repl, wit, ct);
       }
   
       public void initAttributes() {
  @@ -163,9 +227,11 @@
   
           this.with = null;
   
  -        this.count = -1;
  +        this.count = null;
   
  -    }
  +        this.newlineToken = null;
  +        this.carriageToken = null;
   
  +    }
   
   }
  
  
  
  1.1.4.1   +3 -5      jakarta-taglibs/string/src/org/apache/taglibs/string/StringTagSupport.java
  
  Index: StringTagSupport.java
  ===================================================================
  RCS file: /home/cvs/jakarta-taglibs/string/src/org/apache/taglibs/string/StringTagSupport.java,v
  retrieving revision 1.1
  retrieving revision 1.1.4.1
  diff -u -r1.1 -r1.1.4.1
  --- StringTagSupport.java	21 Apr 2002 04:27:42 -0000	1.1
  +++ StringTagSupport.java	20 Feb 2003 12:51:43 -0000	1.1.4.1
  @@ -114,7 +114,6 @@
        * Handles the manipulation of the String tag,
        * evaluating the body of the tag. The evaluation 
        * is delegated to the changeString(String) method 
  -     * and then the initAttributes() method is called.
        */
       public int doEndTag() throws JspException {
   
  @@ -138,7 +137,6 @@
               JspWriter writer = pageContext.getOut();
               try {
                   writer.print(text);
  -                initAttributes();
               } catch (IOException e) {
                   throw new JspException(e.toString());
               }
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.4.1   +5 -7      jakarta-taglibs/string/src/org/apache/taglibs/string/util/Metaphone.java
  
  Index: Metaphone.java
  ===================================================================
  RCS file: /home/cvs/jakarta-taglibs/string/src/org/apache/taglibs/string/util/Metaphone.java,v
  retrieving revision 1.1
  retrieving revision 1.1.4.1
  diff -u -r1.1 -r1.1.4.1
  --- Metaphone.java	30 Aug 2001 12:38:11 -0000	1.1
  +++ Metaphone.java	20 Feb 2003 12:51:43 -0000	1.1.4.1
  @@ -67,11 +67,9 @@
    * reference: Computer Language of Dec. 1990, p 39
    *  "Hanging on the Metaphone" by Lawrence Philips
    *
  - * This Java implementation, Copyright 1997, William B. Brogden
  - * is hereby released for all uses. I would appreciate hearing about it
  - * if you find a good use for the class.  December, 1997
  + * This Java implementation, William B. Brogden. December, 1997
    *
  - * @author wbrogden@bga.com    CompuServe  75415,610
  + * @author wbrogden@bga.com 
    */
   
   /*
  
  
  
  1.14.4.1  +8 -6      jakarta-taglibs/string/src/org/apache/taglibs/string/util/StringW.java
  
  Index: StringW.java
  ===================================================================
  RCS file: /home/cvs/jakarta-taglibs/string/src/org/apache/taglibs/string/util/StringW.java,v
  retrieving revision 1.14
  retrieving revision 1.14.4.1
  diff -u -r1.14 -r1.14.4.1
  --- StringW.java	10 Sep 2002 00:39:40 -0000	1.14
  +++ StringW.java	20 Feb 2003 12:51:43 -0000	1.14.4.1
  @@ -178,9 +178,11 @@
   //                System.err.println("loop[i] is now: "+i);
   //                System.err.println("ounfd-whitespace: '"+substr.charAt(idx+1)+"'.");
                   // Erase a space after a delim. Is this too obscure?
  -                if(substr.charAt(idx+1) != '\n') {
  -                    if(Character.isWhitespace(substr.charAt(idx+1))) {
  -                        i++;
  +                if(substr.length() > idx+1) {
  +                    if(substr.charAt(idx+1) != '\n') {
  +                        if(Character.isWhitespace(substr.charAt(idx+1))) {
  +                            i++;
  +                        }
                       }
                   }
   //                System.err.println("i -= "+width+"-"+idx);
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.4.2.3.2.1 +5 -2      jakarta-taglibs/string/xml/intro.xml
  
  Index: intro.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-taglibs/string/xml/intro.xml,v
  retrieving revision 1.4.2.3
  retrieving revision 1.4.2.3.2.1
  diff -u -r1.4.2.3 -r1.4.2.3.2.1
  --- intro.xml	6 Feb 2003 01:54:41 -0000	1.4.2.3
  +++ intro.xml	20 Feb 2003 12:51:44 -0000	1.4.2.3.2.1
  @@ -21,7 +21,10 @@
   
     <section>
       <news>
  -      <newsitem date="10/08/2002">
  +      <newsitem date="2003/02/14">
  +        Version 1.0.1 Released
  +      </newsitem>
  +      <newsitem date="2002/10/08">
           Version 1.0 Released
         </newsitem>
       </news>
  @@ -48,7 +51,7 @@
     <p>A binary download of the String Tag Library is available</p>
     <ul>
     <li>
  -    Download the String Tag Library 1.0 Release from an
  +    Download the String Tag Library 1.0.1 Release from an
       <a href="http://jakarta.apache.org/site/binindex.cgi#Release%20Builds">
       Apache Jakarta Project Mirror</a>
     </li>
  
  
  
  1.22.2.1.2.1 +54 -4     jakarta-taglibs/string/xml/string.xml
  
  Index: string.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-taglibs/string/xml/string.xml,v
  retrieving revision 1.22.2.1
  retrieving revision 1.22.2.1.2.1
  diff -u -r1.22.2.1 -r1.22.2.1.2.1
  --- string.xml	11 Nov 2002 15:18:37 -0000	1.22.2.1
  +++ string.xml	20 Feb 2003 12:51:44 -0000	1.22.2.1.2.1
  @@ -22,14 +22,14 @@
        -->
   <taglib>
     <!-- The following elements are from the JSP 1.2 TLD DTD -->
  -  <!-- Version number of this tagib -->
  -  <tlib-version>1.0</tlib-version>
  +  <!-- Version number of this taglib -->
  +  <tlib-version>1.0.1</tlib-version>
     <!-- Minimum version of JSP spec required -->
     <jsp-version>1.1</jsp-version>
     <!-- jakarta-taglib name of this tag library -->
     <short-name>string</short-name>
     <!-- URI of taglib -->
  -  <uri>http://jakarta.apache.org/taglibs/string-1.0</uri>
  +  <uri>http://jakarta.apache.org/taglibs/string-1.0.1</uri>
     <!-- The name to use in titles, etc. for the taglib -->
     <display-name>String Tag library</display-name>
   
  @@ -1633,6 +1633,28 @@
             </description>
             <availability>1.0</availability>
           </attribute>
  +        <attribute>
  +          <name>newlineToken</name>
  +          <required>false</required>
  +          <rtexprvalue>true</rtexprvalue>
  +          <type>java.lang.String</type>
  +          <description>
  +              Token to use instead of a newline to get around JSP pain.
  +              Default is to ignore this functionality.
  +          </description>
  +          <availability>1.0.1</availability>
  +        </attribute>
  +        <attribute>
  +          <name>carriageToken</name>
  +          <required>false</required>
  +          <rtexprvalue>true</rtexprvalue>
  +          <type>java.lang.String</type>
  +          <description>
  +              Token to use instead of a carriage return to get around JSP pain.
  +              Default is to ignore this functionality.
  +          </description>
  +          <availability>1.0.1</availability>
  +        </attribute>
           <example>
             <usage>
               <comment>
  @@ -1648,6 +1670,14 @@
   Some more to test. And insert Br's into.
   Hopefully.</str:replace>
   ]]>       
  +_or_ with 1.0.1:
  +<![CDATA[ 
  +<str:replace replace="NL" with="&lt;br&gt;NL" newlineToken="NL">
  +A sentence.
  +Another sentence.
  +Some more to test. And insert Br's into.
  +Hopefully.</str:replace>
  +]]>       
               </code>
             </usage>
           </example>
  @@ -1960,12 +1990,32 @@
   
   </taglib>
   
  +<revision release="1.0.1" date="2003/02/20"> 
  +  <description>
  +    Bug-fixing release. Most notably, it does <b>not</b> have the EL functionality
that is available in the CVS HEAD.
  +  </description>
  +<section name="Bugfixes">
  +    <item> Made a fix to bug # 15321 that stops WordWrap falling over with an ArrayOutOfBoundsException
when a newline falls in a particular place.  </item>
  +
  +	<item> Added in a carriageToken to the str:replace tag. </item>
  +
  +	<item> Added in an attribute, newlineToken, to str:replace to allow newlines to
be handled nicely. </item>
  +
  +	<item> Removed copyright to William Brogden of Metaphone.java which I'd dimwittingly
left there. I have permission of the author in doing so.  </item>
  +
  +	<item> Removed the unnecessary initAttributes from inside the startTag method for
all tags. This was stopping String tags from working inside loops when the container decided
to cache the tag. </item>
  +
  +	<item> Fixed example string.jsp for truncateNicely as it has the wrong expected
value. </item>
  +
  +	<item> Implemented the switch to using "taglibs-" as a prefix for jar and tld files
for taglibs.</item>
  +</section>
  +</revision>
   <revision release="1.0" date="2002/10/07"> 
     <description>
       Initial release of the String Taglib, to give users a stable released version to work
against. 
     </description>
   <section name="New features added since initial release">
  -<item>Changed implementation of random() to use the same Randome instance 
  +<item>Changed implementation of random() to use the same Random instance 
   across calls. This stops the same value coming out if called in the same 
   millisecond.</item>
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-dev-help@jakarta.apache.org


Mime
View raw message