|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--LatexDoclet
This class is a doclet that generates Javadoc help as a LaTex file. LaTex is a macro package for Donald Knuth's excellent Tex type-setting package. It is available on virtually every platform. This doclet generates code that conforms to the LaTex 2e distribution. It requires one non-standard package, the fancyhdr package.
Javadoc documentation is frequently enhanced by adding html tagging to the comments. Obviously, this will not do anything useful in a LaTex file, so this package attempts to make a reasonable translation for most of the tags commonly found in Sun's documentation. Fortunately, it is fairly easy to map these tags into LaTex, but it is not always perfect.
This doclet adds the following command line options to javadoc:
Field Summary | |
private static int |
allClassesRef
Holds the id of the panel listing all classes in the generated file |
private static java.lang.String |
author
The document author - used on the title page. |
private static java.util.Hashtable |
classIds
This hashtable is used to match heading ids to fully qualified class names. |
private static int |
currentPackageId
Holds the link id of the package currently being processed |
private static boolean |
definitionListFirstLine
This flag is used when converting definition lists from html to latex. |
private static com.sun.javadoc.RootDoc |
doc
This is the RootDoc object passed to the start method. |
private static java.lang.String[] |
ourPackages
An array of all the package names documented in the IPF being generated. |
private static java.io.PrintWriter |
out
The output is written to this Writer. |
private static java.lang.String |
outputFileName
The name of the output file. |
private static int |
packageListId
Holds the id of the panel with the list of all packages |
private static int |
ref
This variable is incremented every time a heading id is specified, so that each heading id will be unique. |
private static boolean |
showDetails
Flag indicates whether to show the details of constructors, methods, and fields. |
private static boolean |
showSummary
Falg indicates whether to show the summaries of constructors, methods, and fields. |
private static java.lang.String |
title
The title to use for the latex file. |
private static boolean |
twoSide
Flag indicating whether document should be formatted for double-sided printing or not. |
Constructor Summary | |
LatexDoclet()
|
Method Summary | |
static java.lang.String |
dehyphenate(java.lang.String str)
Prevents latex from hyphenating the words, by appending a mandatory hyphen point at the end of all the words in the string. |
static int |
getClassId(com.sun.javadoc.ClassDoc c)
Gets the id for a given class. |
static int |
getClassId(java.lang.String className)
Gets the id for a given class. |
static java.lang.String |
getExceptionsString(com.sun.javadoc.ExecutableMemberDoc method)
Returns a string with a comma-separate list of all the exceptions that may be thrown by a method. |
static java.lang.String |
getLink(java.lang.String className,
java.lang.String text)
Gets Latex for reference to specified class. |
static java.lang.String |
getParamString(com.sun.javadoc.ExecutableMemberDoc method)
Returns a string containing all the parameters for a method. |
static void |
header()
Writes the latex header. |
static boolean |
isPackageInternal(java.lang.String pack)
Determines if the specified package is one being processed in this file. |
static int |
optionLength(java.lang.String option)
Returns how many option words specify a given tag. |
static void |
printClassTree(com.sun.javadoc.ClassDoc doc)
Outputs latex for superclass hierarchy for a class. |
static void |
processClass(com.sun.javadoc.ClassDoc c)
Produces the latex for a particular class. |
static java.lang.String |
processCommentText(java.lang.String in,
boolean inSummary)
Process the comment or tag text to convert html tagging to Latex commands. |
static void |
processConstructors(com.sun.javadoc.ConstructorDoc[] docs,
int startRes)
Write out a the constructor details. |
static void |
processFields(com.sun.javadoc.FieldDoc[] docs,
int startRes)
Write out a field details. |
static void |
processMethods(com.sun.javadoc.MethodDoc[] docs,
int startRes)
Write out the method details. |
static void |
processPackage(com.sun.javadoc.PackageDoc p,
int id)
Processes an individual package. |
static java.lang.String |
processSymbols(java.lang.String in)
This method is called to convert certain characters in a string to their symbolic representation in latex. |
static void |
readOptions(java.lang.String[][] options)
Processes our extra command line options. |
static boolean |
start(com.sun.javadoc.RootDoc _doc)
Called to start processing documentation. |
static void |
trailer()
Writes the trailer for the latex file. |
Methods inherited from class java.lang.Object |
|
Field Detail |
private static java.io.PrintWriter out
private static int ref
private static java.lang.String outputFileName
private static java.lang.String title
private static java.lang.String author
private static boolean showDetails
private static boolean showSummary
private static boolean twoSide
private static boolean definitionListFirstLine
private static java.lang.String[] ourPackages
private static java.util.Hashtable classIds
private static int currentPackageId
private static int packageListId
private static int allClassesRef
private static com.sun.javadoc.RootDoc doc
Constructor Detail |
public LatexDoclet()
Method Detail |
public static boolean start(com.sun.javadoc.RootDoc _doc)
processPackage
._doc
- The document object to processpublic static void header()
public static void trailer()
public static void processPackage(com.sun.javadoc.PackageDoc p, int id)
p
- The package to documentid
- The id to use for the label. These have already been predetermined in the
calling routine.public static int getClassId(com.sun.javadoc.ClassDoc c)
classIds
.c
- The class to get the id for.public static int getClassId(java.lang.String className)
classIds
.className
- The fully qualified class name to get the id for.public static java.lang.String dehyphenate(java.lang.String str)
str
- The string to de-hyphenatepublic static java.lang.String getLink(java.lang.String className, java.lang.String text)
className
- Fully qualified class name of the class to get the reference forThe
- text to be shown for the referencepublic static void processClass(com.sun.javadoc.ClassDoc c)
c
- The class to documentpublic static void processConstructors(com.sun.javadoc.ConstructorDoc[] docs, int startRes)
docs
- Array of constructor informationstartRes
- The reference id to use for the first constructor. Add one for second constructor, and so forth.public static void processMethods(com.sun.javadoc.MethodDoc[] docs, int startRes)
docs
- Array of nethod informationstartRes
- The reference id to use for the first method. Add one for second method, and so forth.public static void processFields(com.sun.javadoc.FieldDoc[] docs, int startRes)
docs
- Array of field informationstartRes
- The reference id to use for the first field. Add one for second field, and so forth.public static void printClassTree(com.sun.javadoc.ClassDoc doc)
doc
- The class to print the chart forpublic static boolean isPackageInternal(java.lang.String pack)
pack
- The package name to check forpublic static java.lang.String getParamString(com.sun.javadoc.ExecutableMemberDoc method)
method
- The method to get the parameter list forpublic static java.lang.String getExceptionsString(com.sun.javadoc.ExecutableMemberDoc method)
method
- The method to get the exception list for.public static java.lang.String processSymbols(java.lang.String in)
in
- The string to processpublic static java.lang.String processCommentText(java.lang.String in, boolean inSummary)
processSymbols
is also
called by this method to fix up any tricky symbols.in
- The text to processinSummary
- If the text to be processed is from the summary, set this to true. This prevents things
like lists from being translated, which sometimes causes problems for latex, because the end tag will
not be included because of truncation for the summary.public static int optionLength(java.lang.String option)
option
- The option to get length forpublic static void readOptions(java.lang.String[][] options)
options
- Array of options
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |