本文整理汇总了Java中org.commonmark.node.Text类的典型用法代码示例。如果您正苦于以下问题:Java Text类的具体用法?Java Text怎么用?Java Text使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Text类属于org.commonmark.node包,在下文中一共展示了Text类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: process
import org.commonmark.node.Text; //导入依赖的package包/类
@Override
public void process(Text opener, Text closer, int delimiterUse) {
String singleDelimiter = String.valueOf(getOpeningCharacter());
Node emphasis = delimiterUse == 1
? new Emphasis(singleDelimiter)
: new StrongEmphasis(singleDelimiter + singleDelimiter);
Node tmp = opener.getNext();
while (tmp != null && tmp != closer) {
Node next = tmp.getNext();
emphasis.appendChild(tmp);
tmp = next;
}
opener.insertAfter(emphasis);
}
开发者ID:atlassian,项目名称:commonmark-java,代码行数:17,代码来源:EmphasisDelimiterProcessor.java
示例2: printAttributes
import org.commonmark.node.Text; //导入依赖的package包/类
private void printAttributes(StringBuilder buf, Node node) {
if (node instanceof Text)
printAttribute(buf, "literal", ((Text)node).getLiteral());
else if (node instanceof Code)
printAttribute(buf, "literal", ((Code)node).getLiteral());
else if (node instanceof IndentedCodeBlock)
printAttribute(buf, "literal", ((IndentedCodeBlock)node).getLiteral());
else if (node instanceof FencedCodeBlock)
printAttribute(buf, "literal", ((FencedCodeBlock)node).getLiteral());
else if (node instanceof HtmlBlock)
printAttribute(buf, "literal", ((HtmlBlock)node).getLiteral());
else if (node instanceof HtmlInline)
printAttribute(buf, "literal", ((HtmlInline)node).getLiteral());
else if (node instanceof Link) {
printAttribute(buf, "destination", ((Link)node).getDestination());
printAttribute(buf, "title", ((Link)node).getTitle());
} else if (node instanceof Image) {
printAttribute(buf, "destination", ((Image)node).getDestination());
printAttribute(buf, "title", ((Image)node).getTitle());
} else if (node instanceof Heading)
printAttribute(buf, "level", ((Heading)node).getLevel());
}
开发者ID:JFormDesigner,项目名称:markdown-writer-fx,代码行数:23,代码来源:CommonmarkPreviewRenderer.java
示例3: process
import org.commonmark.node.Text; //导入依赖的package包/类
@Override public void process(Text opener, Text closer, int delimiterCount) {
Node emoji = new Emoji();
Node tmp = opener.getNext();
while (tmp != null && tmp != closer) {
Node next = tmp.getNext();
emoji.appendChild(tmp);
tmp = next;
}
opener.insertAfter(emoji);
}
开发者ID:duyp,项目名称:mvvm-template,代码行数:11,代码来源:EmojiDelimiterProcessor.java
示例4: process
import org.commonmark.node.Text; //导入依赖的package包/类
@Override public void process(Text opener, Text closer, int delimiterCount) {
Node mention = new Mention();
Node tmp = opener.getNext();
while (tmp != null && tmp != closer) {
Node next = tmp.getNext();
mention.appendChild(tmp);
tmp = next;
}
opener.insertAfter(mention);
}
开发者ID:duyp,项目名称:mvvm-template,代码行数:11,代码来源:MentionDelimiterProcessor.java
示例5: linkify
import org.commonmark.node.Text; //导入依赖的package包/类
private void linkify(Text text) {
String literal = text.getLiteral();
Iterable<LinkSpan> links = linkExtractor.extractLinks(literal);
Node lastNode = text;
int last = 0;
for (LinkSpan link : links) {
String linkText = literal.substring(link.getBeginIndex(), link.getEndIndex());
if (link.getBeginIndex() != last) {
lastNode = insertNode(new Text(literal.substring(last, link.getBeginIndex())), lastNode);
}
Text contentNode = new Text(linkText);
String destination = getDestination(link, linkText);
if (destination.endsWith("jpg") || destination.endsWith("png") ||
destination.endsWith("gif") || destination.endsWith("jpeg")) {
Image imageNode = new Image(destination, null);
imageNode.appendChild(contentNode);
lastNode = insertNode(imageNode, lastNode);
last = link.getEndIndex();
}else{
Link linkNode = new Link(destination, null);
linkNode.appendChild(contentNode);
lastNode = insertNode(linkNode, lastNode);
last = link.getEndIndex();
}
}
if (last != literal.length()) {
insertNode(new Text(literal.substring(last)), lastNode);
}
text.unlink();
}
开发者ID:razem-io,项目名称:Steemit-App,代码行数:36,代码来源:AutoMediaPostProcessor.java
示例6: process
import org.commonmark.node.Text; //导入依赖的package包/类
@Override
public void process(Text opener, Text closer, int delimiterCount) {
// Wrap nodes between delimiters in marks.
Node marks = new Mark();
Node tmp = opener.getNext();
while (tmp != null && tmp != closer) {
Node next = tmp.getNext();
marks.appendChild(tmp);
tmp = next;
}
opener.insertAfter(marks);
}
开发者ID:tidyjava,项目名称:blogging-platform,代码行数:15,代码来源:MarkDelimiterProcessor.java
示例7: process
import org.commonmark.node.Text; //导入依赖的package包/类
@Override
public void process(Text opener, Text closer, int delimiterCount) {
// Wrap nodes between delimiters in strikethrough.
Node strikethrough = new Strikethrough();
Node tmp = opener.getNext();
while (tmp != null && tmp != closer) {
Node next = tmp.getNext();
strikethrough.appendChild(tmp);
tmp = next;
}
opener.insertAfter(strikethrough);
}
开发者ID:atlassian,项目名称:commonmark-java,代码行数:15,代码来源:StrikethroughDelimiterProcessor.java
示例8: process
import org.commonmark.node.Text; //导入依赖的package包/类
@Override
public void process(Text opener, Text closer, int delimiterCount) {
// Wrap nodes between delimiters in ins.
Node ins = new Ins();
Node tmp = opener.getNext();
while (tmp != null && tmp != closer) {
Node next = tmp.getNext();
ins.appendChild(tmp);
tmp = next;
}
opener.insertAfter(ins);
}
开发者ID:atlassian,项目名称:commonmark-java,代码行数:15,代码来源:InsDelimiterProcessor.java
示例9: Delimiter
import org.commonmark.node.Text; //导入依赖的package包/类
public Delimiter(Text node, char delimiterChar, boolean canOpen, boolean canClose, Delimiter previous) {
this.node = node;
this.delimiterChar = delimiterChar;
this.canOpen = canOpen;
this.canClose = canClose;
this.previous = previous;
}
开发者ID:atlassian,项目名称:commonmark-java,代码行数:8,代码来源:Delimiter.java
示例10: Bracket
import org.commonmark.node.Text; //导入依赖的package包/类
private Bracket(Text node, int index, Bracket previous, Delimiter previousDelimiter, boolean image) {
this.node = node;
this.index = index;
this.image = image;
this.previous = previous;
this.previousDelimiter = previousDelimiter;
}
开发者ID:atlassian,项目名称:commonmark-java,代码行数:8,代码来源:Bracket.java
示例11: process
import org.commonmark.node.Text; //导入依赖的package包/类
@Override
public void process(Text opener, Text closer, int delimiterUse) {
UpperCaseNode content = new UpperCaseNode();
Node tmp = opener.getNext();
while (tmp != null && tmp != closer) {
Node next = tmp.getNext();
content.appendChild(tmp);
tmp = next;
}
opener.insertAfter(content);
}
开发者ID:atlassian,项目名称:commonmark-java,代码行数:12,代码来源:DelimiterProcessorTest.java
示例12: render
import org.commonmark.node.Text; //导入依赖的package包/类
@Override
public void render(Node node) {
UpperCaseNode upperCaseNode = (UpperCaseNode) node;
for (Node child = upperCaseNode.getFirstChild(); child != null; child = child.getNext()) {
if (child instanceof Text) {
Text text = (Text) child;
text.setLiteral(text.getLiteral().toUpperCase(Locale.ENGLISH));
}
context.render(child);
}
}
开发者ID:atlassian,项目名称:commonmark-java,代码行数:12,代码来源:DelimiterProcessorTest.java
示例13: visit
import org.commonmark.node.Text; //导入依赖的package包/类
@Override
public void visit(Text text) {
builder.append(text.getLiteral());
}
开发者ID:noties,项目名称:Markwon,代码行数:5,代码来源:SpannableMarkdownVisitor.java
示例14: visit
import org.commonmark.node.Text; //导入依赖的package包/类
@Override
public void visit(Text text) {
if (inLink == 0) {
linkify(text);
}
}
开发者ID:razem-io,项目名称:Steemit-App,代码行数:7,代码来源:AutoMediaPostProcessor.java
示例15: visit
import org.commonmark.node.Text; //导入依赖的package包/类
@Override
public void visit(Text text) {
sb.append(text.getLiteral());
}
开发者ID:mattsheppard,项目名称:markdown-static-site-generator,代码行数:5,代码来源:MarkdownTextVisitor.java
示例16: process
import org.commonmark.node.Text; //导入依赖的package包/类
@Override
public void process(Text opener, Text closer, int delimiterUse) {
findProcessor(delimiterUse).process(opener, closer, delimiterUse);
}
开发者ID:atlassian,项目名称:commonmark-java,代码行数:5,代码来源:StaggeredDelimiterProcessor.java
示例17: link
import org.commonmark.node.Text; //导入依赖的package包/类
static public Bracket link(Text node, int index, Bracket previous, Delimiter previousDelimiter) {
return new Bracket(node, index, previous, previousDelimiter, false);
}
开发者ID:atlassian,项目名称:commonmark-java,代码行数:4,代码来源:Bracket.java
示例18: image
import org.commonmark.node.Text; //导入依赖的package包/类
static public Bracket image(Text node, int index, Bracket previous, Delimiter previousDelimiter) {
return new Bracket(node, index, previous, previousDelimiter, true);
}
开发者ID:atlassian,项目名称:commonmark-java,代码行数:4,代码来源:Bracket.java
示例19: process
import org.commonmark.node.Text; //导入依赖的package包/类
/**
* Process the matched delimiters, e.g. by wrapping the nodes between opener and closer in a new node, or appending
* a new node after the opener.
* <p>
* Note that removal of the delimiter from the delimiter nodes and unlinking them is done by the caller.
*
* @param opener the text node that contained the opening delimiter
* @param closer the text node that contained the closing delimiter
* @param delimiterUse the number of delimiters that were used
*/
void process(Text opener, Text closer, int delimiterUse);
开发者ID:atlassian,项目名称:commonmark-java,代码行数:12,代码来源:DelimiterProcessor.java
注:本文中的org.commonmark.node.Text类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论