Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8190746

Augment the Compiler Tree API with ability to represent full HTML files

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P3 P3
    • 10
    • tools
    • None
    • binary
    • minimal
    • The new methods (getPreamble, getPostamble) can be provided as default methods, which return empty lists for existing doc comments from Java source files.

      Summary

      Augment the Compiler Tree API with the ability to represent a complete HTML file.

      Problem

      In the current implementation of the Compiler Tree API, the method DocTrees.getDocCommenTree(FileObject) returns just the content of the body element, between the <body> and </body> tags. However, in order to better handle standalone HTML files, including HTML files in doc-files subdirectories, it would be desirable to access the title and other metadata in the head element. This will better facilitate rewriting the file to expand appropriate javadoc tags, and to include a standard header and footer on such pages.

      Given the desire to get the contents of the head element as well as the body element, it makes sense to make the entire contents of the file available, including the doctype declaration, and the html element enclosing the head and body elements.

      Solution

      Enhance the existing APIs, to introduce new methods getPreamble and getPostamble which retrieve the leading and trailing HTML information. The preamble will include the doctype declaration, if found, which will require a new subtype of DocTree for its representation.

      Specification

      For convenience the specdiffs are at: http://cr.openjdk.java.net/~ksrini/8190552/specdiff.out/overview-summary.html

      The specdiffs are also attached as specdiff.zip

            ksrini Kumar Srinivasan
            ksrini Kumar Srinivasan
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: