Exemple #1
0
  private Table tables(Rover rover) {
    if (rover.at(SIMPLE_TABLE_P) || rover.at(MULTILINE_P)) return fixedTable(rover, "\n\n");

    if (rover.at(GRID_P)) return fixedTable(rover, "\\+(-+\\+)+ *\n");

    if (rover.at(PIPE_P)) return pipeTable(rover);

    return null;
  }
Exemple #2
0
  @Override
  public Block process(Rover rover) throws Exception {
    if (rover.at(TABLE_EXT_P) || rover.at(CAPTION_P)) {
      String caption = rover.group("caption");
      rover.next();
      Table table = tables(rover);
      if (table != null) {
        table.setCaption(caption);
        return table;
      }
      rover.error("Table extension found but no table pattern matched");
    } else {
      Table table = tables(rover);
      if (table != null) {
        if (rover.at(CAPTION_P)) {
          table.setCaption(rover.group("caption"));
          rover.consume();
        }
        return table;
      }
    }

    return null;
  }