@@ -306,13 +306,16 @@ class ContentExample {
306306 '<p><em>italic</em> <a href="https://zulip.com/">zulip</a></p>\n '
307307 '</div></div>' ,
308308 [SpoilerNode (
309- header: [ListNode (ListStyle .ordered, [
310- [ListNode (ListStyle .unordered, [
311- [HeadingNode (level: HeadingLevel .h2, links: null , nodes: [
312- TextNode ('hello' ),
313- ])]
314- ])],
315- ])],
309+ header: [OrderedListNode (
310+ start: 1 ,
311+ items: [
312+ [UnorderedListNode (items: [
313+ [HeadingNode (level: HeadingLevel .h2, links: null , nodes: [
314+ TextNode ('hello' ),
315+ ])]
316+ ])],
317+ ]),
318+ ],
316319 content: [ParagraphNode (links: null , nodes: [
317320 EmphasisNode (nodes: [TextNode ('italic' )]),
318321 TextNode (' ' ),
@@ -763,7 +766,7 @@ class ContentExample {
763766 '<div class="message_inline_image">'
764767 '<a href="https://chat.zulip.org/user_avatars/2/realm/icon.png">'
765768 '<img src="https://chat.zulip.org/user_avatars/2/realm/icon.png"></a></div></li>\n </ul>' , [
766- ListNode ( ListStyle .unordered, [[
769+ UnorderedListNode (items : [[
767770 ImageNodeList ([
768771 ImageNode (srcUrl: 'https://chat.zulip.org/user_avatars/2/realm/icon.png' ,
769772 thumbnailUrl: null , loading: false ,
@@ -785,7 +788,7 @@ class ContentExample {
785788 '<div class="message_inline_image">'
786789 '<a href="https://chat.zulip.org/user_avatars/2/realm/icon.png?version=2" title="icon.png">'
787790 '<img src="https://chat.zulip.org/user_avatars/2/realm/icon.png?version=2"></a></div></li>\n </ul>' , [
788- ListNode ( ListStyle .unordered, [[
791+ UnorderedListNode (items : [[
789792 ParagraphNode (wasImplicit: true , links: null , nodes: [
790793 LinkNode (url: 'https://chat.zulip.org/user_avatars/2/realm/icon.png' , nodes: [TextNode ('icon.png' )]),
791794 TextNode (' ' ),
@@ -814,7 +817,7 @@ class ContentExample {
814817 '<a href="https://chat.zulip.org/user_avatars/2/realm/icon.png" title="icon.png">'
815818 '<img src="https://chat.zulip.org/user_avatars/2/realm/icon.png"></a></div>'
816819 'more text</li>\n </ul>' , [
817- ListNode ( ListStyle .unordered, [[
820+ UnorderedListNode (items : [[
818821 const ParagraphNode (wasImplicit: true , links: null , nodes: [
819822 LinkNode (url: 'https://chat.zulip.org/user_avatars/2/realm/icon.png' , nodes: [TextNode ('icon.png' )]),
820823 TextNode (' ' ),
@@ -1155,6 +1158,32 @@ class ContentExample {
11551158 ], isHeader: false ),
11561159 ]),
11571160 ]);
1161+
1162+ static const orderedListLargeStart = ContentExample (
1163+ 'ordered list with large start number' ,
1164+ '9999. first\n 10000. second' ,
1165+ '<ol start="9999">\n <li>first</li>\n <li>second</li>\n </ol>' ,
1166+ [OrderedListNode (
1167+ start: 9999 ,
1168+ items: [
1169+ [ParagraphNode (wasImplicit: true , links: null , nodes: [TextNode ('first' )])],
1170+ [ParagraphNode (wasImplicit: true , links: null , nodes: [TextNode ('second' )])],
1171+ ])
1172+ ],
1173+ );
1174+
1175+ static const orderedListCustomStart = ContentExample (
1176+ 'ordered list with custom start' ,
1177+ '5. fifth\n 6. sixth' ,
1178+ '<ol start="5">\n <li>fifth</li>\n <li>sixth</li>\n </ol>' ,
1179+ [OrderedListNode (
1180+ start: 5 ,
1181+ items: [
1182+ [ParagraphNode (wasImplicit: true , links: null , nodes: [TextNode ('fifth' )])],
1183+ [ParagraphNode (wasImplicit: true , links: null , nodes: [TextNode ('sixth' )])],
1184+ ])
1185+ ],
1186+ );
11581187}
11591188
11601189UnimplementedBlockContentNode blockUnimplemented (String html) {
@@ -1382,16 +1411,18 @@ void main() {
13821411 testParse ('<ol>' ,
13831412 // "1. first\n2. then"
13841413 '<ol>\n <li>first</li>\n <li>then</li>\n </ol>' , const [
1385- ListNode (ListStyle .ordered, [
1386- [ParagraphNode (wasImplicit: true , links: null , nodes: [TextNode ('first' )])],
1387- [ParagraphNode (wasImplicit: true , links: null , nodes: [TextNode ('then' )])],
1388- ]),
1414+ OrderedListNode (
1415+ start: 1 ,
1416+ items: [
1417+ [ParagraphNode (wasImplicit: true , links: null , nodes: [TextNode ('first' )])],
1418+ [ParagraphNode (wasImplicit: true , links: null , nodes: [TextNode ('then' )])],
1419+ ]),
13891420 ]);
13901421
13911422 testParse ('<ul>' ,
13921423 // "* something\n* another"
13931424 '<ul>\n <li>something</li>\n <li>another</li>\n </ul>' , const [
1394- ListNode ( ListStyle .unordered, [
1425+ UnorderedListNode (items : [
13951426 [ParagraphNode (wasImplicit: true , links: null , nodes: [TextNode ('something' )])],
13961427 [ParagraphNode (wasImplicit: true , links: null , nodes: [TextNode ('another' )])],
13971428 ]),
@@ -1400,7 +1431,7 @@ void main() {
14001431 testParse ('implicit paragraph with internal <br>' ,
14011432 // "* a\n b"
14021433 '<ul>\n <li>a<br>\n b</li>\n </ul>' , const [
1403- ListNode ( ListStyle .unordered, [
1434+ UnorderedListNode (items : [
14041435 [ParagraphNode (wasImplicit: true , links: null , nodes: [
14051436 TextNode ('a' ),
14061437 LineBreakInlineNode (),
@@ -1412,13 +1443,34 @@ void main() {
14121443 testParse ('explicit paragraphs' ,
14131444 // "* a\n\n b"
14141445 '<ul>\n <li>\n <p>a</p>\n <p>b</p>\n </li>\n </ul>' , const [
1415- ListNode ( ListStyle .unordered, [
1446+ UnorderedListNode (items : [
14161447 [
14171448 ParagraphNode (links: null , nodes: [TextNode ('a' )]),
14181449 ParagraphNode (links: null , nodes: [TextNode ('b' )]),
14191450 ],
14201451 ]),
14211452 ]);
1453+
1454+ testParse ('ordered list - large start number (9999)' ,
1455+ // "9999. first\n10000. second"
1456+ '<ol start="9999">\n <li>first</li>\n <li>second</li>\n </ol>' , const [
1457+ OrderedListNode (
1458+ start: 9999 ,
1459+ items: [
1460+ [ParagraphNode (wasImplicit: true , links: null , nodes: [TextNode ('first' )])],
1461+ [ParagraphNode (wasImplicit: true , links: null , nodes: [TextNode ('second' )])],
1462+ ]),
1463+ ]);
1464+
1465+ testParse ('ordered list - custom start (5)' ,
1466+ '<ol start="5">\n <li>fifth</li>\n <li>sixth</li>\n </ol>' , const [
1467+ OrderedListNode (
1468+ start: 5 ,
1469+ items: [
1470+ [ParagraphNode (wasImplicit: true , links: null , nodes: [TextNode ('fifth' )])],
1471+ [ParagraphNode (wasImplicit: true , links: null , nodes: [TextNode ('sixth' )])],
1472+ ]),
1473+ ]);
14221474 });
14231475
14241476 testParseExample (ContentExample .spoilerDefaultHeader);
@@ -1451,7 +1503,7 @@ void main() {
14511503 testParse ('link in list item' ,
14521504 // "* [t](/u)"
14531505 '<ul>\n <li><a href="/u">t</a></li>\n </ul>' , const [
1454- ListNode ( ListStyle .unordered, [
1506+ UnorderedListNode (items : [
14551507 [ParagraphNode (links: null , wasImplicit: true , nodes: [
14561508 LinkNode (url: '/u' , nodes: [TextNode ('t' )]),
14571509 ])],
@@ -1509,10 +1561,12 @@ void main() {
15091561 '<ol>\n <li>\n <blockquote>\n <h6>two</h6>\n <ul>\n <li>three</li>\n '
15101562 '</ul>\n </blockquote>\n <div class="codehilite"><pre><span></span>'
15111563 '<code>four\n </code></pre></div>\n\n </li>\n </ol>' , const [
1512- ListNode (ListStyle .ordered, [[
1564+ OrderedListNode (
1565+ start: 1 ,
1566+ items: [[
15131567 QuotationNode ([
15141568 HeadingNode (level: HeadingLevel .h6, links: null , nodes: [TextNode ('two' )]),
1515- ListNode ( ListStyle .unordered, [[
1569+ UnorderedListNode (items : [[
15161570 ParagraphNode (wasImplicit: true , links: null , nodes: [TextNode ('three' )]),
15171571 ]]),
15181572 ]),
0 commit comments