Java Code Examples for com.github.javaparser.javadoc.description.JavadocDescription#getElements()

The following examples show how to use com.github.javaparser.javadoc.description.JavadocDescription#getElements() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AutoDoc.java    From joyqueue with Apache License 2.0 5 votes vote down vote up
/**
 * JavadocDescription toString
 **/
private void toString(JavadocDescription description, StringBuilder content) {
    for (JavadocDescriptionElement e : description.getElements()) {
        content.append(e.toText()).append(",");
    }
    if (content.length() > 0) {
        content.deleteCharAt(content.length() - 1);
    }
}
 
Example 2
Source File: JavaDocParser.java    From quarkus with Apache License 2.0 5 votes vote down vote up
private String htmlJavadocToAsciidoc(JavadocDescription javadocDescription) {
    StringBuilder sb = new StringBuilder();

    for (JavadocDescriptionElement javadocDescriptionElement : javadocDescription.getElements()) {
        if (javadocDescriptionElement instanceof JavadocInlineTag) {
            JavadocInlineTag inlineTag = (JavadocInlineTag) javadocDescriptionElement;
            String content = inlineTag.getContent().trim();
            switch (inlineTag.getType()) {
                case CODE:
                case VALUE:
                case LITERAL:
                case SYSTEM_PROPERTY:
                    sb.append('`');
                    appendEscapedAsciiDoc(sb, content);
                    sb.append('`');
                    break;
                case LINK:
                case LINKPLAIN:
                    if (content.startsWith(HASH)) {
                        content = hyphenate(content.substring(1));
                    }
                    sb.append('`');
                    appendEscapedAsciiDoc(sb, content);
                    sb.append('`');
                    break;
                default:
                    sb.append(content);
                    break;
            }
        } else {
            appendHtml(sb, Jsoup.parseBodyFragment(javadocDescriptionElement.toText()));
        }
    }

    return sb.toString().trim();
}