@@ -306,13 +306,16 @@ class ContentExample {
306
306
'<p><em>italic</em> <a href="https://zulip.com/">zulip</a></p>\n '
307
307
'</div></div>' ,
308
308
[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
+ ],
316
319
content: [ParagraphNode (links: null , nodes: [
317
320
EmphasisNode (nodes: [TextNode ('italic' )]),
318
321
TextNode (' ' ),
@@ -763,7 +766,7 @@ class ContentExample {
763
766
'<div class="message_inline_image">'
764
767
'<a href="https://chat.zulip.org/user_avatars/2/realm/icon.png">'
765
768
'<img src="https://chat.zulip.org/user_avatars/2/realm/icon.png"></a></div></li>\n </ul>' , [
766
- ListNode ( ListStyle .unordered, [[
769
+ UnorderedListNode (items : [[
767
770
ImageNodeList ([
768
771
ImageNode (srcUrl: 'https://chat.zulip.org/user_avatars/2/realm/icon.png' ,
769
772
thumbnailUrl: null , loading: false ,
@@ -785,7 +788,7 @@ class ContentExample {
785
788
'<div class="message_inline_image">'
786
789
'<a href="https://chat.zulip.org/user_avatars/2/realm/icon.png?version=2" title="icon.png">'
787
790
'<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 : [[
789
792
ParagraphNode (wasImplicit: true , links: null , nodes: [
790
793
LinkNode (url: 'https://chat.zulip.org/user_avatars/2/realm/icon.png' , nodes: [TextNode ('icon.png' )]),
791
794
TextNode (' ' ),
@@ -814,7 +817,7 @@ class ContentExample {
814
817
'<a href="https://chat.zulip.org/user_avatars/2/realm/icon.png" title="icon.png">'
815
818
'<img src="https://chat.zulip.org/user_avatars/2/realm/icon.png"></a></div>'
816
819
'more text</li>\n </ul>' , [
817
- ListNode ( ListStyle .unordered, [[
820
+ UnorderedListNode (items : [[
818
821
const ParagraphNode (wasImplicit: true , links: null , nodes: [
819
822
LinkNode (url: 'https://chat.zulip.org/user_avatars/2/realm/icon.png' , nodes: [TextNode ('icon.png' )]),
820
823
TextNode (' ' ),
@@ -1155,6 +1158,32 @@ class ContentExample {
1155
1158
], isHeader: false ),
1156
1159
]),
1157
1160
]);
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
+ );
1158
1187
}
1159
1188
1160
1189
UnimplementedBlockContentNode blockUnimplemented (String html) {
@@ -1382,16 +1411,18 @@ void main() {
1382
1411
testParse ('<ol>' ,
1383
1412
// "1. first\n2. then"
1384
1413
'<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
+ ]),
1389
1420
]);
1390
1421
1391
1422
testParse ('<ul>' ,
1392
1423
// "* something\n* another"
1393
1424
'<ul>\n <li>something</li>\n <li>another</li>\n </ul>' , const [
1394
- ListNode ( ListStyle .unordered, [
1425
+ UnorderedListNode (items : [
1395
1426
[ParagraphNode (wasImplicit: true , links: null , nodes: [TextNode ('something' )])],
1396
1427
[ParagraphNode (wasImplicit: true , links: null , nodes: [TextNode ('another' )])],
1397
1428
]),
@@ -1400,7 +1431,7 @@ void main() {
1400
1431
testParse ('implicit paragraph with internal <br>' ,
1401
1432
// "* a\n b"
1402
1433
'<ul>\n <li>a<br>\n b</li>\n </ul>' , const [
1403
- ListNode ( ListStyle .unordered, [
1434
+ UnorderedListNode (items : [
1404
1435
[ParagraphNode (wasImplicit: true , links: null , nodes: [
1405
1436
TextNode ('a' ),
1406
1437
LineBreakInlineNode (),
@@ -1412,13 +1443,34 @@ void main() {
1412
1443
testParse ('explicit paragraphs' ,
1413
1444
// "* a\n\n b"
1414
1445
'<ul>\n <li>\n <p>a</p>\n <p>b</p>\n </li>\n </ul>' , const [
1415
- ListNode ( ListStyle .unordered, [
1446
+ UnorderedListNode (items : [
1416
1447
[
1417
1448
ParagraphNode (links: null , nodes: [TextNode ('a' )]),
1418
1449
ParagraphNode (links: null , nodes: [TextNode ('b' )]),
1419
1450
],
1420
1451
]),
1421
1452
]);
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
+ ]);
1422
1474
});
1423
1475
1424
1476
testParseExample (ContentExample .spoilerDefaultHeader);
@@ -1451,7 +1503,7 @@ void main() {
1451
1503
testParse ('link in list item' ,
1452
1504
// "* [t](/u)"
1453
1505
'<ul>\n <li><a href="/u">t</a></li>\n </ul>' , const [
1454
- ListNode ( ListStyle .unordered, [
1506
+ UnorderedListNode (items : [
1455
1507
[ParagraphNode (links: null , wasImplicit: true , nodes: [
1456
1508
LinkNode (url: '/u' , nodes: [TextNode ('t' )]),
1457
1509
])],
@@ -1509,10 +1561,12 @@ void main() {
1509
1561
'<ol>\n <li>\n <blockquote>\n <h6>two</h6>\n <ul>\n <li>three</li>\n '
1510
1562
'</ul>\n </blockquote>\n <div class="codehilite"><pre><span></span>'
1511
1563
'<code>four\n </code></pre></div>\n\n </li>\n </ol>' , const [
1512
- ListNode (ListStyle .ordered, [[
1564
+ OrderedListNode (
1565
+ start: 1 ,
1566
+ items: [[
1513
1567
QuotationNode ([
1514
1568
HeadingNode (level: HeadingLevel .h6, links: null , nodes: [TextNode ('two' )]),
1515
- ListNode ( ListStyle .unordered, [[
1569
+ UnorderedListNode (items : [[
1516
1570
ParagraphNode (wasImplicit: true , links: null , nodes: [TextNode ('three' )]),
1517
1571
]]),
1518
1572
]),
0 commit comments