perserve header ordering in yaml output

This commit is contained in:
evilchili 2022-08-13 12:56:58 -07:00
parent c8117cb66c
commit bbe897c944
2 changed files with 2 additions and 2 deletions

View File

@ -1,6 +1,6 @@
[tool.poetry] [tool.poetry]
name = 'dnd-rolltable' name = 'dnd-rolltable'
version = '1.1.4' version = '1.1.5'
license = 'The Unlicense' license = 'The Unlicense'
authors = ['Greg Boyington <evilchili@gmail.com>'] authors = ['Greg Boyington <evilchili@gmail.com>']
description = 'Generate roll tables using weighted random distributions' description = 'Generate roll tables using weighted random distributions'

View File

@ -102,7 +102,7 @@ class RollTable:
cols = row[1:] + [''] * (len(self.headers) - len(row[1:])) cols = row[1:] + [''] * (len(self.headers) - len(row[1:]))
for idx, col in enumerate(cols): for idx, col in enumerate(cols):
struct[row[0]][self.headers[idx] if idx < len(self.headers) else '_'] = col struct[row[0]][self.headers[idx] if idx < len(self.headers) else '_'] = col
return yaml.dump(struct) return yaml.dump(struct, sort_keys=False)
@property @property
def die(self) -> int: def die(self) -> int: