wikitextparser icon indicating copy to clipboard operation
wikitextparser copied to clipboard

Row attributes from a table

Open TrueBrain opened this issue 5 years ago • 0 comments

I might just be completely overlooking this, but is it possible to get the attribute of a row in a table?

import wikitextparser

wtp = wikitextparser.parse('{|\n|- style="background: black;"\n| cell1\n|- style="background: white;"\n| cell2\n|}')
table = wtp.get_tables()[0]
print(table.data())
print(table.cells())

Outputs

[['cell1'], ['cell2']]
[[Cell('\n| cell1')], [Cell('\n| cell2')]]

But no sign of the row attributes. Also in the code I cannot find if this happens. To me it reads it just completely skips everything on the |- line, but I might be overlooking it somewhere else :)

If it is not currently possible, would it be difficult to add this feature?

TrueBrain avatar Oct 18 '20 08:10 TrueBrain