Search in sources :

Example 36 with Tag

use of com.sun.javadoc.Tag in project markdown-doclet by Abnaxos.

the class MarkdownDoclet method defaultProcess.

/**
 * Default processing of any documentation node.
 *
 * @param doc              The documentation.
 * @param fixLeadingSpaces `true` if leading spaces should be fixed.
 *
 * @see Options#toHtml(String, boolean)
 */
protected void defaultProcess(Doc doc, boolean fixLeadingSpaces) {
    try {
        StringBuilder buf = new StringBuilder();
        buf.append(getOptions().toHtml(doc.commentText(), fixLeadingSpaces));
        buf.append('\n');
        for (Tag tag : doc.tags()) {
            processTag(tag, buf);
            buf.append('\n');
        }
        doc.setRawCommentText(buf.toString());
    } catch (final ParserRuntimeException e) {
        if (doc instanceof RootDoc) {
            printError(new SourcePosition() {

                @Override
                public File file() {
                    return options.getOverviewFile();
                }

                @Override
                public int line() {
                    return 0;
                }

                @Override
                public int column() {
                    return 0;
                }
            }, e.getMessage());
        } else {
            printError(doc.position(), e.getMessage());
        }
    }
}
Also used : ParserRuntimeException(org.parboiled.errors.ParserRuntimeException) SourcePosition(com.sun.javadoc.SourcePosition) Tag(com.sun.javadoc.Tag) RootDoc(com.sun.javadoc.RootDoc)

Example 37 with Tag

use of com.sun.javadoc.Tag in project cytoscape-api by cytoscape.

the class AbstractTagletTester method testToString.

@Test
public void testToString() {
    Tag t = mock(Tag.class);
    when(t.text()).thenReturn("test text");
    assertNotNull(taglet.toString(t));
}
Also used : Tag(com.sun.javadoc.Tag) Test(org.junit.Test)

Example 38 with Tag

use of com.sun.javadoc.Tag in project cytoscape-api by cytoscape.

the class AbstractTagletTester method testToStringArray.

@Test
public void testToStringArray() {
    Tag t = mock(Tag.class);
    when(t.text()).thenReturn("test text");
    Tag t2 = mock(Tag.class);
    when(t2.text()).thenReturn("test text");
    Tag[] tags = new Tag[] { t, t2 };
    assertNotNull(taglet.toString(tags));
}
Also used : Tag(com.sun.javadoc.Tag) Test(org.junit.Test)

Example 39 with Tag

use of com.sun.javadoc.Tag in project jangaroo-tools by CoreMedia.

the class Util method extractTags.

public static Tag[] extractTags(Doc holder, String text) {
    List tags = new ArrayList();
    Matcher tagMatcher = TOP_LEVEL_TAG_PATTERN.matcher(text);
    boolean found;
    int start = 0;
    do {
        found = tagMatcher.find();
        int end = found ? tagMatcher.start() : text.length();
        Tag tag = createTag(holder, text.substring(start, end));
        tags.add(tag);
        start = end;
    } while (found);
    return (Tag[]) tags.toArray(new Tag[tags.size()]);
}
Also used : Matcher(java.util.regex.Matcher) ArrayList(java.util.ArrayList) List(java.util.List) ArrayList(java.util.ArrayList) Tag(com.sun.javadoc.Tag)

Example 40 with Tag

use of com.sun.javadoc.Tag in project jangaroo-tools by CoreMedia.

the class DocImpl method initTags.

private void initTags() {
    allTags = NO_TAGS;
    firstSentenceTags = NO_TAGS;
    this.tagsByName = new HashMap();
    if (((IdeDeclaration) declaration).getSymModifiers().length > 0) {
        String text = Util.tidy(((IdeDeclaration) declaration).getSymModifiers()[0].getWhitespace());
        if (text.length() > 0) {
            allTags = Util.extractTags(this, text);
            firstSentenceTags = Util.extractInlineTags(this, Util.firstSentence(text));
            Map /*String->List<Tag>*/
            tagsByName = new HashMap();
            for (int i = 0; i < allTags.length; i++) {
                Tag tag = allTags[i];
                List tags = (List) tagsByName.get(tag.name());
                if (tags == null) {
                    tags = new ArrayList();
                    tagsByName.put(tag.name(), tags);
                }
                tags.add(tag);
            }
            for (Iterator iterator = tagsByName.entrySet().iterator(); iterator.hasNext(); ) {
                Map.Entry entry = (Map.Entry) iterator.next();
                List /*Tag*/
                tagList = (List) entry.getValue();
                Object tagName = entry.getKey();
                this.tagsByName.put(tagName, tagList.toArray(new Tag[tagList.size()]));
            }
        }
    }
}
Also used : IdeDeclaration(net.jangaroo.jooc.IdeDeclaration) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) List(java.util.List) ArrayList(java.util.ArrayList) SeeTag(com.sun.javadoc.SeeTag) Tag(com.sun.javadoc.Tag) Map(java.util.Map) HashMap(java.util.HashMap)

Aggregations

Tag (com.sun.javadoc.Tag)40 ParamTag (com.sun.javadoc.ParamTag)14 SeeTag (com.sun.javadoc.SeeTag)12 ArrayList (java.util.ArrayList)7 List (java.util.List)6 Matcher (java.util.regex.Matcher)4 Test (org.junit.Test)4 ClassDoc (com.sun.javadoc.ClassDoc)3 MethodDoc (com.sun.javadoc.MethodDoc)3 TagletOutputImpl (com.sun.tools.doclets.formats.html.TagletOutputImpl)3 HashMap (java.util.HashMap)3 Parameter (com.sun.javadoc.Parameter)2 ThrowsTag (com.sun.javadoc.ThrowsTag)2 Type (com.sun.javadoc.Type)2 TagletWriterImpl (com.sun.tools.doclets.formats.html.TagletWriterImpl)2 RepresentationDocType (org.glassfish.jersey.server.wadl.internal.generators.resourcedoc.model.RepresentationDocType)2 JSONObject (org.json.JSONObject)2 JavadocInlineTagHandler (com.eden.orchid.javadoc.api.JavadocInlineTagHandler)1 ApiField (com.emc.apidocs.model.ApiField)1 PsiDocTag (com.intellij.psi.javadoc.PsiDocTag)1