public void makeHDF(Data data, String base, Map<String, TypeInfo> typeMapping) { data.setValue(base + ".kind", kind()); data.setValue(base + ".name", name()); data.setValue(base + ".href", htmlPage()); data.setValue(base + ".anchor", anchor()); if (mReturnType != null) { returnType() .getTypeWithArguments(typeMapping) .makeHDF(data, base + ".returnType", false, typeVariables()); data.setValue(base + ".abstract", mIsAbstract ? "abstract" : ""); } data.setValue(base + ".synchronized", mIsSynchronized ? "synchronized" : ""); data.setValue(base + ".final", isFinal() ? "final" : ""); data.setValue(base + ".static", isStatic() ? "static" : ""); TagInfo.makeHDF(data, base + ".shortDescr", firstSentenceTags()); TagInfo.makeHDF(data, base + ".descr", inlineTags()); TagInfo.makeHDF(data, base + ".deprecated", deprecatedTags()); TagInfo.makeHDF(data, base + ".seeAlso", seeTags()); data.setValue(base + ".since", getSince()); if (isDeprecated()) { data.setValue(base + ".deprecatedsince", getDeprecatedSince()); } ParamTagInfo.makeHDF(data, base + ".paramTags", paramTags()); AttrTagInfo.makeReferenceHDF(data, base + ".attrRefs", comment().attrTags()); ThrowsTagInfo.makeHDF(data, base + ".throws", throwsTags()); ParameterInfo.makeHDF( data, base + ".params", mParameters.toArray(new ParameterInfo[mParameters.size()]), isVarArgs(), typeVariables(), typeMapping); if (isProtected()) { data.setValue(base + ".scope", "protected"); } else if (isPublic()) { data.setValue(base + ".scope", "public"); } TagInfo.makeHDF(data, base + ".returns", returnTags()); if (mTypeParameters != null) { TypeInfo.makeHDF(data, base + ".generic.typeArguments", mTypeParameters, false); } AnnotationInstanceInfo.makeLinkListHDF( data, base + ".showAnnotations", showAnnotations().toArray(new AnnotationInstanceInfo[showAnnotations().size()])); setFederatedReferences(data, base); }
boolean isMustCloseTag(TagInfo tagInfo) { if (tagInfo != null) { return mustCloseTags.contains(tagInfo.getName()) || tagInfo.contentType == CONTENT_TEXT; } return false; }
public static void writePage(String docfile, String relative, String outfile) { HDF hdf = DroidDoc.makeHDF(); /* System.out.println("docfile='" + docfile + "' relative='" + relative + "'" + "' outfile='" + outfile + "'"); */ String filedata = readFile(docfile); // The document is properties up until the line "@jd:body". // Any blank lines are ignored. int start = -1; int lineno = 1; Matcher lines = LINE.matcher(filedata); String line = null; while (lines.find()) { line = lines.group(1); if (line.length() > 0) { if (line.equals("@jd:body")) { start = lines.end(); break; } Matcher prop = PROP.matcher(line); if (prop.matches()) { String key = prop.group(1); String value = prop.group(2); hdf.setValue(key, value); } else { break; } } lineno++; } if (start < 0) { System.err.println(docfile + ":" + lineno + ": error parsing docfile"); if (line != null) { System.err.println(docfile + ":" + lineno + ":" + line); } System.exit(1); } // if they asked to only be for a certain template, maybe skip it String fromTemplate = hdf.getValue("template.which", ""); String fromPage = hdf.getValue("page.onlyfortemplate", ""); if (!"".equals(fromPage) && !fromTemplate.equals(fromPage)) { return; } // and the actual text after that String commentText = filedata.substring(start); Comment comment = new Comment(commentText, null, new SourcePositionInfo(docfile, lineno, 1)); TagInfo[] tags = comment.tags(); TagInfo.makeHDF(hdf, "root.descr", tags); hdf.setValue("commentText", commentText); // write the page using the appropriate root template, based on the // whichdoc value supplied by build String fromWhichmodule = hdf.getValue("android.whichmodule", ""); if (fromWhichmodule.equals("online-pdk")) { // leaving this in just for temporary compatibility with pdk doc hdf.setValue("online-pdk", "true"); // add any conditional login for root template here (such as // for custom left nav based on tab etc. ClearPage.write(hdf, "docpage.cs", outfile); } else { if (outfile.indexOf("sdk/") != -1) { hdf.setValue("sdk", "true"); if ((outfile.indexOf("index.html") != -1) || (outfile.indexOf("features.html") != -1)) { ClearPage.write(hdf, "sdkpage.cs", outfile); } else { ClearPage.write(hdf, "docpage.cs", outfile); } } else if (outfile.indexOf("guide/") != -1) { hdf.setValue("guide", "true"); ClearPage.write(hdf, "docpage.cs", outfile); } else if (outfile.indexOf("resources/") != -1) { hdf.setValue("resources", "true"); ClearPage.write(hdf, "docpage.cs", outfile); } else { ClearPage.write(hdf, "nosidenavpage.cs", outfile); } } } // writePage