Easy/obvious place to insert filter class into the output stream?

Does the doclet mechanism have any obvious place to insert a filter class that has nothing to do with structural parsing -- ONLY the final generated HTML output? Obviously such a function could simply be run on the final output after it's generated, but I'd prefer to avoid requiring an extra step and enable it to simply be specified as an option at creation time.

My biggest complaint with javadoc is the fact that any attempt to perform simple formatting (say, strong/bold, emphasized/italic, and unordered lists) produces javadoc comments that fall somewhere between ugly and unreadable when viewed in the source itself. What I'd like to create is a more or less transparent way to transform less visually-offensive sequences of characters into proper HTML near the final stage of javadoc generation. For example...

/** Illustrates simple, yet readable formatting extensions.

* The proposed filter class would make it easy to imply

* ***strong/bold*** and italic/emphasized text in

* two different ways:

*

* === one or more characters (optionally including whitespace,

* but explicitly excluding newlines), preceded by ***three***

* asterisks (strong/bold) or hyphens (emphasized/italic) and

* a non-whitespace character, and ending with the same

* three characters (preceded by a non-whitespace).

*

* === [*** potentially multi-line sequences would be specified

* in a similar method ***], [ except the first 3-character

* sequence would be preceded by a "[", and the final 3-character

* sequence would be followed by a "]". ] Whitespace ***is***

* allowed between the opening and closing sequences and the text

* whose appearance they modify.

*

* The scheme also accommodates simple unordered lists -- once

* again, denoted by a three-character sequence. The basic rule is

* that a new unordered list begins with the first "===" preceded

* by nothing except a newline and javadoc whitespace. An element

* continues until a new element is begun in a similar fashion, or

* a line containing nothing but whitespace is encountered.

*

* === An unordered list's natural termination is a blank line, followed

* by at least one additional line that doesn't signify a list item.

*

* === Normally, that line would be a normal paragraph, but two unordered

* lists could exist with nothing in between by specifying two blank

* lines between them.

*

*

* === Like that. This would be a new unordered list.

*

* @param foo ***exactly three*** valid values: "one", "two", or "three". ("default value")

* @param bar another parameter (default value)

*/

[2854 byte] By [jskubick] at [2007-9-27 19:55:22]
# 1

Are you interseted in filtering only the description or

also the text in any of the tags?

Meanwhile, I'll ask our engineer if there is a good place

to do this. If not, we could consider adding it when we

refactor out the doclet toolkit -- see the right column

under "What's New":

http://java.sun.com/j2se/javadoc/

-Doug

dkramer at 2007-7-6 23:36:14 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...
# 2

There is no easy solution today. In Tiger (the next major release),

we are refactoring the doclet code to support "builders". When that

occurs, you could write a builder to do what you want...

-Doug Kramer

Jamie, our doclet programmer, replied:

A taglet would work but might look ugly. He would have to put

all text that needs to be filtered into an inline tag.

I suggest that he write a builder that parses the generated output

and converts it to the format that he wants. It would be a lot of

work for us to run all of our HTML through a given filter at

generation time.

This is not something that builders are meant to do, but it is

definitely possible to write a builder that is run last, to modify

output that was just generated.

dkramer at 2007-7-6 23:36:14 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...
# 3

We here at State Software, Inc. have been creating JavaDoc-style documentation from JavaScript source files. We produce a broad range of output file formats (TEX, PDF, HTML) from the source code.

Since JavaScript doesn't have a rigid syntax, we have created @ tags for everything interesting (file, class, object, function, method, etc.)

One of the things we decided to do differently from JavaDoc is that we don't assume that the output is only HTML. We don't imbed _any_ HTML formatting tags in the comment text at all. We use custom tags, and parse them seperately:

@( Begin monospace font

@) End monospace font

@{ Begin preformatted text

@} End preformatted text

@[ Begin table

@[[ Begin centered, narrow table

@| Next cell in table

@_ Next row in table

@] End table

@+ Indent

@++ Bullet list

@# Indent with item numbers

@! Bullet (after @++) or Item Number (after @#)

@- Outdent

@/ Begin/End italics

@* Begin/End bold

@@ Literal @

This leads to @#much@# more readable text. An imbedded variable reference looks like @(this@).

Tables look like this:

@[ Age @| Height @| Weight @_

35 @| 5'6'' @| 125# @_

22 @| 6'0'' @| 186# @]

@#

@! This is a numbered bullet list item

@! Second item

@++

@! Bulleted sub-item

@-

@-

We're likely to move our Java code to this format as well, so we can write simple "in a Nutshell"-like documentation directly to TEX (then to PDF) without having to write/manage an HTML parser in our doclet. This way we get HTML (online) and PDF (offline) documentation from one source file. :-)

F. Randall Farmer

State Software, Inc.

FRandallFarmer at 2007-7-6 23:36:14 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...