Skip to content

Commit

Permalink
8258655: remove <-- NewPage --> comment from generated pages
Browse files Browse the repository at this point in the history
Reviewed-by: hannesw
  • Loading branch information
jonathan-gibbons committed Jan 11, 2021
1 parent c956e7a commit d9f2134
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 25 deletions.
Expand Up @@ -140,7 +140,6 @@ public class Contents {
public final Content navProperty;
public final Content navServices;
public final Content nestedClassSummary;
public final Content newPage;
public final Content noScriptMessage;
public final Content openModuleLabel;
public final Content openedTo;
Expand Down Expand Up @@ -287,7 +286,6 @@ public class Contents {
navProperty = getContent("doclet.navProperty");
navServices = getContent("doclet.navServices");
nestedClassSummary = getContent("doclet.Nested_Class_Summary");
newPage = new Comment(resources.getText("doclet.New_Page"));
noScriptMessage = getContent("doclet.No_Script_Message");
openedTo = getContent("doclet.OpenedTo");
openModuleLabel = getContent("doclet.Open_Module");
Expand Down
Expand Up @@ -459,7 +459,6 @@ public void printHtmlDocument(List<String> metakeywords,
List<DocPath> localStylesheets,
Content body)
throws DocFileIOException {
Content htmlComment = contents.newPage;
List<DocPath> additionalStylesheets = configuration.getAdditionalStylesheets();
additionalStylesheets.addAll(localStylesheets);
Head head = new Head(path, configuration.getDocletVersion(), configuration.startTime)
Expand All @@ -473,8 +472,8 @@ public void printHtmlDocument(List<String> metakeywords,
.setIndex(options.createIndex(), mainBodyScript)
.addContent(extraHeadContent);

Content htmlTree = HtmlTree.HTML(configuration.getLocale().getLanguage(), head, body);
HtmlDocument htmlDocument = new HtmlDocument(htmlComment, htmlTree);
HtmlDocument htmlDocument = new HtmlDocument(
HtmlTree.HTML(configuration.getLocale().getLanguage(), head, body));
htmlDocument.write(DocFile.createFileForOutput(configuration, path));
}

Expand Down
Expand Up @@ -74,7 +74,6 @@ private IndexRedirectWriter(HtmlConfiguration configuration, DocPath filename, D
* @throws DocFileIOException if there is a problem generating the file
*/
private void generateIndexFile() throws DocFileIOException {
Content htmlComment = contents.newPage;
Head head = new Head(path, configuration.getDocletVersion(), configuration.startTime)
.setTimestamp(!options.noTimestamp())
.setDescription("index redirect")
Expand Down Expand Up @@ -109,8 +108,8 @@ private void generateIndexFile() throws DocFileIOException {
HtmlTree main = HtmlTree.MAIN(bodyContent);
body.add(main);

Content htmlTree = HtmlTree.HTML(configuration.getLocale().getLanguage(), head, body);
HtmlDocument htmlDocument = new HtmlDocument(htmlComment, htmlTree);
HtmlDocument htmlDocument = new HtmlDocument(
HtmlTree.HTML(configuration.getLocale().getLanguage(), head, body));
htmlDocument.write(DocFile.createFileForOutput(configuration, path));
}
}
Expand Up @@ -45,25 +45,15 @@
*/
public class HtmlDocument {
private final DocType docType = DocType.HTML5;
private final List<Content> docContent;

/**
* Constructor to construct an HTML document.
*
* @param docComment comment for the document
* @param htmlTree HTML tree of the document
*/
public HtmlDocument(Content docComment, Content htmlTree) {
docContent = Arrays.asList(docComment, htmlTree);
}
private final Content docContent;

/**
* Constructor to construct an HTML document.
*
* @param htmlTree HTML tree of the document
*/
public HtmlDocument(Content htmlTree) {
docContent = Collections.singletonList(htmlTree);
docContent = htmlTree;
}

/**
Expand Down Expand Up @@ -93,9 +83,6 @@ public String toString() {
private void write(Writer writer) throws IOException {
writer.write(docType.text);
writer.write(DocletConstants.NL);
boolean atNewline = true;
for (Content c : docContent) {
atNewline = c.write(writer, atNewline);
}
docContent.write(writer, true);
}
}
Expand Up @@ -72,7 +72,6 @@ doclet.Window_Split_Index={0}-Index
doclet.Help=Help
doclet.Skip_navigation_links=Skip navigation links
doclet.Navigation=Navigation
doclet.New_Page=NewPage
doclet.navDeprecated=Deprecated
doclet.Window_Deprecated_List=Deprecated List
doclet.Window_Preview_List=Preview List
Expand Down

1 comment on commit d9f2134

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.