Skip to content

Commit 8495621

Browse files
committed
Add pandoc.components.Attr.empty method
1 parent 12350c0 commit 8495621

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

quartodoc/pandoc/components.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,13 @@ def __str__(self):
5252

5353
@property
5454
def html(self):
55+
"""
56+
Represent Attr as it would appear in an HTML tag
57+
58+
e.g.
59+
60+
id="id1" class="class1 class2" width="50%" height="50%"
61+
"""
5562
parts = []
5663

5764
if self.identifier:
@@ -66,3 +73,10 @@ def html(self):
6673
" ".join(f'{k}="{v}"' for k, v in self.attributes.items())
6774
)
6875
return " ".join(parts)
76+
77+
@property
78+
def empty(self) -> bool:
79+
"""
80+
Return True if Attr has no content
81+
"""
82+
return not (self.identifier or self.classes or self.attributes)

0 commit comments

Comments
 (0)