adding yaml output
This commit is contained in:
parent
06791a0758
commit
25de2c8c3c
|
@ -163,6 +163,19 @@ class RollTable:
|
||||||
self._rows.append(self._column_filter([f'd{face+1}'] + row))
|
self._rows.append(self._column_filter([f'd{face+1}'] + row))
|
||||||
return self._rows
|
return self._rows
|
||||||
|
|
||||||
|
@property
|
||||||
|
def as_markdown(self) -> str:
|
||||||
|
return ''
|
||||||
|
|
||||||
|
@property
|
||||||
|
def as_yaml(self) -> dict:
|
||||||
|
struct = [{'headers': self.rows[0]}]
|
||||||
|
for row in self.rows[1:]:
|
||||||
|
struct.append({
|
||||||
|
row[0]: row[1:]
|
||||||
|
})
|
||||||
|
return yaml.dump(struct)
|
||||||
|
|
||||||
def _config(self):
|
def _config(self):
|
||||||
"""
|
"""
|
||||||
Parse data sources, generate headers, and create the column filters
|
Parse data sources, generate headers, and create the column filters
|
||||||
|
|
|
@ -122,3 +122,8 @@ def test_no_descriptions():
|
||||||
t = tables.RollTable([fixture_no_descriptions], die=1)
|
t = tables.RollTable([fixture_no_descriptions], die=1)
|
||||||
assert 'd1' in str(t)
|
assert 'd1' in str(t)
|
||||||
assert 'option 1' in str(t)
|
assert 'option 1' in str(t)
|
||||||
|
|
||||||
|
|
||||||
|
def test_yaml():
|
||||||
|
t = tables.RollTable([fixture_metadata + fixture_source])
|
||||||
|
print(t.as_yaml)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user