Class NotesMacro
java.lang.Object
org.apache.maven.doxia.macro.AbstractMacro
com.puppycrawl.tools.checkstyle.site.NotesMacro
- 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="notes")
public class NotesMacro
extends org.apache.maven.doxia.macro.AbstractMacro
A macro that inserts a notes subsection 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.static final String
"Notes:" javadoc marking.static final Pattern
"Notes:" line.static final Pattern
"Notes:" line with new line accounted.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 Optional<DetailNode>
getLiTagNode
(DetailNode htmlElement) Gets the node of Li HTML tag.private static int
getNotesEndIndex
(DetailNode moduleJavadoc, Set<String> propertyNamesSet) Gets the end index of the Notes.static int
getNotesStartIndex
(DetailNode moduleJavadoc) Gets the start index of the Notes section.private static int
getParentSectionStartIndex
(DetailNode moduleJavadoc) Gets the start index of the parent subsection in module's JavaDoc.getPropertyNames
(String moduleName) Gets properties of the specified module.private static boolean
hasHtmlTagToStoreNotesSection
(DetailNode htmlElement) Checks whether html element has tag that stores notes section data.private static boolean
Checks if given line starts with HTML text-formatting tag.private static void
writeOutNotes
(String notes, org.apache.maven.doxia.sink.Sink sink) Writes the notes into xdoc.Methods inherited from class org.apache.maven.doxia.macro.AbstractMacro
enableLogging, getAttributesFromMap, getLog, required
-
Field Details
-
NOTES
"Notes:" javadoc marking.- See Also:
-
NOTES_LINE_WITH_NEWLINE
"Notes:" line with new line accounted. -
NOTES_LINE
"Notes:" line. -
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.
-
-
Constructor Details
-
NotesMacro
public NotesMacro()
-
-
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 Gets properties of the specified module.- Parameters:
moduleName
- name of module.- Returns:
- set of properties name if present, otherwise null.
- Throws:
org.apache.maven.doxia.macro.MacroExecutionException
- if the module could not be retrieved.
-
getNotesStartIndex
Gets the start index of the Notes section.- Parameters:
moduleJavadoc
- javadoc of module.- Returns:
- start index.
-
hasHtmlTagToStoreNotesSection
Checks whether html element has tag that stores notes section data.- Parameters:
htmlElement
- html element to check.- Returns:
- true if html element has tag storing notes section, otherwise false.
-
getLiTagNode
Gets the node of Li HTML tag.- Parameters:
htmlElement
- html element to get li tag from.- Returns:
- Optional of li tag node.
-
getNotesEndIndex
Gets the end index of the Notes.- Parameters:
moduleJavadoc
- javadoc of module.propertyNamesSet
- Set with property names.- Returns:
- the end index.
-
getParentSectionStartIndex
Gets the start index of the parent subsection in module's JavaDoc.- Parameters:
moduleJavadoc
- javadoc of module.- Returns:
- start index of parent subsection.
-
writeOutNotes
Writes the notes into xdoc.- Parameters:
notes
- notes 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.
-