本文整理了Java中com.sun.javadoc.Doc.commentText()
方法的一些代码示例,展示了Doc.commentText()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Doc.commentText()
方法的具体详情如下:
包路径:com.sun.javadoc.Doc
类名称:Doc
方法名:commentText
[英]Return the text of the comment for this doc item. Tags have been removed.
[中]返回此文档项的注释文本。标签已被删除。
代码示例来源:origin: broadgsa/gatk
/**
* Renders all the help text required for a given name.
* @param resourceText resource text properties
* @param elementName element name to use as the key
* @param element Doc element to process.
*/
private void renderHelpText(final Properties resourceText, final String elementName, final Doc element) {
StringBuilder summaryBuilder = new StringBuilder();
for(Tag tag: element.firstSentenceTags())
summaryBuilder.append(tag.text());
String summary = summaryBuilder.toString();
String description = element.commentText();
// this might seem unnecessary, but the GATK command line program uses this tag to determine the version when running
if(absoluteVersion != null)
resourceText.setProperty(String.format("%s.%s",elementName,VERSION_TAGLET_NAME),absoluteVersion);
// Write out an alternate element summary, if exists.
resourceText.setProperty(String.format("%s.%s",elementName,SUMMARY_TAGLET_NAME),formatText(summary));
// Write out an alternate description, if present.
resourceText.setProperty(String.format("%s.%s",elementName,DESCRIPTION_TAGLET_NAME),formatText(description));
}
代码示例来源:origin: com.gitee.l0km/swift-service-parser
/**
* 输出格式化的注释信息
*
* @param doc
* {@link com.sun.tools.javadoc.ClassDocImpl} 或 {@link com.sun.tools.javadoc.MethodDocImpl}实例
* @param needIndent
* 是否缩进
* @return
*/
public final String formatComment(Doc doc, boolean needIndent) {
Preconditions.checkNotNull(doc, "doc is null");
Type type = typeOfDoc(doc);
StringBuffer buffer = new StringBuffer();
commentText(buffer,doc.commentText(),type);
for (Tag tag : doc.tags()) {
if( ! type.check(excludeTags.get(tag.name())) )
buffer.append(tag.name()).append(" ").append(tag.text()).append('\n');
}
String cmt = buffer.toString();
if (!cmt.isEmpty()) {
cmt = Pattern.compile("\n\\s*", Pattern.MULTILINE).matcher(cmt).replaceAll("\n");
cmt = Pattern.compile("^", Pattern.MULTILINE).matcher(cmt).replaceAll(" * ");
cmt = commentBody.replaceFirst("\n", "$0" + cmt);
if (needIndent)
cmt = Pattern.compile("^", Pattern.MULTILINE).matcher(cmt).replaceAll(indent);
}
return cmt;
}
代码示例来源:origin: io.atlassian.json-schemagen/json-schemagen-scanner
private static String getDocWithIncludes(Doc doc)
{
StringBuilder sb = new StringBuilder();
if (!Strings.isNullOrEmpty(doc.commentText()))
{
for (Tag tag : doc.inlineTags())
{
if (tag.kind().equals(TEXT_TAG))
{
sb.append(P).append(tag.text());
}
else if (tag.kind().equals(SEE_TAG))
{
sb.append(getIncludeFromLink((SeeTag) tag));
}
}
//sb.append(doc.commentText()).append(LS).append(LS);
}
String example = getExamples(doc);
if (!Strings.isNullOrEmpty(example))
{
sb.append(example);
}
return sb.toString();
}
代码示例来源:origin: org.asciidoctor/asciidoclet
/**
* Renders a generic document (class, field, method, etc)
*
* @param doc input
*/
@Override
public void renderDoc(Doc doc) {
// hide text that looks like tags (such as annotations in source code) from Javadoc
doc.setRawCommentText(doc.getRawCommentText().replaceAll("@([A-Z])", "{@literal @}$1"));
StringBuilder buffer = new StringBuilder();
buffer.append(render(doc.commentText(), false));
buffer.append('\n');
for (Tag tag : doc.tags()) {
renderTag(tag, buffer);
buffer.append('\n');
}
doc.setRawCommentText(buffer.toString());
}
代码示例来源:origin: ch.raffael.pegdown-doclet/pegdown-doclet
try {
StringBuilder buf = new StringBuilder();
buf.append(getOptions().toHtml(doc.commentText(), fixLeadingSpaces));
buf.append('\n');
for ( Tag tag : doc.tags() ) {
内容来源于网络,如有侵权,请联系作者删除!