@financial-times/cp-content-pipeline-schema 3.13.0 → 3.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +39 -0
- package/lib/datasources/origami-image.js +2 -2
- package/lib/datasources/origami-image.js.map +1 -1
- package/lib/datasources/url-management.js +45 -7
- package/lib/datasources/url-management.js.map +1 -1
- package/lib/datasources/url-management.test.js +97 -0
- package/lib/datasources/url-management.test.js.map +1 -1
- package/lib/model/Concept.js +7 -1
- package/lib/model/Concept.js.map +1 -1
- package/lib/model/Content.js +6 -1
- package/lib/model/Content.js.map +1 -1
- package/lib/model/Image.test.js +3 -3
- package/lib/model/RichText.test.js +9 -9
- package/lib/resolvers/content-tree/bodyXMLToTree.test.js +179 -176
- package/lib/resolvers/content-tree/bodyXMLToTree.test.js.map +1 -1
- package/lib/resolvers/content-tree/tagMappings.js +7 -0
- package/lib/resolvers/content-tree/tagMappings.js.map +1 -1
- package/package.json +4 -4
- package/src/datasources/origami-image.ts +2 -2
- package/src/datasources/url-management.test.ts +126 -0
- package/src/datasources/url-management.ts +48 -8
- package/src/model/Concept.ts +7 -1
- package/src/model/Content.ts +6 -1
- package/src/model/Image.test.ts +3 -3
- package/src/model/RichText.test.ts +9 -9
- package/src/model/__snapshots__/Byline.test.ts.snap +99 -99
- package/src/model/__snapshots__/RichText.test.ts.snap +326 -306
- package/src/resolvers/content-tree/bodyXMLToTree.test.ts +179 -176
- package/src/resolvers/content-tree/tagMappings.ts +7 -0
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -29,11 +29,11 @@ describe('bodyXMLToTree', () => {
|
|
|
29
29
|
it('converts XML to tree', () => {
|
|
30
30
|
const xml = `<body><p>Hello world</p></body>`
|
|
31
31
|
expect(bodyXMLToTree(xml, tags, mockContext)).toMatchInlineSnapshot(`
|
|
32
|
-
|
|
33
|
-
"children":
|
|
34
|
-
|
|
35
|
-
"children":
|
|
36
|
-
|
|
32
|
+
{
|
|
33
|
+
"children": [
|
|
34
|
+
{
|
|
35
|
+
"children": [
|
|
36
|
+
{
|
|
37
37
|
"type": "text",
|
|
38
38
|
"value": "Hello world",
|
|
39
39
|
},
|
|
@@ -82,17 +82,17 @@ describe('bodyXMLToTree', () => {
|
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
expect(bodyXMLToTree(xml, tags)).toMatchInlineSnapshot(`
|
|
85
|
-
|
|
86
|
-
"children":
|
|
87
|
-
|
|
85
|
+
{
|
|
86
|
+
"children": [
|
|
87
|
+
{
|
|
88
88
|
"id": "id",
|
|
89
89
|
"type": "image-set",
|
|
90
90
|
},
|
|
91
|
-
|
|
92
|
-
"children":
|
|
93
|
-
|
|
94
|
-
"children":
|
|
95
|
-
|
|
91
|
+
{
|
|
92
|
+
"children": [
|
|
93
|
+
{
|
|
94
|
+
"children": [
|
|
95
|
+
{
|
|
96
96
|
"alt": "alt",
|
|
97
97
|
"caption": "caption",
|
|
98
98
|
"credit": "credit",
|
|
@@ -117,20 +117,20 @@ describe('bodyXMLToTree', () => {
|
|
|
117
117
|
it('includes known children of unknown tags', () => {
|
|
118
118
|
const xml = `<body><p>P1</p><unknown><p>P2</p></unknown></body>`
|
|
119
119
|
expect(bodyXMLToTree(xml, tags)).toMatchInlineSnapshot(`
|
|
120
|
-
|
|
121
|
-
"children":
|
|
122
|
-
|
|
123
|
-
"children":
|
|
124
|
-
|
|
120
|
+
{
|
|
121
|
+
"children": [
|
|
122
|
+
{
|
|
123
|
+
"children": [
|
|
124
|
+
{
|
|
125
125
|
"type": "text",
|
|
126
126
|
"value": "P1",
|
|
127
127
|
},
|
|
128
128
|
],
|
|
129
129
|
"type": "paragraph",
|
|
130
130
|
},
|
|
131
|
-
|
|
132
|
-
"children":
|
|
133
|
-
|
|
131
|
+
{
|
|
132
|
+
"children": [
|
|
133
|
+
{
|
|
134
134
|
"type": "text",
|
|
135
135
|
"value": "P2",
|
|
136
136
|
},
|
|
@@ -149,9 +149,9 @@ describe('bodyXMLToTree', () => {
|
|
|
149
149
|
'<body><a data-asset-type="tweet" data-embedded="true" href="https://twitter.com/EllliotttB/status/1610358432577748992?s=20&t=pcwJG65_c10H3snOQWzI4w">https://twitter.com/EllliotttB/status/1610358432577748992?s=20&t=pcwJG65_c10H3snOQWzI4w</a></body>'
|
|
150
150
|
|
|
151
151
|
expect(bodyXMLToTree(xml, tags)).toMatchInlineSnapshot(`
|
|
152
|
-
|
|
153
|
-
"children":
|
|
154
|
-
|
|
152
|
+
{
|
|
153
|
+
"children": [
|
|
154
|
+
{
|
|
155
155
|
"id": "https://twitter.com/EllliotttB/status/1610358432577748992?s=20&t=pcwJG65_c10H3snOQWzI4w",
|
|
156
156
|
"type": "tweet",
|
|
157
157
|
},
|
|
@@ -167,20 +167,21 @@ describe('bodyXMLToTree', () => {
|
|
|
167
167
|
'<body><div class="n-content-layout"><div class="n-content-layout__slot"><h4></h4><div class="n-content-layout__slot"><p>text</p></div></div></div></body>'
|
|
168
168
|
|
|
169
169
|
expect(bodyXMLToTree(xml, tags)).toMatchInlineSnapshot(`
|
|
170
|
-
|
|
171
|
-
"children":
|
|
172
|
-
|
|
173
|
-
"children":
|
|
174
|
-
|
|
175
|
-
"children":
|
|
176
|
-
|
|
177
|
-
"children":
|
|
170
|
+
{
|
|
171
|
+
"children": [
|
|
172
|
+
{
|
|
173
|
+
"children": [
|
|
174
|
+
{
|
|
175
|
+
"children": [
|
|
176
|
+
{
|
|
177
|
+
"children": [],
|
|
178
|
+
"fragmentIdentifier": undefined,
|
|
178
179
|
"level": "label",
|
|
179
180
|
"type": "heading",
|
|
180
181
|
},
|
|
181
|
-
|
|
182
|
-
"children":
|
|
183
|
-
|
|
182
|
+
{
|
|
183
|
+
"children": [
|
|
184
|
+
{
|
|
184
185
|
"type": "text",
|
|
185
186
|
"value": "text",
|
|
186
187
|
},
|
|
@@ -212,16 +213,16 @@ describe('bodyXMLToTree', () => {
|
|
|
212
213
|
'<body><div class="n-content-layout"><div class="n-content-layout__slot"></div><div class="n-content-layout__slot"></div></body>'
|
|
213
214
|
|
|
214
215
|
expect(bodyXMLToTree(xml, tags)).toMatchInlineSnapshot(`
|
|
215
|
-
|
|
216
|
-
"children":
|
|
217
|
-
|
|
218
|
-
"children":
|
|
219
|
-
|
|
220
|
-
"children":
|
|
216
|
+
{
|
|
217
|
+
"children": [
|
|
218
|
+
{
|
|
219
|
+
"children": [
|
|
220
|
+
{
|
|
221
|
+
"children": [],
|
|
221
222
|
"type": "layout-slot",
|
|
222
223
|
},
|
|
223
|
-
|
|
224
|
-
"children":
|
|
224
|
+
{
|
|
225
|
+
"children": [],
|
|
225
226
|
"type": "layout-slot",
|
|
226
227
|
},
|
|
227
228
|
],
|
|
@@ -242,21 +243,22 @@ describe('bodyXMLToTree', () => {
|
|
|
242
243
|
'<body><div class="n-content-layout"><h3></h3><div class="n-content-layout__slot"></div><div class="n-content-layout__slot"></div></body>'
|
|
243
244
|
|
|
244
245
|
expect(bodyXMLToTree(xml, tags, mockContext)).toMatchInlineSnapshot(`
|
|
245
|
-
|
|
246
|
-
"children":
|
|
247
|
-
|
|
248
|
-
"children":
|
|
249
|
-
|
|
250
|
-
"children":
|
|
246
|
+
{
|
|
247
|
+
"children": [
|
|
248
|
+
{
|
|
249
|
+
"children": [
|
|
250
|
+
{
|
|
251
|
+
"children": [],
|
|
252
|
+
"fragmentIdentifier": undefined,
|
|
251
253
|
"level": "subheading",
|
|
252
254
|
"type": "heading",
|
|
253
255
|
},
|
|
254
|
-
|
|
255
|
-
"children":
|
|
256
|
+
{
|
|
257
|
+
"children": [],
|
|
256
258
|
"type": "layout-slot",
|
|
257
259
|
},
|
|
258
|
-
|
|
259
|
-
"children":
|
|
260
|
+
{
|
|
261
|
+
"children": [],
|
|
260
262
|
"type": "layout-slot",
|
|
261
263
|
},
|
|
262
264
|
],
|
|
@@ -277,21 +279,22 @@ describe('bodyXMLToTree', () => {
|
|
|
277
279
|
'<body><div class="n-content-layout"><h3></h3><div class="n-content-layout__slot"></div><p></p></body>'
|
|
278
280
|
|
|
279
281
|
expect(bodyXMLToTree(xml, tags, mockContext)).toMatchInlineSnapshot(`
|
|
280
|
-
|
|
281
|
-
"children":
|
|
282
|
-
|
|
283
|
-
"children":
|
|
284
|
-
|
|
285
|
-
"children":
|
|
282
|
+
{
|
|
283
|
+
"children": [
|
|
284
|
+
{
|
|
285
|
+
"children": [
|
|
286
|
+
{
|
|
287
|
+
"children": [],
|
|
288
|
+
"fragmentIdentifier": undefined,
|
|
286
289
|
"level": "subheading",
|
|
287
290
|
"type": "heading",
|
|
288
291
|
},
|
|
289
|
-
|
|
290
|
-
"children":
|
|
292
|
+
{
|
|
293
|
+
"children": [],
|
|
291
294
|
"type": "layout-slot",
|
|
292
295
|
},
|
|
293
|
-
|
|
294
|
-
"children":
|
|
296
|
+
{
|
|
297
|
+
"children": [],
|
|
295
298
|
"type": "paragraph",
|
|
296
299
|
},
|
|
297
300
|
],
|
|
@@ -306,10 +309,10 @@ describe('bodyXMLToTree', () => {
|
|
|
306
309
|
`)
|
|
307
310
|
expect(mockLogWarn).toBeCalled()
|
|
308
311
|
expect(mockLogWarn.mock.lastCall).toMatchInlineSnapshot(`
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
"error":
|
|
312
|
-
"actual":
|
|
312
|
+
[
|
|
313
|
+
{
|
|
314
|
+
"error": {
|
|
315
|
+
"actual": [
|
|
313
316
|
"layout-slot",
|
|
314
317
|
"paragraph",
|
|
315
318
|
],
|
|
@@ -328,16 +331,16 @@ describe('bodyXMLToTree', () => {
|
|
|
328
331
|
'<body><div class="n-content-layout"><div class="n-content-layout__slot"></div><p></p></body>'
|
|
329
332
|
|
|
330
333
|
expect(bodyXMLToTree(xml, tags, mockContext)).toMatchInlineSnapshot(`
|
|
331
|
-
|
|
332
|
-
"children":
|
|
333
|
-
|
|
334
|
-
"children":
|
|
335
|
-
|
|
336
|
-
"children":
|
|
334
|
+
{
|
|
335
|
+
"children": [
|
|
336
|
+
{
|
|
337
|
+
"children": [
|
|
338
|
+
{
|
|
339
|
+
"children": [],
|
|
337
340
|
"type": "layout-slot",
|
|
338
341
|
},
|
|
339
|
-
|
|
340
|
-
"children":
|
|
342
|
+
{
|
|
343
|
+
"children": [],
|
|
341
344
|
"type": "paragraph",
|
|
342
345
|
},
|
|
343
346
|
],
|
|
@@ -352,10 +355,10 @@ describe('bodyXMLToTree', () => {
|
|
|
352
355
|
`)
|
|
353
356
|
expect(mockLogWarn).toBeCalled()
|
|
354
357
|
expect(mockLogWarn.mock.lastCall).toMatchInlineSnapshot(`
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
"error":
|
|
358
|
-
"actual":
|
|
358
|
+
[
|
|
359
|
+
{
|
|
360
|
+
"error": {
|
|
361
|
+
"actual": [
|
|
359
362
|
"layout-slot",
|
|
360
363
|
"paragraph",
|
|
361
364
|
],
|
|
@@ -376,26 +379,26 @@ describe('bodyXMLToTree', () => {
|
|
|
376
379
|
'<table class="data-table" data-table-collapse-rownum="" data-table-layout-largescreen="auto" data-table-layout-smallscreen="auto" data-table-theme="auto"><caption>Nulla iaculis tempus augue</caption><thead><tr><th data-column-hidden="none" data-column-sortable="false" data-column-type="string">libero mollis</th><th data-column-hidden="none" data-column-sortable="false" data-column-type="string">pretium nunc</th><th data-column-hidden="none" data-column-sortable="false" data-column-type="string">euismod nunc</th></tr></thead><tbody><tr><td>Aenean </td><td>14134</td><td>dfdsfd</td></tr><tr><td>lobortis </td><td>3434</td><td>fdsf dsf </td></tr><tr><td>volutpat </td><td>234234</td><td>sd fsd</td></tr><tr><td>vitae </td><td>2423</td><td>s fsdf</td></tr><tr><td>elementumus</td><td>23423</td><td>f sdf</td></tr></tbody><tfoot><tr><td colspan="1000">Aenean sodales sapien</td></tr></tfoot></table>'
|
|
377
380
|
|
|
378
381
|
expect(bodyXMLToTree(xml, tags, mockContext)).toMatchInlineSnapshot(`
|
|
379
|
-
|
|
380
|
-
"children":
|
|
381
|
-
|
|
382
|
-
"children":
|
|
383
|
-
|
|
384
|
-
"children":
|
|
385
|
-
|
|
382
|
+
{
|
|
383
|
+
"children": [
|
|
384
|
+
{
|
|
385
|
+
"children": [
|
|
386
|
+
{
|
|
387
|
+
"children": [
|
|
388
|
+
{
|
|
386
389
|
"type": "text",
|
|
387
390
|
"value": "Nulla iaculis tempus augue",
|
|
388
391
|
},
|
|
389
392
|
],
|
|
390
393
|
"type": "table-caption",
|
|
391
394
|
},
|
|
392
|
-
|
|
393
|
-
"children":
|
|
394
|
-
|
|
395
|
-
"children":
|
|
396
|
-
|
|
397
|
-
"children":
|
|
398
|
-
|
|
395
|
+
{
|
|
396
|
+
"children": [
|
|
397
|
+
{
|
|
398
|
+
"children": [
|
|
399
|
+
{
|
|
400
|
+
"children": [
|
|
401
|
+
{
|
|
399
402
|
"type": "text",
|
|
400
403
|
"value": "libero mollis",
|
|
401
404
|
},
|
|
@@ -403,9 +406,9 @@ describe('bodyXMLToTree', () => {
|
|
|
403
406
|
"heading": true,
|
|
404
407
|
"type": "table-cell",
|
|
405
408
|
},
|
|
406
|
-
|
|
407
|
-
"children":
|
|
408
|
-
|
|
409
|
+
{
|
|
410
|
+
"children": [
|
|
411
|
+
{
|
|
409
412
|
"type": "text",
|
|
410
413
|
"value": "pretium nunc",
|
|
411
414
|
},
|
|
@@ -413,9 +416,9 @@ describe('bodyXMLToTree', () => {
|
|
|
413
416
|
"heading": true,
|
|
414
417
|
"type": "table-cell",
|
|
415
418
|
},
|
|
416
|
-
|
|
417
|
-
"children":
|
|
418
|
-
|
|
419
|
+
{
|
|
420
|
+
"children": [
|
|
421
|
+
{
|
|
419
422
|
"type": "text",
|
|
420
423
|
"value": "euismod nunc",
|
|
421
424
|
},
|
|
@@ -426,29 +429,29 @@ describe('bodyXMLToTree', () => {
|
|
|
426
429
|
],
|
|
427
430
|
"type": "table-row",
|
|
428
431
|
},
|
|
429
|
-
|
|
430
|
-
"children":
|
|
431
|
-
|
|
432
|
-
"children":
|
|
433
|
-
|
|
432
|
+
{
|
|
433
|
+
"children": [
|
|
434
|
+
{
|
|
435
|
+
"children": [
|
|
436
|
+
{
|
|
434
437
|
"type": "text",
|
|
435
438
|
"value": "Aenean ",
|
|
436
439
|
},
|
|
437
440
|
],
|
|
438
441
|
"type": "table-cell",
|
|
439
442
|
},
|
|
440
|
-
|
|
441
|
-
"children":
|
|
442
|
-
|
|
443
|
+
{
|
|
444
|
+
"children": [
|
|
445
|
+
{
|
|
443
446
|
"type": "text",
|
|
444
447
|
"value": "14134",
|
|
445
448
|
},
|
|
446
449
|
],
|
|
447
450
|
"type": "table-cell",
|
|
448
451
|
},
|
|
449
|
-
|
|
450
|
-
"children":
|
|
451
|
-
|
|
452
|
+
{
|
|
453
|
+
"children": [
|
|
454
|
+
{
|
|
452
455
|
"type": "text",
|
|
453
456
|
"value": "dfdsfd",
|
|
454
457
|
},
|
|
@@ -458,29 +461,29 @@ describe('bodyXMLToTree', () => {
|
|
|
458
461
|
],
|
|
459
462
|
"type": "table-row",
|
|
460
463
|
},
|
|
461
|
-
|
|
462
|
-
"children":
|
|
463
|
-
|
|
464
|
-
"children":
|
|
465
|
-
|
|
464
|
+
{
|
|
465
|
+
"children": [
|
|
466
|
+
{
|
|
467
|
+
"children": [
|
|
468
|
+
{
|
|
466
469
|
"type": "text",
|
|
467
470
|
"value": "lobortis ",
|
|
468
471
|
},
|
|
469
472
|
],
|
|
470
473
|
"type": "table-cell",
|
|
471
474
|
},
|
|
472
|
-
|
|
473
|
-
"children":
|
|
474
|
-
|
|
475
|
+
{
|
|
476
|
+
"children": [
|
|
477
|
+
{
|
|
475
478
|
"type": "text",
|
|
476
479
|
"value": "3434",
|
|
477
480
|
},
|
|
478
481
|
],
|
|
479
482
|
"type": "table-cell",
|
|
480
483
|
},
|
|
481
|
-
|
|
482
|
-
"children":
|
|
483
|
-
|
|
484
|
+
{
|
|
485
|
+
"children": [
|
|
486
|
+
{
|
|
484
487
|
"type": "text",
|
|
485
488
|
"value": "fdsf dsf ",
|
|
486
489
|
},
|
|
@@ -490,29 +493,29 @@ describe('bodyXMLToTree', () => {
|
|
|
490
493
|
],
|
|
491
494
|
"type": "table-row",
|
|
492
495
|
},
|
|
493
|
-
|
|
494
|
-
"children":
|
|
495
|
-
|
|
496
|
-
"children":
|
|
497
|
-
|
|
496
|
+
{
|
|
497
|
+
"children": [
|
|
498
|
+
{
|
|
499
|
+
"children": [
|
|
500
|
+
{
|
|
498
501
|
"type": "text",
|
|
499
502
|
"value": "volutpat ",
|
|
500
503
|
},
|
|
501
504
|
],
|
|
502
505
|
"type": "table-cell",
|
|
503
506
|
},
|
|
504
|
-
|
|
505
|
-
"children":
|
|
506
|
-
|
|
507
|
+
{
|
|
508
|
+
"children": [
|
|
509
|
+
{
|
|
507
510
|
"type": "text",
|
|
508
511
|
"value": "234234",
|
|
509
512
|
},
|
|
510
513
|
],
|
|
511
514
|
"type": "table-cell",
|
|
512
515
|
},
|
|
513
|
-
|
|
514
|
-
"children":
|
|
515
|
-
|
|
516
|
+
{
|
|
517
|
+
"children": [
|
|
518
|
+
{
|
|
516
519
|
"type": "text",
|
|
517
520
|
"value": "sd fsd",
|
|
518
521
|
},
|
|
@@ -522,29 +525,29 @@ describe('bodyXMLToTree', () => {
|
|
|
522
525
|
],
|
|
523
526
|
"type": "table-row",
|
|
524
527
|
},
|
|
525
|
-
|
|
526
|
-
"children":
|
|
527
|
-
|
|
528
|
-
"children":
|
|
529
|
-
|
|
528
|
+
{
|
|
529
|
+
"children": [
|
|
530
|
+
{
|
|
531
|
+
"children": [
|
|
532
|
+
{
|
|
530
533
|
"type": "text",
|
|
531
534
|
"value": "vitae ",
|
|
532
535
|
},
|
|
533
536
|
],
|
|
534
537
|
"type": "table-cell",
|
|
535
538
|
},
|
|
536
|
-
|
|
537
|
-
"children":
|
|
538
|
-
|
|
539
|
+
{
|
|
540
|
+
"children": [
|
|
541
|
+
{
|
|
539
542
|
"type": "text",
|
|
540
543
|
"value": "2423",
|
|
541
544
|
},
|
|
542
545
|
],
|
|
543
546
|
"type": "table-cell",
|
|
544
547
|
},
|
|
545
|
-
|
|
546
|
-
"children":
|
|
547
|
-
|
|
548
|
+
{
|
|
549
|
+
"children": [
|
|
550
|
+
{
|
|
548
551
|
"type": "text",
|
|
549
552
|
"value": "s fsdf",
|
|
550
553
|
},
|
|
@@ -554,29 +557,29 @@ describe('bodyXMLToTree', () => {
|
|
|
554
557
|
],
|
|
555
558
|
"type": "table-row",
|
|
556
559
|
},
|
|
557
|
-
|
|
558
|
-
"children":
|
|
559
|
-
|
|
560
|
-
"children":
|
|
561
|
-
|
|
560
|
+
{
|
|
561
|
+
"children": [
|
|
562
|
+
{
|
|
563
|
+
"children": [
|
|
564
|
+
{
|
|
562
565
|
"type": "text",
|
|
563
566
|
"value": "elementumus",
|
|
564
567
|
},
|
|
565
568
|
],
|
|
566
569
|
"type": "table-cell",
|
|
567
570
|
},
|
|
568
|
-
|
|
569
|
-
"children":
|
|
570
|
-
|
|
571
|
+
{
|
|
572
|
+
"children": [
|
|
573
|
+
{
|
|
571
574
|
"type": "text",
|
|
572
575
|
"value": "23423",
|
|
573
576
|
},
|
|
574
577
|
],
|
|
575
578
|
"type": "table-cell",
|
|
576
579
|
},
|
|
577
|
-
|
|
578
|
-
"children":
|
|
579
|
-
|
|
580
|
+
{
|
|
581
|
+
"children": [
|
|
582
|
+
{
|
|
580
583
|
"type": "text",
|
|
581
584
|
"value": "f sdf",
|
|
582
585
|
},
|
|
@@ -589,9 +592,9 @@ describe('bodyXMLToTree', () => {
|
|
|
589
592
|
],
|
|
590
593
|
"type": "table-body",
|
|
591
594
|
},
|
|
592
|
-
|
|
593
|
-
"children":
|
|
594
|
-
|
|
595
|
+
{
|
|
596
|
+
"children": [
|
|
597
|
+
{
|
|
595
598
|
"type": "text",
|
|
596
599
|
"value": "Aenean sodales sapien",
|
|
597
600
|
},
|
|
@@ -600,18 +603,18 @@ describe('bodyXMLToTree', () => {
|
|
|
600
603
|
},
|
|
601
604
|
],
|
|
602
605
|
"collapseAfterHowManyRows": undefined,
|
|
603
|
-
"columnSettings":
|
|
604
|
-
|
|
606
|
+
"columnSettings": [
|
|
607
|
+
{
|
|
605
608
|
"hideOnMobile": false,
|
|
606
609
|
"sortType": "text",
|
|
607
610
|
"sortable": false,
|
|
608
611
|
},
|
|
609
|
-
|
|
612
|
+
{
|
|
610
613
|
"hideOnMobile": false,
|
|
611
614
|
"sortType": "text",
|
|
612
615
|
"sortable": false,
|
|
613
616
|
},
|
|
614
|
-
|
|
617
|
+
{
|
|
615
618
|
"hideOnMobile": false,
|
|
616
619
|
"sortType": "text",
|
|
617
620
|
"sortable": false,
|
|
@@ -635,13 +638,13 @@ describe('bodyXMLToTree', () => {
|
|
|
635
638
|
'<table class="data-table" id="U1140244733565W0C"><caption>Emerging markets outlook for 2017</caption><tbody><tr><td colspan="2"><p>Brazil</p><p>Brazilian shares were the best-performing asset globally over the 12 months to the end of January, returning 121 per cent, according to data from BofA Merrill Lynch. Brazilian stocks did very well through January, but investors including Lazard and Eastspring have scaled back their exposure after strong growth last year.</p></td></tr></tbody></table>'
|
|
636
639
|
|
|
637
640
|
expect(bodyXMLToTree(xml, tags, mockContext)).toMatchInlineSnapshot(`
|
|
638
|
-
|
|
639
|
-
"children":
|
|
640
|
-
|
|
641
|
-
"children":
|
|
642
|
-
|
|
643
|
-
"children":
|
|
644
|
-
|
|
641
|
+
{
|
|
642
|
+
"children": [
|
|
643
|
+
{
|
|
644
|
+
"children": [
|
|
645
|
+
{
|
|
646
|
+
"children": [
|
|
647
|
+
{
|
|
645
648
|
"type": "text",
|
|
646
649
|
"value": "Emerging markets outlook for 2017",
|
|
647
650
|
},
|
|
@@ -649,20 +652,20 @@ describe('bodyXMLToTree', () => {
|
|
|
649
652
|
"level": "subheading",
|
|
650
653
|
"type": "heading",
|
|
651
654
|
},
|
|
652
|
-
|
|
653
|
-
"children":
|
|
654
|
-
|
|
655
|
-
"children":
|
|
656
|
-
|
|
655
|
+
{
|
|
656
|
+
"children": [
|
|
657
|
+
{
|
|
658
|
+
"children": [
|
|
659
|
+
{
|
|
657
660
|
"type": "text",
|
|
658
661
|
"value": "Brazil",
|
|
659
662
|
},
|
|
660
663
|
],
|
|
661
664
|
"type": "paragraph",
|
|
662
665
|
},
|
|
663
|
-
|
|
664
|
-
"children":
|
|
665
|
-
|
|
666
|
+
{
|
|
667
|
+
"children": [
|
|
668
|
+
{
|
|
666
669
|
"type": "text",
|
|
667
670
|
"value": "Brazilian shares were the best-performing asset globally over the 12 months to the end of January, returning 121 per cent, according to data from BofA Merrill Lynch. Brazilian stocks did very well through January, but investors including Lazard and Eastspring have scaled back their exposure after strong growth last year.",
|
|
668
671
|
},
|
|
@@ -95,11 +95,13 @@ const articleTagMappings = (capiData?: Content): TagMappings => ({
|
|
|
95
95
|
? 'image-set'
|
|
96
96
|
: 'main-image',
|
|
97
97
|
id: $el.attr('url') || '',
|
|
98
|
+
fragmentIdentifier: $el.attr('data-fragment-identifier') || undefined,
|
|
98
99
|
}),
|
|
99
100
|
'body > ft-content[type="http://www.ft.com/ontology/content/ImageSet"]:not(:first-child),:not(body) > ft-content[type="http://www.ft.com/ontology/content/ImageSet"]':
|
|
100
101
|
($el) => ({
|
|
101
102
|
type: 'image-set',
|
|
102
103
|
id: $el.attr('url') || '',
|
|
104
|
+
fragmentIdentifier: $el.attr('data-fragment-identifier') || undefined,
|
|
103
105
|
}),
|
|
104
106
|
})
|
|
105
107
|
|
|
@@ -107,6 +109,7 @@ const liveBlogPostTagMappings: TagMappings = {
|
|
|
107
109
|
'ft-content[type="http://www.ft.com/ontology/content/ImageSet"]': ($el) => ({
|
|
108
110
|
type: 'image-set',
|
|
109
111
|
id: $el.attr('url') || '',
|
|
112
|
+
fragmentIdentifier: $el.attr('data-fragment-identifier') || undefined,
|
|
110
113
|
}),
|
|
111
114
|
}
|
|
112
115
|
|
|
@@ -209,6 +212,7 @@ const commonTagMappings: TagMappings = {
|
|
|
209
212
|
'h4,h5,h6': ($el, traverse, context) => ({
|
|
210
213
|
type: 'heading',
|
|
211
214
|
level: 'label',
|
|
215
|
+
fragmentIdentifier: $el.attr('data-fragment-identifier') || undefined,
|
|
212
216
|
children: everyChildIsType('text', traverse(), 'heading', context),
|
|
213
217
|
}),
|
|
214
218
|
'pull-quote': ($el, traverse) => {
|
|
@@ -260,6 +264,7 @@ const commonTagMappings: TagMappings = {
|
|
|
260
264
|
const layoutWidth = $el.attr('data-layout-width')
|
|
261
265
|
return {
|
|
262
266
|
id: $el.attr('id') || '',
|
|
267
|
+
fragmentIdentifier: $el.attr('data-fragment-identifier') || undefined,
|
|
263
268
|
type: 'flourish',
|
|
264
269
|
flourishType: $el.attr('data-flourish-type') || 'visualisation',
|
|
265
270
|
description: $el.attr('description') || '',
|
|
@@ -671,11 +676,13 @@ const commonTagMappings: TagMappings = {
|
|
|
671
676
|
h1: ($el, traverse, context) => ({
|
|
672
677
|
type: 'heading',
|
|
673
678
|
level: 'chapter',
|
|
679
|
+
fragmentIdentifier: $el.attr('data-fragment-identifier') || undefined,
|
|
674
680
|
children: everyChildIsType('text', traverse(), 'heading', context),
|
|
675
681
|
}),
|
|
676
682
|
'h2,h3': ($el, traverse, context) => ({
|
|
677
683
|
type: 'heading',
|
|
678
684
|
level: 'subheading',
|
|
685
|
+
fragmentIdentifier: $el.attr('data-fragment-identifier') || undefined,
|
|
679
686
|
children: everyChildIsType('text', traverse(), 'heading', context),
|
|
680
687
|
}),
|
|
681
688
|
'ft-content[type="http://www.ft.com/ontology/content/ClipSet"]': ($el) => ({
|