本文整理汇总了Java中org.commonmark.parser.InlineParser类的典型用法代码示例。如果您正苦于以下问题:Java InlineParser类的具体用法?Java InlineParser怎么用?Java InlineParser使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
InlineParser类属于org.commonmark.parser包,在下文中一共展示了InlineParser类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parseInlines
import org.commonmark.parser.InlineParser; //导入依赖的package包/类
@Override
public void parseInlines(InlineParser inlineParser) {
Matcher matcher;
TaskListItem listItem;
for (Item item : items) {
matcher = PATTERN.matcher(item.line);
if (!matcher.matches()) {
continue;
}
listItem = new TaskListItem()
.done(isDone(matcher.group(1)))
.indent(item.indent / 2);
inlineParser.parse(matcher.group(2), listItem);
block.appendChild(listItem);
}
}
示例2: parseInlines
import org.commonmark.parser.InlineParser; //导入依赖的package包/类
@Override
public void parseInlines(InlineParser inlineParser) {
Node headNode = new TableHeadNode();
block.appendChild(headNode);
headNode.appendChild(parseRow(headerRow.toString(), inlineParser));
// The first row of data is always the column alignments, which we've already parsed.
Node bodyNode = new TableBodyNode();
block.appendChild(bodyNode);
String caption = null;
for (CharSequence line : Iterables.skip(rowData, 1)) {
Matcher captionMatcher = CAPTION_LINE.matcher(line);
if (captionMatcher.matches()) {
caption = captionMatcher.group("content").trim();
} else {
TableRowNode row = parseRow(line.toString(), inlineParser);
bodyNode.appendChild(row);
}
}
if (!isNullOrEmpty(caption)) {
TableCaptionNode captionNode = new TableCaptionNode();
headNode.insertBefore(captionNode);
inlineParser.parse(caption.trim(), captionNode);
}
}
示例3: DocumentParser
import org.commonmark.parser.InlineParser; //导入依赖的package包/类
public DocumentParser(List<BlockParserFactory> blockParserFactories, InlineParser inlineParser) {
this.blockParserFactories = blockParserFactories;
this.inlineParser = inlineParser;
this.documentBlockParser = new DocumentBlockParser();
activateBlockParser(this.documentBlockParser);
}
示例4: parseInlines
import org.commonmark.parser.InlineParser; //导入依赖的package包/类
@Override
public void parseInlines(InlineParser inlineParser) {
Node section = new TableHead();
block.appendChild(section);
List<TableCell.Alignment> alignments = parseAlignment(separatorLine);
int headerColumns = -1;
boolean header = true;
for (CharSequence rowLine : rowLines) {
List<String> cells = split(rowLine);
TableRow tableRow = new TableRow();
if (headerColumns == -1) {
headerColumns = cells.size();
}
// Body can not have more columns than head
for (int i = 0; i < headerColumns; i++) {
String cell = i < cells.size() ? cells.get(i) : "";
TableCell.Alignment alignment = i < alignments.size() ? alignments.get(i) : null;
TableCell tableCell = new TableCell();
tableCell.setHeader(header);
tableCell.setAlignment(alignment);
inlineParser.parse(cell.trim(), tableCell);
tableRow.appendChild(tableCell);
}
section.appendChild(tableRow);
if (header) {
// Format allows only one row in head
header = false;
section = new TableBody();
block.appendChild(section);
}
}
}
示例5: parseInlines
import org.commonmark.parser.InlineParser; //导入依赖的package包/类
@Override
public void parseInlines(InlineParser inlineParser) {
}
示例6: parseInlines
import org.commonmark.parser.InlineParser; //导入依赖的package包/类
@Override
public void parseInlines(InlineParser inlineParser) {
inlineParser.parse(content, block);
}
示例7: parseInlines
import org.commonmark.parser.InlineParser; //导入依赖的package包/类
@Override
public void parseInlines(InlineParser inlineParser) {
if (content != null) {
inlineParser.parse(content.getString(), block);
}
}
示例8: parseRow
import org.commonmark.parser.InlineParser; //导入依赖的package包/类
private TableRowNode parseRow(String rowStr, InlineParser inlineParser) {
rowStr = rowStr.trim();
if (rowStr.startsWith("|")) {
rowStr = rowStr.substring(1);
}
TableRowNode row = new TableRowNode();
boolean isEscaped = false;
int currentColumn = 0;
CharBuffer data = CharBuffer.wrap(rowStr);
for (int index = 0; data.hasRemaining(); index++) {
if (isEscaped) {
isEscaped = false;
continue;
}
char c = data.charAt(index);
if (c == '\\') {
isEscaped = true;
continue;
}
if (c == '|' || (index + 1) >= data.remaining()) {
int end = c == '|' ? index : index + 1;
String content = data.subSequence(0, end).toString();
data.position(data.position() + end);
int colSpan = 0;
while (data.hasRemaining() && data.charAt(0) == '|') {
colSpan++;
data.position(data.position() + 1);
}
index = -1; // Account for post-forloop increment.
Alignment alignment =
currentColumn < columns.size() ? columns.get(currentColumn) : Alignment.NONE;
currentColumn += colSpan;
TableCellNode cell = new TableCellNode(colSpan, alignment);
inlineParser.parse(content.trim(), cell);
row.appendChild(cell);
}
}
return row;
}
示例9: parseInlines
import org.commonmark.parser.InlineParser; //导入依赖的package包/类
void parseInlines(InlineParser inlineParser);