Skip to content

Commit de37e6a

Browse files
committed
Undo changes to python and schema dirs
1 parent 4822048 commit de37e6a

File tree

10 files changed

+985
-353
lines changed

10 files changed

+985
-353
lines changed

python/jsondoc/convert/html.py

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@
2525
create_h3_block,
2626
create_image_block,
2727
create_numbered_list_item_block,
28-
create_unordered_list_block,
29-
create_ordered_list_block,
3028
create_page,
3129
create_paragraph_block,
3230
create_quote_block,
@@ -758,29 +756,15 @@ def convert_img(self, el, convert_as_inline):
758756
)
759757
)
760758

761-
def convert_ul(self, el, convert_as_inline):
759+
def convert_list(self, el, convert_as_inline):
762760
"""
763-
This is applied to <ul> tags. Create an unordered_list container block.
764-
Children will be processed and added to this container.
761+
This is applied to <ul> and <ol> tags. We simply return None, because
762+
there is no need for a container block for list items in JSON-DOC.
765763
"""
766-
if convert_as_inline:
767-
return ConvertOutput(main_object=create_rich_text())
768-
769-
return ConvertOutput(
770-
main_object=create_unordered_list_block(typeid=self.options.typeid)
771-
)
772-
773-
def convert_ol(self, el, convert_as_inline):
774-
"""
775-
This is applied to <ol> tags. Create an ordered_list container block.
776-
Children will be processed and added to this container.
777-
"""
778-
if convert_as_inline:
779-
return ConvertOutput(main_object=create_rich_text())
764+
return None
780765

781-
return ConvertOutput(
782-
main_object=create_ordered_list_block(typeid=self.options.typeid)
783-
)
766+
convert_ul = convert_list
767+
convert_ol = convert_list
784768

785769
def convert_li(self, el, convert_as_inline):
786770
parent = el.parent

python/jsondoc/convert/utils.py

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,6 @@
3131
NumberedListItem,
3232
NumberedListItemBlock,
3333
)
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-
)
4234
from jsondoc.models.block.types.paragraph import Paragraph, ParagraphBlock
4335
from jsondoc.models.block.types.quote import Quote, QuoteBlock
4436
from jsondoc.models.block.types.rich_text.base import RichTextBase
@@ -213,46 +205,6 @@ def create_numbered_list_item_block(
213205
)
214206

215207

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-
256208
def create_code_block(
257209
code: str | None = None,
258210
language: str | None = None,

python/jsondoc/models/block/types/ordered_list/__init__.py

Lines changed: 0 additions & 28 deletions
This file was deleted.

python/jsondoc/models/block/types/unordered_list/__init__.py

Lines changed: 0 additions & 28 deletions
This file was deleted.

python/jsondoc/rules.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
from jsondoc.models.block.types.heading_3 import Heading3Block
1212
from jsondoc.models.block.types.image import ImageBlock
1313
from jsondoc.models.block.types.numbered_list_item import NumberedListItemBlock
14-
from jsondoc.models.block.types.unordered_list import UnorderedListBlock
15-
from jsondoc.models.block.types.ordered_list import OrderedListBlock
1614
from jsondoc.models.block.types.paragraph import ParagraphBlock
1715
from jsondoc.models.block.types.quote import QuoteBlock
1816
from jsondoc.models.block.types.table import TableBlock
@@ -35,8 +33,6 @@
3533
Heading3Block,
3634
ImageBlock,
3735
NumberedListItemBlock,
38-
UnorderedListBlock,
39-
OrderedListBlock,
4036
ParagraphBlock,
4137
QuoteBlock,
4238
TableBlock,
@@ -57,8 +53,6 @@
5753
Heading3Block: [],
5854
ImageBlock: [],
5955
NumberedListItemBlock: ALL_BLOCK_TYPES,
60-
UnorderedListBlock: [BulletedListItemBlock],
61-
OrderedListBlock: [NumberedListItemBlock],
6256
ParagraphBlock: ALL_BLOCK_TYPES,
6357
QuoteBlock: ALL_BLOCK_TYPES,
6458
TableBlock: [TableRowBlock],

0 commit comments

Comments
 (0)