/**
  * Returns a link to the stylesheet file.
  *
  * @return an HtmlTree for the lINK tag which provides the stylesheet location
  */
 public HtmlTree getStyleSheetProperties() {
   String filename = configuration.stylesheetfile;
   DocPath stylesheet;
   if (filename.length() > 0) {
     DocFile file = DocFile.createFileForInput(configuration, filename);
     stylesheet = DocPath.create(file.getName());
   } else {
     stylesheet = DocPaths.STYLESHEET;
   }
   DocPath p = relativePath.resolve(stylesheet);
   HtmlTree link = HtmlTree.LINK("stylesheet", "text/css", p.getPath(), "Style");
   return link;
 }
 /**
  * Write the output to the file.
  *
  * @param body the documentation content to be written to the file.
  * @param path the path for the file.
  */
 private void writeToFile(Content body, DocPath path) throws IOException {
   Content htmlDocType = configuration.isOutputHtml5() ? DocType.HTML5 : DocType.TRANSITIONAL;
   Content head = new HtmlTree(HtmlTag.HEAD);
   head.addContent(
       HtmlTree.TITLE(new StringContent(configuration.getText("doclet.Window_Source_title"))));
   head.addContent(getStyleSheetProperties());
   Content htmlTree = HtmlTree.HTML(configuration.getLocale().getLanguage(), head, body);
   Content htmlDocument = new HtmlDocument(htmlDocType, htmlTree);
   configuration.message.notice("doclet.Generating_0", path.getPath());
   DocFile df = DocFile.createFileForOutput(configuration, path);
   try (Writer w = df.openWriter()) {
     htmlDocument.write(w, true);
   }
 }
Example #3
0
 private static void writeDirectory(
     Map<String, List<TocInfo>> toc, File dir, String relative, JSilver js, String out) {
   File[] files = dir.listFiles();
   int i, count = files.length;
   for (i = 0; i < count; i++) {
     File f = files[i];
     if (f.isFile()) {
       String templ = ensureSlash(relative) + f.getName();
       int len = templ.length();
       /* if (len > 3 && ".cs".equals(templ.substring(len - 3))) {
       Data data = makeHDF();
       makeTocHDF(toc, data);
       String filename = out + templ.substring(0, len - 3) + htmlExtension;
       ClearPage.write(data, templ, filename, js); */
       if (len > 3 && ".jd".equals(templ.substring(len - 3))) {
         String filename = out + templ.substring(0, len - 3) + htmlExtension;
         DocFile.writePage(toc, f.getAbsolutePath(), relative, filename);
       } else {
         ClearPage.copyFile(f, new File(ensureSlash(out) + templ));
       }
     } else if (f.isDirectory()) {
       writeDirectory(toc, f, ensureSlash(relative) + f.getName() + "/", js, out);
     }
   }
 }