shawnbot/html-table-stream

Write a better algorithm for "flattening" spanning cells

開放

#2 建立於 2015年4月2日

 (0 則留言) (0 個反應) (1 位負責人)HTML (1 個分叉)github user discovery
help wanted

倉庫指標

星標
 (6 顆星)
PR 合併指標
 (30 天內沒有已合併 PR)

描述

The current one for column headers works well for this table, but I need more examples. Also, there is currently zero support for data cells with colspan or rowspan attributes.

Tests should cover:

  • Spanning column headers. E.g. for this table the last three columns should be parsed as "Week Ending Mar 27", "Week Ending Mar 20", and "2015 Feb":

    image

  • Whitespace: <br> should be treated as space, whitespace trimmed from the left and right, and all other whitespace collapsed into single spaces.

  • Spanning data cells. If a <td> has colspan="2" then the resulting row object should have that cell's text value for both of the keys of the columns it spans. Likewise, if it has rowspan="2", then the following row should "inherit" this row's value for this column.

貢獻者指南