Issue 81683 - <listing>'s in autodoc should allow more convenient whitespacing
Summary: <listing>'s in autodoc should allow more convenient whitespacing
Status: CONFIRMED
Alias: None
Product: Build Tools
Classification: Code
Component: autodoc (show other issues)
Version: OOo 2.3
Hardware: All All
: P3 Trivial (vote)
Target Milestone: ---
Assignee: AOO issues mailing list
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-09-18 10:32 UTC by Frank Schönheit
Modified: 2013-02-07 22:02 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Frank Schönheit 2007-09-18 10:32:38 UTC
If you currently use the <listing> element in IDL documentation, it is quite
inconvenient to enter whitespaces:

The canonical approach, used by most IDL doc writers, is
<listing>
for ( int i=0; i<n; ++i)
{
  if ( foo(i) )
    bar(i);
}
</listing>
However, unfortunately all those whitespaces at the beginning of the line are
eaten by autodoc, so the resulting html becomes clumsy. As an example, look at
http://api.openoffice.org/docs/common/ref/com/sun/star/resource/XResourceBundle.html:
the author of the "MyResource" class invested some effort to properly indent the
class definition, but the result just looks terrible due to missing whitespaces.

The proper solution is something like
<listing>
for ( int i=0; i<n; ++i)
{
&nbsp;if ( foo(i) )
&nbsp;&nbsp;bar(i);
}
</listing>
, which is a) difficult to read an maintain in the IDL source b) easy to forget
and c) inconsistent with what people are used from code documentation tools: If
I enter a code fragment in my documentation, denoting this by a special tag
(like "<code>" or "<listing>"), then I expect the tool to use this fragment
as-is, without touching it in any way. Consequently, code fragments, in other
tools, are usually enclosed in a <pre></pre> pair, which preserves the layout of
the documentation writer.

autodoc should do so, too. <listing> is intended for multi-line code fragments
(so I understand it, though
http://api.openoffice.org/docs/DevelopersGuide/Appendix/IDLDocumentationGuide/IDLDocumentationGuide.xhtml
is not very explicit here), and those should be enclosed in a <pre> tag.

Note that this change can be done with touching only a few IDL files - most
files which currently use <listing> do *not* use the &nbsp; tags at all.
Comment 1 nikolai.pretzell 2007-10-16 13:54:22 UTC
<listing> should result in <pre>. If not, that's a bug.