Uploaded image for project: 'Velocity'
  1. Velocity
  2. VELOCITY-348

Anakia generates mix of line endings on Windows platform

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.5
    • None
    • Anakia
    • None
    • Operating System: Windows XP
      Platform: PC
    • 33296

    Description

      The problem: Running "ant docs" with Anakia on Windows machines generates
      files with a mix of Unix (\n) and Windows (\r\n) line endings. This causes
      special problems uploading files to Subversion as svn chokes with inconsistent
      line endings.

      To duplicate: Download jakarta-site2 from svn. "site.vsl" required by
      Velocity task "ant docs" will have Windows line endings. Run "ant docs".
      Produced file will have mix of unix and Windows line endings. All text from
      site.vsl will have Windows line endings, while JDom produces Unix style line
      endings.

      What it should have: all line endings should match platform default. This is
      especially convenient for files accessed via subversion, which will
      automatically convert line endings when uploading/downloading files.

      Solution: The solution has three parts.

      (1) Upgrade the current jdom-b10-rc1.jar to the latest jdom 1.0 (jdom.jar).
      Jdom 1.0 has a method which allows the caller to set the line separator for
      displayed XML.

      (2) Modify AnakiaElement to set the default JDom line separator to the
      platform default. (part of attached patch). This causes all nodes output
      with toString to display with proper line feeds.

      (3) Modify Escape to substitute the default line separator for \n. (part of
      attached patch). This makes all text displayed with <source> to have correct
      line feeds. Specifically, site.vsl gets the content of the <source> tag and
      escapes it with: $escape.getText($value.getText()). This parallels the same
      method used by JDom to ensure the correct line feeds for output of
      XMLOutputter.

      Since Anakia is widely used with Jakarta for documentation, before applying
      this patch I'd like to ask if there is any feedback from the Velocity and
      Jakarta community.

      Attachments

        Activity

          People

            wglass@forio.com Will Glass-Husain
            wglass@forio.com Will Glass-Husain
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: