Bug 164259 - XML in javadoc <pre/> tags keep indenting line
Summary: XML in javadoc <pre/> tags keep indenting line
Status: VERIFIED DUPLICATE of bug 99738
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.2.2   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-11-12 09:27 EST by Ben Rowlands CLA
Modified: 2007-02-06 02:38 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ben Rowlands CLA 2006-11-12 09:27:23 EST
If I want to add a literal XML snippet to a javadoc comment I can place the XML inside a <pre> tag. Eclipse escapes the '<' and' '>' correctly but insists on indenting the XML to the right each time I reformat the source code. 

For example, if I type:

/**
 *  <pre>
 *    <foo/>
 *  </pre>
 */

After formatting it becomes:

/**
 * <pre>
 *  &lt;foo/&gt;
 * </pre>
 */

However subsequent re-formatting of the source file indents the XML to the each time. So after 3 reformattings, the javadoc becomes:

/**
 * <pre>
 *     &lt;foo/&gt;
 * </pre>
 */

This is very anoying as the spaces are *inside* the pre tag so show up in the generated javadocs. Additionally if the build processes includes a step to clean the source code using the formatter each build intends the line!

Note, my source formatter preferences have the following options enabled:

  * Format HTML tags
  * Format Java code snippets

Can the javadoc formatter be made smart enough not to indent the text if it is XML?

Note, if I disable the option "Format Java code snippet" the line is *not* indented (but neither is it escaped; and I really want to have Java code snippets formatted in addition to the ability to add XML examples, for example to show configuration examples or example XML output).
Comment 1 Olivier Thomann CLA 2006-11-12 14:18:09 EST

*** This bug has been marked as a duplicate of 99738 ***
Comment 2 Maxime Daniel CLA 2007-01-16 00:17:36 EST
Verified for 3.2.2 using build M20070112-1200.
Comment 3 Eric Jodet CLA 2007-02-06 02:38:15 EST
Verified for 3.3 M5 using build I20070205-0009