コード例 #1
0
ファイル: Rows.java プロジェクト: Koulio/greenpepper
  public static String toMarkup(Example example, boolean prettyPrint, MarkupPrinter printer) {
    StringBuilder sb = new StringBuilder();
    if (example.hasChild()) sb.append(Cells.toMarkup(example.firstChild(), prettyPrint, printer));
    else sb.append(EMPTY);

    if (example.hasSibling()) {
      sb.append("\n");
      sb.append(toMarkup(example.nextSibling(), prettyPrint, printer));
    }
    return sb.toString();
  }
コード例 #2
0
  public String interpretedElements() {
    CommentTableFilter ctf = new CommentTableFilter();
    Example tableToFilter = Tables.parse(documentContent);
    StringBuilder ret = new StringBuilder();
    boolean none = true;

    while (tableToFilter != null) {
      if (!ctf.canFilter(tableToFilter)) {
        ret.append(tableToFilter.firstChild().toString());
        tableToFilter = tableToFilter.nextSibling();
        none = false;
      } else {
        tableToFilter = ctf.filter(tableToFilter);
      }
    }

    if (none) {
      return "none";
    }
    return ret.toString();
  }
コード例 #3
0
  public void testSkipsInformativeSections() {
    Example tables =
        parse(
            "[First table]\n"
                + "****\n"
                + "[Begin Info]\n"
                + "****\n"
                + "[Should be skipped]\n"
                + "****\n"
                + "[End Info]\n"
                + "****\n"
                + "[Next table]\n"
                + "****\n"
                + "[Begin Info]\n"
                + "****\n"
                + "[Should be skipped too]\n"
                + "****\n"
                + "[End Info]\n"
                + "****\n"
                + "[Begin Info]\n"
                + "****\n"
                + "[Should be skipped]\n"
                + "****\n"
                + "[End Info]\n"
                + "****\n"
                + "[Last table]");

    assertEquals("First table", tables.at(0, 0, 0).getContent());
    tables = filter.filter(tables.nextSibling());
    assertEquals("Next table", tables.at(0, 0, 0).getContent());
    tables = filter.filter(tables.nextSibling());
    tables = filter.filter(tables);
    assertEquals("Last table", tables.at(0, 0, 0).getContent());
  }
コード例 #4
0
ファイル: InterpretRow.java プロジェクト: Koulio/greenpepper
 public List<Example> actionCells(Example row) {
   return ExampleUtil.asList(row.at(0, 1));
 }