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 Details

  • Constructor Details

  • 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

      public static int getNotesStartIndex(DetailNode moduleJavadoc)
      Gets the start index of the Notes section.
      Parameters:
      moduleJavadoc - javadoc of module.
      Returns:
      start index.
    • hasHtmlTagToStoreNotesSection

      private static boolean hasHtmlTagToStoreNotesSection(DetailNode htmlElement)
      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

      private static Optional<DetailNode> getLiTagNode(DetailNode htmlElement)
      Gets the node of Li HTML tag.
      Parameters:
      htmlElement - html element to get li tag from.
      Returns:
      Optional of li tag node.
    • getNotesEndIndex

      private static int getNotesEndIndex(DetailNode moduleJavadoc, Set<String> propertyNamesSet)
      Gets the end index of the Notes.
      Parameters:
      moduleJavadoc - javadoc of module.
      propertyNamesSet - Set with property names.
      Returns:
      the end index.
    • getParentSectionStartIndex

      private static int getParentSectionStartIndex(DetailNode moduleJavadoc)
      Gets the start index of the parent subsection in module's JavaDoc.
      Parameters:
      moduleJavadoc - javadoc of module.
      Returns:
      start index of parent subsection.
    • writeOutNotes

      private static void writeOutNotes(String notes, org.apache.maven.doxia.sink.Sink sink)
      Writes the notes into xdoc.
      Parameters:
      notes - notes of the module.
      sink - sink of the macro.
    • startsWithTextFormattingHtmlTag

      private static boolean startsWithTextFormattingHtmlTag(String line)
      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.