当前位置: 首页>>代码示例>>Java>>正文


Java InlineParser类代码示例

本文整理汇总了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);
    }
}
 
开发者ID:noties,项目名称:Markwon,代码行数:20,代码来源:TaskListBlockParser.java

示例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);
  }
}
 
开发者ID:jleyba,项目名称:js-dossier,代码行数:27,代码来源:TableBlockParser.java

示例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);
}
 
开发者ID:atlassian,项目名称:commonmark-java,代码行数:8,代码来源:DocumentParser.java

示例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);
        }
    }
}
 
开发者ID:atlassian,项目名称:commonmark-java,代码行数:39,代码来源:TableBlockParser.java

示例5: parseInlines

import org.commonmark.parser.InlineParser; //导入依赖的package包/类
@Override
public void parseInlines(InlineParser inlineParser) {
}
 
开发者ID:atlassian,项目名称:commonmark-java,代码行数:4,代码来源:YamlFrontMatterBlockParser.java

示例6: parseInlines

import org.commonmark.parser.InlineParser; //导入依赖的package包/类
@Override
public void parseInlines(InlineParser inlineParser) {
    inlineParser.parse(content, block);
}
 
开发者ID:atlassian,项目名称:commonmark-java,代码行数:5,代码来源:HeadingParser.java

示例7: parseInlines

import org.commonmark.parser.InlineParser; //导入依赖的package包/类
@Override
public void parseInlines(InlineParser inlineParser) {
    if (content != null) {
        inlineParser.parse(content.getString(), block);
    }
}
 
开发者ID:atlassian,项目名称:commonmark-java,代码行数:7,代码来源:ParagraphParser.java

示例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;
}
 
开发者ID:jleyba,项目名称:js-dossier,代码行数:47,代码来源:TableBlockParser.java

示例9: parseInlines

import org.commonmark.parser.InlineParser; //导入依赖的package包/类
void parseInlines(InlineParser inlineParser); 
开发者ID:atlassian,项目名称:commonmark-java,代码行数:2,代码来源:BlockParser.java


注:本文中的org.commonmark.parser.InlineParser类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。