Skip to content

Commit

Permalink
Merge pull request #18 from JasperVanDenBosch/node-title
Browse files Browse the repository at this point in the history
Nodes have a title property to format the node name nicely
  • Loading branch information
JasperVanDenBosch authored Oct 9, 2024
2 parents 70627ba + 9129ae9 commit 76b51bd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "syrinx"
version = "0.0.6"
version = "0.0.7"
authors = [
{ name="Jasper van den Bosch"},
]
Expand Down
4 changes: 4 additions & 0 deletions syrinx/read.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ def __init__(self):
self.branches = []
self.sequenceNumber = SYS_MAX_SIZE

@property
def title(self) -> str:
return self.name.replace('_', ' ').title()

def reorder_children(node: ContentNode):
node.leaves = sorted(node.leaves, key=lambda n: (n.sequenceNumber, n.name))
node.branches = sorted(node.branches, key=lambda n: (n.sequenceNumber, n.name))
Expand Down

0 comments on commit 76b51bd

Please sign in to comment.