Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-5027

Groovydoc calculateFirstSentence doesn't recognise html tags as breaks

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Trivial
    • Resolution: Fixed
    • 1.8.2, 1.9-beta-3
    • 1.8.3, 1.9-beta-4
    • GroovyDoc
    • None
    • Patch

    Description

      The Method summary block of the groovydoc pages contains a sentence describing the method.

      However, if the javadoc looks like (taken from StreamingJsonBuilder.groovy):

          /**
           * Varargs elements as arguments to the JSON builder create a root JSON array
           * <p>
           * Example:
           * <pre class="groovyTestCase">
           * new StringWriter().with { w ->
           *   def json = new groovy.json.StreamingJsonBuilder( w )
           *   def result = json 1, 2, 3
           *
           *   assert result instanceof List
           *   assert w.toString() == "[1,2,3]"
           * }
           * </pre>
           * @param args an array of values
           * @return a list of values
           */
      

      Then the summary text becomes:

      Varargs elements as arguments to the JSON builder create a root JSON array
      
      Example:
      
       new StringWriter().with { w ->
         def json = new groovy.json.StreamingJsonBuilder( w )
         def result = json 1, 2, 3
      

      In this case, it is only confusing (as the assert is missed off the end, but in other cases, it could result in invalid code being shown in the summary.

      The attached patch adds another replaceAll to the calculateFirstSentence method of SimpleGroovyDoc.java which trims the javadoc as soon as an HTML tag is encountered as the first thing on a new line in the javadoc.

      The summary text for this same method then becomes simply:

      Varargs elements as arguments to the JSON builder create a root JSON array
      

      Attachments

        1. groovydoc.patch
          1.0 kB
          Tim Yates

        Activity

          People

            guillaume Guillaume Sauthier
            tim_yates Tim Yates
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: