Class Preformat

java.lang.Object
org.apache.sis.internal.doclet.Taglet
org.apache.sis.internal.doclet.Preformat
All Implemented Interfaces:
jdk.javadoc.doclet.Taglet

public final class Preformat extends Taglet
The @preformat tag for inserting a pre-formatted code in a javadoc comment. The first word after the tag must be the format name ("java", "math", "wkt", "xml", "sql", "shell" or "text"). The remaining is the text to format.

This taglet will automatically replace &, < and > by their HTML entities. The only exception is &#64;, which is converted to the original @ character because we cannot use that character directly inside this taglet.

Since:
0.3
Version:
1.0
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    private static enum 
    The set of legal words after preformat.

    Nested classes/interfaces inherited from interface jdk.javadoc.doclet.Taglet

    jdk.javadoc.doclet.Taglet.Location
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static final String[]
    Special characters to replace by HTML entities.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs a @preformat taglet.
  • Method Summary

    Modifier and Type
    Method
    Description
    private static void
    Adds syntactic coloration for the given line.
    protected void
    format(com.sun.source.doctree.DocTree tag, StringBuilder buffer)
    Given the DocTree representation of this custom tag, appends its string representation.
    Returns the name of this custom tag.
    private static void
    Adds italic on variables in a math formulas.
    private static String
    trim(String line)
    Removes the leading and trailing linefeeds (but not other kind of spaces).

    Methods inherited from class org.apache.sis.internal.doclet.Taglet

    getAllowedLocations, getCurrentFile, init, isInlineTag, printError, printWarning, text, toString

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface jdk.javadoc.doclet.Taglet

    isBlockTag
  • Field Details

    • SPECIAL_CHARS

      private static final String[] SPECIAL_CHARS
      Special characters to replace by HTML entities.
  • Constructor Details

    • Preformat

      public Preformat()
      Constructs a @preformat taglet.
  • Method Details

    • getName

      public String getName()
      Returns the name of this custom tag.
      Returns:
      "preformat".
    • format

      protected void format(com.sun.source.doctree.DocTree tag, StringBuilder buffer)
      Given the DocTree representation of this custom tag, appends its string representation.
      Specified by:
      format in class Taglet
      Parameters:
      tag - the tag to format.
      buffer - the buffer where to format the tag.
    • colorJava

      private static void colorJava(String line, StringBuilder buffer)
      Adds syntactic coloration for the given line.
    • styleMath

      private static void styleMath(String line, StringBuilder buffer)
      Adds italic on variables in a math formulas. We will put in italic only the single latin letters.
    • trim

      private static String trim(String line)
      Removes the leading and trailing linefeeds (but not other kind of spaces).