(data []byte, columns []CellAlignFlags, header bool)
| 897 | } |
| 898 | |
| 899 | func (p *Markdown) tableRow(data []byte, columns []CellAlignFlags, header bool) { |
| 900 | p.addBlock(TableRow, nil) |
| 901 | i, col := 0, 0 |
| 902 | |
| 903 | if data[i] == '|' && !isBackslashEscaped(data, i) { |
| 904 | i++ |
| 905 | } |
| 906 | |
| 907 | for col = 0; col < len(columns) && i < len(data); col++ { |
| 908 | for i < len(data) && data[i] == ' ' { |
| 909 | i++ |
| 910 | } |
| 911 | |
| 912 | cellStart := i |
| 913 | |
| 914 | for i < len(data) && (data[i] != '|' || isBackslashEscaped(data, i)) && data[i] != '\n' { |
| 915 | i++ |
| 916 | } |
| 917 | |
| 918 | cellEnd := i |
| 919 | |
| 920 | // skip the end-of-cell marker, possibly taking us past end of buffer |
| 921 | i++ |
| 922 | |
| 923 | for cellEnd > cellStart && cellEnd-1 < len(data) && data[cellEnd-1] == ' ' { |
| 924 | cellEnd-- |
| 925 | } |
| 926 | |
| 927 | cell := p.addBlock(TableCell, data[cellStart:cellEnd]) |
| 928 | cell.IsHeader = header |
| 929 | cell.Align = columns[col] |
| 930 | } |
| 931 | |
| 932 | // pad it out with empty columns to get the right number |
| 933 | for ; col < len(columns); col++ { |
| 934 | cell := p.addBlock(TableCell, nil) |
| 935 | cell.IsHeader = header |
| 936 | cell.Align = columns[col] |
| 937 | } |
| 938 | |
| 939 | // silently ignore rows with too many cells |
| 940 | } |
| 941 | |
| 942 | // returns blockquote prefix length |
| 943 | func (p *Markdown) quotePrefix(data []byte) int { |
no test coverage detected