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

MarkupBuilder indentation fails when combining yield statements and empty tags

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.5.6
    • 1.5.7, 1.6-beta-2
    • groovy-jdk
    • None
    • Windows Vista x64

    Description

      MarkupBuilder seems to become confused if yield / yieldUnescaped calls and empty element are mixed within a single tag. All lines from that tag up to the end are 1 step less idented than they should be.
      Example Groovlet:

      def html = new groovy.xml.MarkupBuilder()
      html.html {
      	head {
      		title ("test")
      	}
      	body {
      		p {
      			yield "Some Text"
      			br()
      			yield "Another Text"
      		}
      	}
      }
      

      The output. You can see that there should be more whitespace before </p> and </body>.

      <html>
        <head>
          <title>test</title>
        </head>
        <body>
          <p>Some Text<br />Another Text
        </p>
      </body>
      </html>
      

      Attachments

        Activity

          People

            paulk Paul King
            illuvatar S. Ecret
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: