java.lang.Object
org.jdrupes.mdoclet.internal.doclets.toolkit.Content
org.jdrupes.mdoclet.internal.doclets.formats.html.markup.Head

public class Head extends Content
An HTML element.

Many methods return the current object, to facilitate fluent builder-style usage.

  • Konstruktordetails

    • Head

      public Head(DocPath path, Runtime.Version docletVersion, ZonedDateTime generatedDate)
      Creates a Head object, for a given file and HTML version.

      The file is used to help determine the relative paths to stylesheet and script files. The HTML version is used to determine the appropriate form of a META element recording the time the file was created. The doclet version should also be provided for recording in the file.

      Parameter:
      path - the path for the file that will include this HEAD element
      docletVersion - the doclet version
  • Methodendetails

    • setTitle

      public Head setTitle(String title)
      Sets the title to appear in the TITLE element.
      Parameter:
      title - the title
      Gibt zurück:
      this object
    • setCharset

      public Head setCharset(String charset)
      Sets the charset to be declared in a META Content-TYPE element.
      Parameter:
      charset - the charset
      Gibt zurück:
      this object
    • setDescription

      public Head setDescription(String description)
      Sets the content for the description META element.
    • setGenerator

      public Head setGenerator(String generator)
      Sets the content for the generator META element.
    • addKeywords

      public Head addKeywords(List<String> keywords)
      Adds a list of keywords to appear in META keywords elements.
      Parameter:
      keywords - the list of keywords, or null if none need to be added
      Gibt zurück:
      this object
    • setTimestamp

      public Head setTimestamp(boolean timestamp)
      Sets whether or not timestamps should be recorded in the HEAD element.

      The timestamp will be recorded in a comment, and in an appropriate META element, depending on the HTML version specified when this object was created.

      Parameter:
      timestamp - true if timestamps should be be added.
      Gibt zurück:
      this object
    • setStylesheets

      public Head setStylesheets(DocPath main, List<DocPath> additional)
      Sets the main and any additional stylesheets to be listed in the HEAD element.

      The paths for the stylesheets must be relative to the root of the generated documentation hierarchy.

      Parameter:
      main - the main stylesheet, or null to use the default
      additional - a list of any additional stylesheets to be included
      Gibt zurück:
      this object
    • setAdditionalScripts

      Sets the list of additional script files to be added to the HEAD element.

      The path for the script files must be relative to the root of the generated documentation hierarchy.

      Parameter:
      scripts - the list of additional script files
      Gibt zurück:
      this object
    • setIndex

      public Head setIndex(boolean index, Script mainBodyScript)
      Sets whether or not to include the supporting scripts and stylesheets for the “search” feature.

      If the feature is enabled, a Script must be provided into which some JavaScript code will be injected, to be executed during page loading. The value will be ignored if the feature is not enabled.

      Parameter:
      index - true if the supporting files are to be included
      mainBodyScript - the Script object, or null
      Gibt zurück:
      this object
    • addScript

      public Head addScript(Script script)
      Adds a script to be included in the HEAD element.
      Parameter:
      script - the script
      Gibt zurück:
      this object
    • addDefaultScript

      public Head addDefaultScript(boolean addDefaultScript)
      Specifies whether or not to add a reference to a default script to be included in the HEAD element.

      The default script will normally be included; this method may be used to prevent that.

      Parameter:
      addDefaultScript - whether or not a default script will be included
      Gibt zurück:
      this object
    • setCanonicalLink

      public void setCanonicalLink(DocPath link)
      Specifies a value for a canonical link in the element.
      Parameter:
      link - the value for the canonical link
    • addContent

      public Head addContent(Content... contents)
      Adds additional content to be included in the HEAD element.
      Parameter:
      contents - the content
      Gibt zurück:
      this object
    • isEmpty

      public boolean isEmpty()
      Returns true if the content is empty.
      Angegeben von:
      isEmpty in Klasse Content
      Gibt zurück:
      false
    • write

      public boolean write(Writer out, String newline, boolean atNewline) throws IOException
      Beschreibung aus Klasse kopiert: Content
      Writes content to a writer, using a given newline sequence, which should be either \n or the platform line separator.
      Angegeben von:
      write in Klasse Content
      Parameter:
      out - the writer
      newline - the newline sequence to use
      atNewline - whether the writer has just written a newline
      Gibt zurück:
      whether the writer has just written a newline
      Löst aus:
      IOException - if an error occurs while writing the output