@Override public String toString(final Tag[] tags) { if (tags.length == 0) { return null; } StringBuilder buf = new StringBuilder(String.format("\n<dl><dt><span class=\"strong\">%s</span></dt>\n", getHeader())); for (Tag t : tags) { buf.append(" <dd>").append(genLink(t.text())).append("</dd>\n"); } return buf.toString(); }
private static String print(final Tag tag) { return String.valueOf(tag.getClass()) + "[" + "firstSentenceTags=" + toCSV(tag.firstSentenceTags()) + ", inlineTags=" + toCSV(tag.inlineTags()) + ", kind=" + tag.kind() + ", name=" + tag.name() + ", text=" + tag.text() + "]"; }
responseDoc.setReturnDoc(returnTag.text()); for (final Tag inlineTag : responseParamTag.inlineTags()) { final String tagName = inlineTag.name(); final String tagText = inlineTag.text(); for (final Tag tag : entry.getValue()) { if (tag.name().endsWith(".qname")) { representationDoc.setElement(QName.valueOf(tag.text())); } else if (tag.name().endsWith(".mediaType")) { representationDoc.setMediaType(tag.text()); } else if (tag.name().endsWith(".example")) { representationDoc.setExample(getSerializedExample(tag)); } else if (tag.name().endsWith(".doc")) { representationDoc.setDoc(tag.text()); } else { LOG.warning("Unknown response representation tag " + tag.name());
public class ExtractCommentsDoclet { public static boolean start(RootDoc root) throws IOException { for (ClassDoc c : root.classes()) { print(c.qualifiedName(), c.commentText()); for (FieldDoc f : c.fields(false)) { print(f.qualifiedName(), f.commentText()); } for (MethodDoc m : c.methods(false)) { print(m.qualifiedName(), m.commentText()); if (m.commentText() != null && m.commentText().length() > 0) { for (ParamTag p : m.paramTags()) print(m.qualifiedName() + "@" + p.parameterName(), p.parameterComment()); for (Tag t : m.tags("return")) { if (t.text() != null && t.text().length() > 0) print(m.qualifiedName() + "@return", t.text()); } } } } return true; } private static void print(String name, String comment) throws IOException { if (comment != null && comment.length() > 0) { new FileWriter(name + ".txt").append(comment).close(); } } }
private static void addRequestRepresentationDoc(final MethodDoc methodDoc, final MethodDocType methodDocType) { final Tag requestElement = getSingleTagOrNull(methodDoc, "request.representation.qname"); final Tag requestExample = getSingleTagOrNull(methodDoc, "request.representation.example"); if (requestElement != null || requestExample != null) { final RequestDocType requestDoc = new RequestDocType(); final RepresentationDocType representationDoc = new RepresentationDocType(); /* requestElement exists */ if (requestElement != null) { representationDoc.setElement(QName.valueOf(requestElement.text())); } /* requestExample exists */ if (requestExample != null) { final String example = getSerializedExample(requestExample); if (!isEmpty(example)) { representationDoc.setExample(example); } else { LOG.warning("Could not get serialized example for method " + methodDoc.qualifiedName()); } } requestDoc.setRepresentationDoc(representationDoc); methodDocType.setRequestDoc(requestDoc); } }
/** * Given the <code>Tag</code> representation of this custom tag, return its string * representation. * * @param tag the <code>Tag</code> representation of this custom tag. */ @Override public String toString(Tag tag) { return "\n<DT><B>" + HEADER + "</B></DT>\n <DD>Should " + tag.text() + "</DD>"; }
/** * Given an array of <code>Tag</code>s representing this custom tag, return its string * representation. * * @param tags the array of <code>Tag</code>s representing of this custom tag. */ @Override public String toString(Tag[] tags) { if (tags.length == 0) { return null; } StringBuilder result = new StringBuilder("\n<DT><B>").append(HEADER).append("</B></DT>"); for (Tag tag : tags) { result.append("\n <DD>Should ").append(tag.text()).append("</DD>"); } return result.toString(); } }
public static String getText(Tag[] tags) { String text = ""; for (Tag tag : tags) { text += tag.text(); } return text; } }
/** * Given the <code>Tag</code> representation of this custom * tag, return its string representation. * @param tag he <code>Tag</code> representation of this custom tag. * @return the string representation of the custom tag */ public String toString(Tag tag) { String fragmentIdentifier = "datatype-" + tag.text(); return "<a href=\"" + mOdfSpecPath + "#" + fragmentIdentifier + "\">" + tag.text() + "</a>"; }
@Override public void render(Tag tag, StringBuilder target, PegdownDoclet doclet) { target.append(tag.name()).append(" ").append(tag.text()); } };
private static String getTagValue(Doc doc, String tagName) { Tag[] tags = doc.tags(tagName); return 0 < tags.length ? tags[0].text() : ""; }
@Override public JSONElement processTag(Tag tag) { return new JSONElement(tag.text()); } }
private static String print( Tag tag ) { final StringBuilder sb = new StringBuilder(); sb.append( tag.getClass() ).append( "[" ); sb.append( "firstSentenceTags=" ).append( toCSV( tag.firstSentenceTags() ) ); sb.append( ", inlineTags=" ).append( toCSV( tag.inlineTags() ) ); sb.append( ", kind=" ).append( tag.kind() ); sb.append( ", name=" ).append( tag.name() ); sb.append( ", text=" ).append( tag.text() ); sb.append( "]" ); return sb.toString(); }
/** * Add any custom freemarker bindings discovered via custom javadoc tags. Subclasses can override this to * provide additional custom bindings. * * @param currentWorkUnit the work unit for the feature being documented */ protected void addCustomBindings(final DocWorkUnit currentWorkUnit) { final String tagFilterPrefix = getTagPrefix(); Arrays.stream(currentWorkUnit.getClassDoc().inlineTags()) .filter(t -> t.name().startsWith(tagFilterPrefix)) .forEach(t -> currentWorkUnit.setProperty(t.name().substring(tagFilterPrefix.length()), t.text())); }
private void checkCategoryExistance(Doc node) { //check the if the category for this class exists if (node.tags(TAG_CATEGORY).length > 0 && !categories.containsKey(node.tags(TAG_CATEGORY)[0].text())) { final String categoryName = node.tags(TAG_CATEGORY)[0].text(); if (ColorCombination.values().length > nonconfiguredCategoryCount) { categories.put(categoryName, new CategoryOptions(categoryName, ColorCombination.values()[nonconfiguredCategoryCount])); nonconfiguredCategoryCount++; } else { categories.put(categoryName, new CategoryOptions(categoryName, "#FFFFFF", null)); } } }
/** Set the options based on the tag elements of the ClassDoc parameter */ public void setOptions(Doc p) { if (p == null) return; for (Tag tag : p.tags("opt")) setOption(StringUtil.tokenize(tag.text())); }
@Before public void initialiseMocks() { when(constructorDoc.tags(PARAM_TAG_NAME)).thenReturn(new Tag[] {tag1, tag2}); when(tag1.name()).thenReturn(PARAM_TAG_NAME); when(tag1.text()).thenReturn(FIRST_PARAM_TEXT); when(tag2.name()).thenReturn(PARAM_TAG_NAME); when(tag2.text()).thenReturn(SECOND_PARAM_TEXT); when(tag3.name()).thenReturn(RETURN_TAG_NAME); when(tag3.text()).thenReturn(RETURN_TAG_TEXT); }
protected TagInfo parseTag(Tag tagDoc) { TagInfo tagNode = objectFactory.createTagInfo(); tagNode.setName(tagDoc.kind()); tagNode.setText(tagDoc.text()); return tagNode; }