當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。