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 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
      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

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

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

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

      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.
    • getParentSectionStartIndex

      private static int getParentSectionStartIndex(DetailNode moduleJavadoc)
      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

      private static void writeOutDescription(String description, org.apache.maven.doxia.sink.Sink sink)
      Writes the description into xdoc.
      Parameters:
      description - description 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.