Operating System: Windows XP
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
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
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
(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
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