by
Warwick Hunt >> Fri, 6 Jul 2001 0:32:41 GMT
JavaDoc is a simple utility that generates a HTML help file from comments embedded in your code (which have to adhere to certain conventions). It simplifies generating code documention considerably since the documentation is maintained right with your code by the people that write/maintain it.
Has anyone done anything similar to this for Jade??? Ive seen delphi,C# and other implementations. Im slightly tempted to write one myself considering how well Jade makes its Metadata available.
Not really the same thing, but the following method creates an HTML file documenting a given class, including hyperlinks to superclass, subclasses, referenced classes and collection member classes. I run it for all subclasses of my foundation database class so that all the html files can reside in a single directory and I can browse from one class to another. Any comments?
<method follows>
buildHtml(pClass:Class; pDirectory:String);
vars
fileName : String;
htmlFile : File;
methodSet : MethodSet;
propertyColl : PropertyColl;
classProperty : Property;
propertyLength : Integer;
theMethod : Method;
type : Type;
classColl : ClassColl;
class : Class;begin
fileName := pDirectory & "\" & pClass.name & ".htm";
create htmlFile;
htmlFile.openOutput(fileName);
htmlFile.writeLine("<HTML><HEAD><TITLE>" & pClass.name & " Class</TITLE></HEAD>");
htmlFile.writeLine("<BODY><BASEFONT FACE=" & 34.Character & "Arial" & 34.Character & " SIZE=" & 34.Character & "2" & 34.Character & ">");
if pClass.immediateSuperClass = JASEntity then
htmlFile.writeLine("<H2><P ALIGN=" & 34.Character & "center" & 34.Character & "><STRONG>" & pClass.name & " Class</STRONG></H2></P>");
else
htmlFile.writeLine("<H2><P ALIGN=" & 34.Character & "center" & 34.Character & "><STRONG>" & pClass.name &
" Class (Subclass of <A HREF=" & pClass.immediateSuperClass.name & ".htm><B>" &
pClass.immediateSuperClass.name & ")</B></A></STRONG></H2></P>");
endif;
create methodSet transient;
htmlFile.writeLine(pClass.getText);
htmlFile.writeLine("<H2><STRONG>Attributes</STRONG></H2><BR>");
propertyColl := pClass.allProperties; // Find the attributes for this class
htmlFile.writeLine("<TABLE WIDTH=" & 34.Character & "100%" & 34.Character & ">");
htmlFile.writeLine("<TR><TD><STRONG>Attribute</STRONG></TD><TD><STRONG>Type< /STRONG></TD><TD><STRONG>Length</STRONG></TD></TR>");
foreach classProperty in propertyColl do
if classProperty.getName <> "_persistentImpRefs" and classProperty.getName <> "_transientImpRefs" then
htmlFile.writeLine("<TR>");
htmlFile.writeLine("<TD>" & classProperty.getName & "</TD>");
type:=classProperty.getType;
if type.isKindOf(PrimType) then
htmlFile.writeLine("<TD>" & type.getName & "</TD>");
elseif type.isKindOf(CollClass) then
if type.CollClass.memberType.isJasEntity then
htmlFile.writeLine("<TD>" & type.getName &
" (<A HREF=" & type.CollClass.memberType.getName &
".htm><B>" & type.CollClass.memberType.getName & "</B></A>)</TD>");
else
htmlFile.writeLine("<TD>" & type.getName & "</TD>");
endif;
elseif type.Class.isSubclassOf(JASEntity) then
htmlFile.writeLine("<TD><A HREF=" & type.getName & ".htm><B>" & type.getName & "</B></A></TD>");
else
htmlFile.writeLine("<TD>" & type.getName & "</TD>");
endif;
propertyLength := classProperty.getLength;
if classProperty.getType.getName = "String" then
if propertyLength = -1 then
htmlFile.writeLine("<TD>Maximum</TD>");
else
htmlFile.writeLine("<TD>" & (propertyLength - 1).String & "</TD>");
endif;
else
htmlFile.writeLine("<TD></TD>");//("<TD>" & propertyLength.String & "</TD>");
endif;
htmlFile.writeLine("</TR>");
endif;
endforeach;
htmlFile.writeLine("</TABLE><BR>");
if pClass.hasSubclasses then
htmlFile.writeLine("<H2><STRONG>SubClasses</STRONG></H2><BR>");
create classColl transient;
pClass.allSubclasses(classColl);
foreach class in classColl do
htmlFile.writeLine("<A HREF=" & class.getName & ".htm><B>" & class.getName & "</B></A><BR>");
endforeach;
endif;
htmlFile.writeLine("<H2><STRONG>Methods</STRONG></H2><BR>");
pClass.allMethods(methodSet); // Find the methods for this class.
foreach theMethod in methodSet do
htmlFile.writeLine("<STRONG>" & theMethod.getName & "</STRONG><BR><TT>"); htmlFile.writeLine(theMethod.makeHeader & ";</TT><BR><BR>");
endforeach;
htmlFile.writeLine("</BODY></HTML>");
epilog
htmlFile.close();
delete htmlFile;
delete methodSet;
delete classColl;
end;