Search in sources :

Example 11 with LineTag

use of org.eclipse.n4js.jsdoc.dom.LineTag in project n4js by eclipse.

the class DocletParserTest method testTrailingDescriptionIsIgnored.

@SuppressWarnings("javadoc")
@Test
public void testTrailingDescriptionIsIgnored() {
    String in = "/** This is the description.\n * @stubLineTagTitle \n * Trailing description.\n */";
    AbstractLineTagDefinition tag = new StubLineTagDefinition("stubLineTagTitle");
    DocletParser docletParser = new DocletParser(new TagDictionary<>(Arrays.asList(tag)), new TagDictionary<AbstractInlineTagDefinition>());
    Doclet doclet = docletParser.parse(in);
    assertEquals(1, doclet.getContents().size());
    assertEquals(1, doclet.getContents().size());
    Text descr = (Text) doclet.getContents().get(0);
    assertEquals("This is the description.", descr.getText());
    LineTag lineTag = doclet.getLineTags().get(0);
    assertEquals("stubLineTagTitle", lineTag.getTitle().getTitle());
}
Also used : LineTag(org.eclipse.n4js.jsdoc.dom.LineTag) AbstractLineTagDefinition(org.eclipse.n4js.jsdoc.tags.AbstractLineTagDefinition) AbstractInlineTagDefinition(org.eclipse.n4js.jsdoc.tags.AbstractInlineTagDefinition) Doclet(org.eclipse.n4js.jsdoc.dom.Doclet) Text(org.eclipse.n4js.jsdoc.dom.Text) Test(org.junit.Test)

Example 12 with LineTag

use of org.eclipse.n4js.jsdoc.dom.LineTag in project n4js by eclipse.

the class DocletImpl method hasLineTag.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public boolean hasLineTag(final String title) {
    final Function1<LineTag, Boolean> _function = new Function1<LineTag, Boolean>() {

        public Boolean apply(final LineTag it) {
            String _title = it.getTitle().getTitle();
            return Boolean.valueOf(Objects.equal(_title, title));
        }
    };
    LineTag _findFirst = IterableExtensions.<LineTag>findFirst(this.getLineTags(), _function);
    return (_findFirst != null);
}
Also used : LineTag(org.eclipse.n4js.jsdoc.dom.LineTag) Function1(org.eclipse.xtext.xbase.lib.Functions.Function1)

Example 13 with LineTag

use of org.eclipse.n4js.jsdoc.dom.LineTag in project n4js by eclipse.

the class JSDoc2HoverSerializer method handleLineTags.

private void handleLineTags(ITagDefinition tagDef, TagHandler tagHandler, List<LineTag> lineTags) {
    if (lineTags != null && !lineTags.isEmpty()) {
        tagHandler.open(tagDef, this);
        boolean first = true;
        for (LineTag lineTag : lineTags) {
            md2HtmlBuilder.resetMarkdownConverter();
            tagHandler.content(lineTag, this, first);
            first = false;
        }
        tagHandler.close(tagDef, this);
    }
}
Also used : LineTag(org.eclipse.n4js.jsdoc.dom.LineTag)

Example 14 with LineTag

use of org.eclipse.n4js.jsdoc.dom.LineTag in project n4js by eclipse.

the class JSDocSerializer method caseDoclet.

@Override
public Boolean caseDoclet(Doclet doclet) {
    strb.append("/**");
    if (!doclet.getContents().isEmpty()) {
        strb.append(NL);
    }
    appendContents(doclet.getContents());
    for (LineTag tag : doclet.getLineTags()) {
        doSwitch(tag);
    }
    if (!doclet.getLineTags().isEmpty()) {
        strb.append("\n");
    }
    strb.append(" */");
    return false;
}
Also used : LineTag(org.eclipse.n4js.jsdoc.dom.LineTag)

Example 15 with LineTag

use of org.eclipse.n4js.jsdoc.dom.LineTag in project n4js by eclipse.

the class LineTagWithFullMemberReferenceTest method test_fullRef_symbolName.

@SuppressWarnings("javadoc")
@Test
public void test_fullRef_symbolName() {
    String in = "/** foo." + "\n * @testee n4/model/collections/DataSet.DataSet.#iterator" + "\n */";
    AbstractLineTagDefinition tagDef = new LineTagWithFullMemberReference("testee");
    DocletParser docletParser = new DocletParser(new TagDictionary<>(Arrays.asList(tagDef)), new TagDictionary<AbstractInlineTagDefinition>());
    Doclet doclet = docletParser.parse(in);
    LineTag lineTag = doclet.getLineTags().get(0);
    EList<ContentNode> contents = lineTag.getValueByKey(LineTagWithFullElementReference.REF).getContents();
    FullMemberReference ref = (FullMemberReference) contents.get(0);
    assertEquals("n4/model/collections/DataSet", ref.getModuleName());
    assertEquals("DataSet", ref.getTypeName());
    assertEquals("#iterator", ref.getMemberName());
}
Also used : LineTag(org.eclipse.n4js.jsdoc.dom.LineTag) Doclet(org.eclipse.n4js.jsdoc.dom.Doclet) DocletParser(org.eclipse.n4js.jsdoc.DocletParser) ContentNode(org.eclipse.n4js.jsdoc.dom.ContentNode) FullMemberReference(org.eclipse.n4js.jsdoc.dom.FullMemberReference) Test(org.junit.Test)

Aggregations

LineTag (org.eclipse.n4js.jsdoc.dom.LineTag)19 Doclet (org.eclipse.n4js.jsdoc.dom.Doclet)14 Test (org.junit.Test)12 DocletParser (org.eclipse.n4js.jsdoc.DocletParser)6 Text (org.eclipse.n4js.jsdoc.dom.Text)6 AbstractInlineTagDefinition (org.eclipse.n4js.jsdoc.tags.AbstractInlineTagDefinition)6 AbstractLineTagDefinition (org.eclipse.n4js.jsdoc.tags.AbstractLineTagDefinition)6 FullMemberReference (org.eclipse.n4js.jsdoc.dom.FullMemberReference)3 TagValue (org.eclipse.n4js.jsdoc.dom.TagValue)3 ContentNode (org.eclipse.n4js.jsdoc.dom.ContentNode)2 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 List (java.util.List)1 EList (org.eclipse.emf.common.util.EList)1 EObject (org.eclipse.emf.ecore.EObject)1 TagTitle (org.eclipse.n4js.jsdoc.dom.TagTitle)1 TagTitleTokenizer (org.eclipse.n4js.jsdoc.tokenizers.TagTitleTokenizer)1 TMember (org.eclipse.n4js.ts.types.TMember)1 TMethod (org.eclipse.n4js.ts.types.TMethod)1 Function1 (org.eclipse.xtext.xbase.lib.Functions.Function1)1