Example #1
0
  private Table fixedTable(Rover rover, String rowbreak) {

    String head = rover.group("head");
    String widths = rover.group("widths");
    String rows = rover.group("rows");

    Table table = new Table(markdown);

    String[] splitted = rows.split(rowbreak);
    if (splitted.length == 1) splitted = rows.split("\n");

    table.columns(COLDEF_P, widths);

    if (head != null) {
      table.addHead(head);
    }

    if (!widths.contains(":"))
      if (head != null) table.alignment(head);
      else table.alignment(splitted[0]);

    for (String row : splitted) {
      table.addRow(row);
    }
    rover.next();
    return table;
  }
Example #2
0
  private Table pipeTable(Rover rover) {
    String head = rover.group("head");
    String widths = rover.group("widths");
    String rows = rover.group("rows");

    Table table = new Table(markdown);
    String[] splitted = rows.split("\n");

    table.columns(COLDEF_P, widths);

    if (head != null) table.addHead(pipeSplit(head));

    for (String row : splitted) table.addRow(pipeSplit(row));

    rover.next();
    return table;
  }