@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() + "]"; }
final Tag[] inlineTags = tag.inlineTags(); if (inlineTags != null && inlineTags.length > 0) { for (final Tag inlineTag : inlineTags) { LOG.fine("Have inline tag: " + print(inlineTag)); if ("@link".equals(inlineTag.name())) { if (LOG.isLoggable(Level.FINE)) { LOG.fine("Have link: " + print(inlineTag)); } else if (!isEmpty(inlineTag.text())) { return inlineTag.text(); return tag.text();
String tagName = tagelem.name(); if( tagelem instanceof SeeTag ) tagelem, getTagletWriterInstance( isFirstSentence ) ); result.append( output == null ? "" : output.toString() ); if( originalLength == 0 && isFirstSentence && tagelem.name().equals( "@inheritDoc" ) && result.length() > 0 ) String text = redirectRelativeLinks( tagelem.holder(), tagelem.text() );
private static Map<String, List<Tag>> getResponseRepresentationTags(final MethodDoc methodDoc) { final Map<String, List<Tag>> tagsByStatus = new HashMap<>(); for (final Tag tag : methodDoc.tags()) { final Matcher matcher = PATTERN_RESPONSE_REPRESENTATION.matcher(tag.name()); if (matcher.matches()) { final String status = matcher.group(1); List<Tag> tags = tagsByStatus.get(status); if (tags == null) { tags = new ArrayList<>(); tagsByStatus.put(status, tags); } tags.add(tag); } } return tagsByStatus; }
private static String getExamples(Doc doc) { Tag[] exampleTags = getTagsOrNull(doc, EXAMPLE_TAG); StringBuilder sb = new StringBuilder(P); if (null != exampleTags) { for (Tag exampleTag : exampleTags) { final Tag[] inlineTags = exampleTag.inlineTags(); if (null != inlineTags && inlineTags.length > 0) { for (Tag inlineTag : inlineTags) { if (SEE_TAG.equals(inlineTag.kind())) { final SeeTag linkTag = (SeeTag) inlineTag; sb.append(getExampleFromLink(linkTag)); } else if (!Strings.isNullOrEmpty(inlineTag.text())) { sb.append(inlineTag.text()); } sb.append(P); } } } } return sb.toString(); }
if ( tag.holder() instanceof ProgramElementDoc ) { packageName = ((ProgramElementDoc)tag.holder()).containingPackage().name(); else if ( tag.holder() instanceof PackageDoc ) { packageName = ((PackageDoc)(tag.holder())).name(); else if ( tag.holder() instanceof RootDoc ) { packageName = null; doclet.printError(tag.position(), "Cannot handle tag for holder " + tag.holder()); return; String source = tag.text().trim(); int pos = CharMatcher.WHITESPACE.indexIn(source); if ( pos < 0 ) { doclet.printError(tag.position(), "Invalid @startuml tag: Expected filename and PlantUML source"); return; doclet.printError(tag.position(), "Error generating UML image " + outputFile + ": " + e.getLocalizedMessage());
/** * Given the <code>Tag</code> representation of this custom * tag, return its string representation, which is output * to the generated page. * @param tag the <code>Tag</code> representation of this custom tag. * @param tagletWriter the taglet writer for output. * @return the TagletOutput representation of this <code>Tag</code>. */ public TagletOutput getTagletOutput(Tag tag, TagletWriter tagletWriter) { if (! (tag.holder() instanceof MethodDoc)) { return tagletWriter.getOutputInstance(); } return tag.name().equals("@inheritDoc") ? retrieveInheritedDocumentation(tagletWriter, (MethodDoc) tag.holder(), null, tagletWriter.isFirstSentence) : retrieveInheritedDocumentation(tagletWriter, (MethodDoc) tag.holder(), tag, tagletWriter.isFirstSentence); } }
/** * Add the inline deprecated comment. * * @param doc the doc for which the inline deprecated comment will be added * @param tag the inline tag to be added * @param htmltree the content tree to which the comment will be added */ public void addInlineDeprecatedComment(Doc doc, Tag tag, Content htmltree) { addCommentTags(doc, tag.inlineTags(), true, false, htmltree); }
private IAlgorithm getAlgorithmAssociatedToTag (Tag tag) { File javaFileObject = tag.holder ().position ().file(); String theClassName = ""; while (!javaFileObject.getName ().equals("net2plan")) { theClassName = javaFileObject.getName () + "." + theClassName; if (javaFileObject.getParentFile() == null) break; else javaFileObject = javaFileObject.getParentFile(); } theClassName = "com.net2plan." + theClassName; theClassName = theClassName.substring(0 , theClassName.length ()-6); //without .java IAlgorithm alg = null; try { Class algorithmClass = Taglet_Description.class.getClassLoader().loadClass(theClassName); if (!IAlgorithm.class.isAssignableFrom(algorithmClass)) return null; // not an algorithm alg = (IAlgorithm) algorithmClass.getConstructor().newInstance(); } catch (Exception e) { e.printStackTrace(); throw new RuntimeException ("Unexpected exception trying to load class of '" + theClassName + "'"); } return alg; }
private void checkOnPropertiesTags(MethodDoc[] members) { for (MethodDoc methodDoc: members) { if (methodDoc.isIncluded()) { for (Tag tag: methodDoc.tags()) { String tagName = tag.name(); if (tagName.equals("@propertySetter") || tagName.equals("@propertyGetter") || tagName.equals("@propertyDescription")) { if (!isPropertyGetterOrSetter(members, methodDoc)) { configuration.message.warning(tag.position(), "doclet.javafx_tag_misuse"); } break; } } } } }
/** * {@inheritDoc} */ public void inherit(DocFinder.Input input, DocFinder.Output output) { Tag[] tags = input.method.tags("return"); if (tags.length > 0) { output.holder = input.method; output.holderTag = tags[0]; output.inlineTags = input.isFirstSentence ? tags[0].firstSentenceTags() : tags[0].inlineTags(); } }
/** * Process a tag. * * @param tag The tag. * @param target The target string builder. */ @SuppressWarnings("unchecked") protected void processTag(Tag tag, StringBuilder target) { TagRenderer<Tag> renderer = (TagRenderer<Tag>)tagRenderers.get(tag.kind()); if ( renderer == null ) { renderer = TagRenderer.VERBATIM; } renderer.render(tag, target, this); }
/** * This method finds the contents of a general tag with the name provided * * @param tagName is the non-null pagarameter name * @param tags holds the comments in param tags * @return null if nothing found */ private String findComment(String tagName, Tag[] tags) { String result = null; int i = 0; while ( result == null && i < tags.length ) { if ( tagName.equals( tags[ i ].name() ) ) { result = tags[ i ].text(); } i++; } return result; }
/** * Render the tag. * * @todo TODOs can also be used in member docs ... * * @param tag The tag to render. * @param target The target {@link StringBuilder}. * @todo ... or even parameter docs -- which is a little strange, actually. ;) * @param doclet The doclet. */ @Override public void render(Tag tag, StringBuilder target, PegdownDoclet doclet) { Counter counter; if ( tag.holder() instanceof MemberDoc ) { counter = getCounter(((MemberDoc)tag.holder()).containingClass()); } else { counter = getCounter(tag.holder()); } target.append("<div class=\"todo\">"); target.append("<div class=\"todoTitle\"><span class=\"todoTitle\">") .append(doclet.getOptions().getTodoTitle()) .append("</span><span class=\"todoCounter\">#") .append(counter.next()) .append("</span></div>"); target.append("<div class=\"todoText\">"); target.append(doclet.toHtml(tag.text().trim())); target.append("</div></div>"); }
for (int i = 0; i < tags.length; i++) { Tag tagelem = tags[i]; String tagName = tagelem.name(); if (tagelem instanceof SeeTag) { result.addContent(seeTagToContent((SeeTag) tagelem)); Content output; if (configuration.docrootparent.length() > 0 && tagelem.name().equals("@docRoot") && ((tags[i + 1]).text()).startsWith("/..")) { if (wasEmpty && isFirstSentence && tagelem.name().equals("@inheritDoc") && !result.isEmpty()) { break; } else { String text = tagelem.text(); text = redirectRelativeLinks(tagelem.holder(), text);