public class MDoclet extends com.sun.javadoc.Doclet implements com.sun.javadoc.DocErrorReporter
The Doclet implementation. It converts the Markdown from the JavaDoc comments and tags
to HTML and sets a resulting JavaDoc comment using
Doc.setRawCommentText(String). It then passes the RootDoc to the standard
Doclet.
| Modifier and Type | Field and Description |
|---|---|
static String |
HIGHLIGHT_JS_HTML |
| Constructor and Description |
|---|
MDoclet(Options options,
com.sun.javadoc.RootDoc rootDoc)
Construct a new doclet.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addTagRenderer(String kind,
TagRenderer<?> renderer)
Adds a tag renderer for the specified
kind. |
void |
clearProcessor()
Clears the processor.
|
void |
clearTagRenderers()
Removes all tag renderers.
|
protected void |
defaultProcess(com.sun.javadoc.Doc doc,
boolean fixLeadingSpaces)
Default processing of any documentation node.
|
void |
error()
Indicate that an error occurred.
|
Options |
getOptions()
Get the options.
|
com.sun.javadoc.RootDoc |
getRootDoc()
Get the root doc.
|
boolean |
isError()
Check whether any errors occurred during processing of the documentation tree.
|
static com.sun.javadoc.LanguageVersion |
languageVersion()
As specified by the Doclet specification.
|
static void |
main(String[] args)
Just a main method for debugging.
|
static int |
optionLength(String option)
As specified by the Doclet specification.
|
boolean |
postProcess()
Called after the standard Doclet successfully did its work.
|
void |
printError(com.sun.javadoc.SourcePosition pos,
String msg) |
void |
printError(String msg) |
void |
printNotice(com.sun.javadoc.SourcePosition pos,
String msg) |
void |
printNotice(String msg) |
void |
printWarning(com.sun.javadoc.SourcePosition pos,
String msg) |
void |
printWarning(String msg) |
void |
process()
Process the documentation tree.
|
protected void |
processClass(com.sun.javadoc.ClassDoc doc)
Process the class documentation.
|
protected void |
processMember(com.sun.javadoc.MemberDoc doc)
Process the member documentation.
|
protected void |
processOverview()
Process the overview file, if specified.
|
protected void |
processPackage(com.sun.javadoc.PackageDoc doc)
Process the package documentation.
|
protected void |
processTag(com.sun.javadoc.Tag tag,
StringBuilder target)
Process a tag.
|
void |
removeTagRenderer(String kind)
Removes a tag renderer for the specified
kind. |
String |
rootUrlPrefix(com.sun.javadoc.PackageDoc doc)
Returns a prefix for relative URLs from a documentation element relative to the
given package.
|
static boolean |
start(com.sun.javadoc.RootDoc rootDoc)
As specified by the Doclet specification.
|
String |
toHtml(String markup)
Convert the given markup to HTML according to the
Options. |
String |
toHtml(String markup,
boolean fixLeadingSpaces)
Converts Markdown source to HTML according to the options object.
|
static boolean |
validOptions(String[][] options,
com.sun.javadoc.DocErrorReporter errorReporter)
As specified by the Doclet specification.
|
public static final String HIGHLIGHT_JS_HTML
public static com.sun.javadoc.LanguageVersion languageVersion()
As specified by the Doclet specification.
Doclet.languageVersion()public static int optionLength(String option)
As specified by the Doclet specification.
option - The option name.Doclet.optionLength(String)public static boolean validOptions(String[][] options, com.sun.javadoc.DocErrorReporter errorReporter)
As specified by the Doclet specification.
options - The command line options.errorReporter - An error reporter to print errors.true, if the options are valid.public static boolean start(com.sun.javadoc.RootDoc rootDoc)
As specified by the Doclet specification.
rootDoc - The root doc.true, if process was successful.Doclet.start(RootDoc)public void clearTagRenderers()
Removes all tag renderers.
public void addTagRenderer(String kind, TagRenderer<?> renderer)
Adds a tag renderer for the specified kind.
kind - The kind of the tag the renderer renders.renderer - The tag renderer.public void removeTagRenderer(String kind)
Removes a tag renderer for the specified kind.
kind - The kind of the tag.public Options getOptions()
Get the options.
public com.sun.javadoc.RootDoc getRootDoc()
Get the root doc.
public void process()
Process the documentation tree. If any errors occur during processing,
isError() will return true afterwards.
public boolean postProcess()
Called after the standard Doclet successfully did its work.
true if postprocessing succeeded.public boolean isError()
Check whether any errors occurred during processing of the documentation tree.
true if there were errors processing the documentation tree.protected void processOverview()
Process the overview file, if specified.
protected void processClass(com.sun.javadoc.ClassDoc doc)
Process the class documentation.
doc - The class documentation.protected void processMember(com.sun.javadoc.MemberDoc doc)
Process the member documentation.
doc - The member documentation.protected void processPackage(com.sun.javadoc.PackageDoc doc)
Process the package documentation.
doc - The package documentation.protected void defaultProcess(com.sun.javadoc.Doc doc, boolean fixLeadingSpaces)
Default processing of any documentation node.
doc - The documentation.fixLeadingSpaces - true if leading spaces should be fixed.protected void processTag(com.sun.javadoc.Tag tag, StringBuilder target)
Process a tag.
tag - The tag.target - The target string builder.public void clearProcessor()
Clears the processor.
public String toHtml(String markup)
Convert the given markup to HTML according to the Options.
markup - The Markdown source.public String toHtml(String markup, boolean fixLeadingSpaces)
Converts Markdown source to HTML according to the options object. If
fixLeadingSpaces is true, exactly one leading whitespace character (‘\u0020’)
will be removed, if it exists.
markup - The Markdown source.fixLeadingSpaces - true if leading spaces should be fixed.public void error()
Indicate that an error occurred. This method will also be called by
printError(String) and
printError(com.sun.javadoc.SourcePosition, String).
public void printError(String msg)
printError in interface com.sun.javadoc.DocErrorReporterpublic void printError(com.sun.javadoc.SourcePosition pos, String msg)
printError in interface com.sun.javadoc.DocErrorReporterpublic void printWarning(String msg)
printWarning in interface com.sun.javadoc.DocErrorReporterpublic void printWarning(com.sun.javadoc.SourcePosition pos, String msg)
printWarning in interface com.sun.javadoc.DocErrorReporterpublic void printNotice(String msg)
printNotice in interface com.sun.javadoc.DocErrorReporterpublic void printNotice(com.sun.javadoc.SourcePosition pos, String msg)
printNotice in interface com.sun.javadoc.DocErrorReporterpublic String rootUrlPrefix(com.sun.javadoc.PackageDoc doc)
Returns a prefix for relative URLs from a documentation element relative to the given package. This prefix can be used to refer to the root URL of the documentation:
doc = "<script type=\"text/javascript\" src=\""
+ rootUrlPrefix(classDoc.containingPackage()) + "highlight.js"
+ "\"></script>";
doc - The package containing the element from where to reference the root.