Class DescriptionMacro
java.lang.Object
org.apache.maven.doxia.macro.AbstractMacro
com.puppycrawl.tools.checkstyle.site.DescriptionMacro
- All Implemented Interfaces:
org.apache.maven.doxia.logging.LogEnabled
,org.apache.maven.doxia.macro.Macro
@Component(role=org.apache.maven.doxia.macro.Macro.class,
hint="description")
public class DescriptionMacro
extends org.apache.maven.doxia.macro.AbstractMacro
A macro that inserts a description of module from its Javadoc.
-
Field Summary
FieldsModifier and TypeFieldDescriptionA set of all html tags that need to be considered as text formatting for this macro.private static final String
A newline with 10 spaces of indentation.private static final String
A newline with 8 spaces of indentation.private static final String
New line escape character.private static final String
"Notes:" javadoc marking.private static final Pattern
"Notes:" line.Fields inherited from interface org.apache.maven.doxia.macro.Macro
EOL, ROLE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
execute
(org.apache.maven.doxia.sink.Sink sink, org.apache.maven.doxia.macro.MacroRequest request) private static int
getDescriptionEndIndex
(DetailNode moduleJavadoc, Set<String> propertyNamesSet) Gets the end index of the description.private static Optional<DetailNode>
getLiTagNode
(DetailNode htmlElement) Gets the node of Li HTML tag.static int
getNotesStartIndex
(DetailNode moduleJavadoc) Gets the start index of the Notes section.private static int
getParentSectionStartIndex
(DetailNode moduleJavadoc) Gets the starting index of the "Parent is" paragraph in module's javadoc.getPropertyNames
(String moduleName) Assigns values to each instance variable.private static boolean
isStartOfNotesSection
(DetailNode htmlElement) Determines whether the given HTML node marks the start of the "Notes" section.private static boolean
Checks if given line starts with HTML text-formatting tag.private static void
writeOutDescription
(String description, org.apache.maven.doxia.sink.Sink sink) Writes the description into xdoc.Methods inherited from class org.apache.maven.doxia.macro.AbstractMacro
enableLogging, getAttributesFromMap, getLog, required
-
Field Details
-
NEWLINE
New line escape character.- See Also:
-
INDENT_LEVEL_8
A newline with 8 spaces of indentation. -
INDENT_LEVEL_10
A newline with 10 spaces of indentation. -
HTML_TEXT_FORMAT_TAGS
A set of all html tags that need to be considered as text formatting for this macro. -
NOTES
"Notes:" javadoc marking.- See Also:
-
NOTES_LINE
"Notes:" line.
-
-
Constructor Details
-
DescriptionMacro
public DescriptionMacro()
-
-
Method Details
-
execute
public void execute(org.apache.maven.doxia.sink.Sink sink, org.apache.maven.doxia.macro.MacroRequest request) throws org.apache.maven.doxia.macro.MacroExecutionException - Throws:
org.apache.maven.doxia.macro.MacroExecutionException
-
getPropertyNames
private static Set<String> getPropertyNames(String moduleName) throws org.apache.maven.doxia.macro.MacroExecutionException Assigns values to each instance variable.- Parameters:
moduleName
- name of module.- Returns:
- set of property names.
- Throws:
org.apache.maven.doxia.macro.MacroExecutionException
- if the module could not be retrieved.
-
getDescriptionEndIndex
Gets the end index of the description.- Parameters:
moduleJavadoc
- javadoc of module.propertyNamesSet
- Set with property names.- Returns:
- the end index.
-
getNotesStartIndex
Gets the start index of the Notes section.- Parameters:
moduleJavadoc
- javadoc of module.- Returns:
- start index.
-
isStartOfNotesSection
Determines whether the given HTML node marks the start of the "Notes" section.- Parameters:
htmlElement
- html element to check.- Returns:
- true if the element starts the "Notes" section, false otherwise.
-
getLiTagNode
Gets the node of Li HTML tag.- Parameters:
htmlElement
- html element to get li tag from.- Returns:
- Optional of li tag node.
-
getParentSectionStartIndex
Gets the starting index of the "Parent is" paragraph in module's javadoc.- Parameters:
moduleJavadoc
- javadoc of module.- Returns:
- start index of parent subsection.
-
writeOutDescription
Writes the description into xdoc.- Parameters:
description
- description of the module.sink
- sink of the macro.
-
startsWithTextFormattingHtmlTag
Checks if given line starts with HTML text-formatting tag.- Parameters:
line
- line to check on.- Returns:
- whether given line starts with HTML text-formatting tag.
-