|
31 | 31 | NumberedListItem, |
32 | 32 | NumberedListItemBlock, |
33 | 33 | ) |
| 34 | +from jsondoc.models.block.types.unordered_list import ( |
| 35 | + UnorderedList, |
| 36 | + UnorderedListBlock, |
| 37 | +) |
| 38 | +from jsondoc.models.block.types.ordered_list import ( |
| 39 | + OrderedList, |
| 40 | + OrderedListBlock, |
| 41 | +) |
34 | 42 | from jsondoc.models.block.types.paragraph import Paragraph, ParagraphBlock |
35 | 43 | from jsondoc.models.block.types.quote import Quote, QuoteBlock |
36 | 44 | from jsondoc.models.block.types.rich_text.base import RichTextBase |
@@ -205,6 +213,46 @@ def create_numbered_list_item_block( |
205 | 213 | ) |
206 | 214 |
|
207 | 215 |
|
| 216 | +def create_unordered_list_block( |
| 217 | + children: List[BlockBase] | None = None, |
| 218 | + id: str | None = None, |
| 219 | + created_time=None, |
| 220 | + typeid: bool = False, |
| 221 | +) -> UnorderedListBlock: |
| 222 | + if id is None: |
| 223 | + id = generate_block_id(typeid=typeid) |
| 224 | + if created_time is None: |
| 225 | + created_time = get_current_time() |
| 226 | + |
| 227 | + return UnorderedListBlock( |
| 228 | + id=id, |
| 229 | + created_time=created_time, |
| 230 | + unordered_list=UnorderedList(), |
| 231 | + has_children=children is not None and len(children) > 0, |
| 232 | + children=children or [], |
| 233 | + ) |
| 234 | + |
| 235 | + |
| 236 | +def create_ordered_list_block( |
| 237 | + children: List[BlockBase] | None = None, |
| 238 | + id: str | None = None, |
| 239 | + created_time=None, |
| 240 | + typeid: bool = False, |
| 241 | +) -> OrderedListBlock: |
| 242 | + if id is None: |
| 243 | + id = generate_block_id(typeid=typeid) |
| 244 | + if created_time is None: |
| 245 | + created_time = get_current_time() |
| 246 | + |
| 247 | + return OrderedListBlock( |
| 248 | + id=id, |
| 249 | + created_time=created_time, |
| 250 | + ordered_list=OrderedList(), |
| 251 | + has_children=children is not None and len(children) > 0, |
| 252 | + children=children or [], |
| 253 | + ) |
| 254 | + |
| 255 | + |
208 | 256 | def create_code_block( |
209 | 257 | code: str | None = None, |
210 | 258 | language: str | None = None, |
|
0 commit comments