2024-07-22 15:29:39 +08:00
|
|
|
from .segments import Segment
|
2024-07-26 15:03:56 +08:00
|
|
|
from .types import SegmentType
|
2024-07-22 15:29:39 +08:00
|
|
|
|
|
|
|
|
2024-07-26 15:03:56 +08:00
|
|
|
class SegmentGroup(Segment):
|
|
|
|
value_type: SegmentType = SegmentType.GROUP
|
|
|
|
value: list[Segment]
|
2024-07-22 15:29:39 +08:00
|
|
|
|
|
|
|
@property
|
|
|
|
def text(self):
|
2024-09-10 17:00:20 +08:00
|
|
|
return "".join([segment.text for segment in self.value])
|
2024-07-22 15:29:39 +08:00
|
|
|
|
|
|
|
@property
|
|
|
|
def log(self):
|
2024-09-10 17:00:20 +08:00
|
|
|
return "".join([segment.log for segment in self.value])
|
2024-07-22 15:29:39 +08:00
|
|
|
|
|
|
|
@property
|
|
|
|
def markdown(self):
|
2024-09-10 17:00:20 +08:00
|
|
|
return "".join([segment.markdown for segment in self.value])
|
2024-07-26 15:03:56 +08:00
|
|
|
|
|
|
|
def to_object(self):
|
|
|
|
return [segment.to_object() for segment in self.value]
|