Add a simpler way to query properties.
This commit is contained in:
parent
f1be0c3a72
commit
c522afd290
@ -187,6 +187,13 @@ class Headline:
|
|||||||
else:
|
else:
|
||||||
return list(self.shallow_tags) + self.parent.tags
|
return list(self.shallow_tags) + self.parent.tags
|
||||||
|
|
||||||
|
def get_property(self, name: str, default=None):
|
||||||
|
for prop in self.properties:
|
||||||
|
if prop.key == name:
|
||||||
|
return prop.value
|
||||||
|
|
||||||
|
return default
|
||||||
|
|
||||||
def get_links(self):
|
def get_links(self):
|
||||||
for content in self.contents:
|
for content in self.contents:
|
||||||
yield from get_links_from_content(content)
|
yield from get_links_from_content(content)
|
||||||
|
Loading…
Reference in New Issue
Block a user