Search in sources :

Example 6 with TagValue

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

the class JSDoc2HoverSerializer method caseInlineTag.

@Override
public Boolean caseInlineTag(InlineTag tag) {
    // strb.append("{").append(JSDocCharScanner.TAG_START).append(object.getTitle().getTitle());
    String htag = "i";
    if (tag.getTagDefinition() == N4JSDocletParser.TAG_CODE) {
        htag = "code";
    }
    md2HtmlBuilder.append("<" + htag + ">");
    for (TagValue tagValue : tag.getValues()) {
        doSwitch(tagValue);
    }
    md2HtmlBuilder.append("</" + htag + ">");
    return false;
}
Also used : TagValue(org.eclipse.n4js.jsdoc.dom.TagValue)

Example 7 with TagValue

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

the class InlineTagTest method testSimpleLineTag.

@SuppressWarnings("javadoc")
@Test
public void testSimpleLineTag() {
    String in = "/** Some Description {@inline me} some other text. \n */";
    AbstractInlineTagDefinition tag = new StubInlineTagDefinition("inline");
    DocletParser docletParser = new DocletParser(new TagDictionary<AbstractLineTagDefinition>(), new TagDictionary<>(Arrays.asList(tag)));
    Doclet doclet = docletParser.parse(in);
    EList<ContentNode> contents = doclet.getContents();
    Composite composite = (Composite) contents.get(0);
    ContentNode node0 = composite.getContents().get(0);
    ContentNode node1 = composite.getContents().get(1);
    ContentNode node2 = composite.getContents().get(2);
    Text descriptionText1 = (Text) node0;
    InlineTag descriptionInlineTag = (InlineTag) node1;
    Text descriptionText2 = (Text) node2;
    assertEquals("Some Description ", descriptionText1.getText());
    assertEquals(" some other text.", descriptionText2.getText());
    TagValue inlineDescription = descriptionInlineTag.getValueByKey(StubInlineTagDefinition.PARAM_VALUE);
    Text tValue = (Text) inlineDescription.getContents().get(0);
    assertEquals(" me", tValue.getText());
}
Also used : Composite(org.eclipse.n4js.jsdoc.dom.Composite) Text(org.eclipse.n4js.jsdoc.dom.Text) ContentNode(org.eclipse.n4js.jsdoc.dom.ContentNode) InlineTag(org.eclipse.n4js.jsdoc.dom.InlineTag) Doclet(org.eclipse.n4js.jsdoc.dom.Doclet) DocletParser(org.eclipse.n4js.jsdoc.DocletParser) TagValue(org.eclipse.n4js.jsdoc.dom.TagValue) Test(org.junit.Test)

Example 8 with TagValue

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

the class JSDocSerializer method caseInlineTag.

@Override
public Boolean caseInlineTag(InlineTag object) {
    strb.append("{").append(JSDocCharScanner.TAG_START).append(object.getTitle().getTitle());
    for (TagValue tagValue : object.getValues()) {
        doSwitch(tagValue);
    }
    strb.append("}");
    return false;
}
Also used : TagValue(org.eclipse.n4js.jsdoc.dom.TagValue)

Example 9 with TagValue

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

the class LineTagTest method testLineTagWithRegion.

@SuppressWarnings("javadoc")
@Test
public void testLineTagWithRegion() {
    String in = "/** foo.\n * @stubLineTagTitle {@region value} \n */";
    AbstractLineTagDefinition tag = new StubLineTagWithRegionDefinition("stubLineTagTitle");
    DocletParser docletParser = new DocletParser(new TagDictionary<>(Arrays.asList(tag)), new TagDictionary<AbstractInlineTagDefinition>());
    Doclet doclet = docletParser.parse(in);
    LineTag lineTag = doclet.getLineTags().get(0);
    TagValue region = lineTag.getValueByKey(StubLineTagWithRegionDefinition.REGION);
    Text strcturedText = (Text) region.getContents().get(0);
    assertEquals("@region value", strcturedText.getText());
}
Also used : LineTag(org.eclipse.n4js.jsdoc.dom.LineTag) Doclet(org.eclipse.n4js.jsdoc.dom.Doclet) DocletParser(org.eclipse.n4js.jsdoc.DocletParser) Text(org.eclipse.n4js.jsdoc.dom.Text) TagValue(org.eclipse.n4js.jsdoc.dom.TagValue) Test(org.junit.Test)

Aggregations

TagValue (org.eclipse.n4js.jsdoc.dom.TagValue)9 Doclet (org.eclipse.n4js.jsdoc.dom.Doclet)6 Text (org.eclipse.n4js.jsdoc.dom.Text)6 Test (org.junit.Test)6 DocletParser (org.eclipse.n4js.jsdoc.DocletParser)4 Composite (org.eclipse.n4js.jsdoc.dom.Composite)3 ContentNode (org.eclipse.n4js.jsdoc.dom.ContentNode)3 InlineTag (org.eclipse.n4js.jsdoc.dom.InlineTag)3 LineTag (org.eclipse.n4js.jsdoc.dom.LineTag)3 AbstractInlineTagDefinition (org.eclipse.n4js.jsdoc.tags.AbstractInlineTagDefinition)2