def get_cell_html(cell, highlight):
  """Get html string for a table cell."""
  if highlight:
    color_str = """ class="highlighted" """
  else:
    color_str = ""

  is_header = cell["is_header"]
  cell_symbol = "td"

  if is_header:
    cell_symbol = "th"

  start_marker = "<%s%s>" % (cell_symbol, color_str)
  end_marker = "</%s>" % cell_symbol

  col_span = cell["column_span"]
  row_span = cell["row_span"]
  start_marker = "<%s%s colspan=%d rowspan=%d >" % (cell_symbol, color_str,
                                                    col_span, row_span)

  val = cell["value"]
  cell_html = start_marker + " " + val + " " + end_marker
  return cell_html
Get html string for a table cell.
language/totto/table_to_text_html_utils.py