Пример #1
0
  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();
  }
  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
 public List<Example> actionCells(Example row) {
   return ExampleUtil.asList(row.at(0, 1));
 }