/**
  * 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;
 }
Пример #2
0
 /**
  * Returns a link to the stylesheet file.
  *
  * @return an HtmlTree for the lINK tag which provides the stylesheet location
  */
 public HtmlTree getStyleSheetProperties(ConfigurationImpl configuration) {
   String stylesheetfile = configuration.stylesheetfile;
   DocPath stylesheet;
   if (stylesheetfile.isEmpty()) {
     stylesheet = DocPaths.STYLESHEET;
   } else {
     DocFile file = DocFile.createFileForInput(configuration, stylesheetfile);
     stylesheet = DocPath.create(file.getName());
   }
   HtmlTree link =
       HtmlTree.LINK("stylesheet", "text/css", pathToRoot.resolve(stylesheet).getPath(), "Style");
   return link;
 }
 /**
  * Convert the given Class to an HTML.
  *
  * @param cd the class to convert.
  * @param outputdir the name of the directory to output to.
  */
 public void convertClass(ClassDoc cd, DocPath outputdir) {
   if (cd == null) {
     return;
   }
   try {
     SourcePosition sp = cd.position();
     if (sp == null) return;
     Reader r;
     // temp hack until we can update SourcePosition API.
     if (sp instanceof SourcePositionImpl) {
       FileObject fo = ((SourcePositionImpl) sp).fileObject();
       if (fo == null) return;
       r = fo.openReader(true);
     } else {
       File file = sp.file();
       if (file == null) return;
       r = new FileReader(file);
     }
     int lineno = 1;
     String line;
     relativePath = DocPaths.SOURCE_OUTPUT.resolve(DocPath.forPackage(cd)).invert();
     Content body = getHeader();
     Content pre = new HtmlTree(HtmlTag.PRE);
     try (LineNumberReader reader = new LineNumberReader(r)) {
       while ((line = reader.readLine()) != null) {
         addLineNo(pre, lineno);
         addLine(pre, line, lineno);
         lineno++;
       }
     }
     addBlankLines(pre);
     Content div = HtmlTree.DIV(HtmlStyle.sourceContainer, pre);
     body.addContent((configuration.allowTag(HtmlTag.MAIN)) ? HtmlTree.MAIN(div) : div);
     writeToFile(body, outputdir.resolve(DocPath.forClass(cd)));
   } catch (IOException e) {
     e.printStackTrace();
   }
 }