@financial-times/cp-content-pipeline-schema 3.13.0 → 3.14.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 +22 -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 +176 -176
- package/package.json +1 -1
- 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 +305 -305
- package/src/resolvers/content-tree/bodyXMLToTree.test.ts +176 -176
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -27,11 +27,11 @@ describe('bodyXMLToTree', () => {
|
|
|
27
27
|
it('converts XML to tree', () => {
|
|
28
28
|
const xml = `<body><p>Hello world</p></body>`;
|
|
29
29
|
expect((0, bodyXMLToTree_1.default)(xml, tagMappings_1.default, mockContext)).toMatchInlineSnapshot(`
|
|
30
|
-
|
|
31
|
-
"children":
|
|
32
|
-
|
|
33
|
-
"children":
|
|
34
|
-
|
|
30
|
+
{
|
|
31
|
+
"children": [
|
|
32
|
+
{
|
|
33
|
+
"children": [
|
|
34
|
+
{
|
|
35
35
|
"type": "text",
|
|
36
36
|
"value": "Hello world",
|
|
37
37
|
},
|
|
@@ -72,17 +72,17 @@ describe('bodyXMLToTree', () => {
|
|
|
72
72
|
}),
|
|
73
73
|
};
|
|
74
74
|
expect((0, bodyXMLToTree_1.default)(xml, tags)).toMatchInlineSnapshot(`
|
|
75
|
-
|
|
76
|
-
"children":
|
|
77
|
-
|
|
75
|
+
{
|
|
76
|
+
"children": [
|
|
77
|
+
{
|
|
78
78
|
"id": "id",
|
|
79
79
|
"type": "image-set",
|
|
80
80
|
},
|
|
81
|
-
|
|
82
|
-
"children":
|
|
83
|
-
|
|
84
|
-
"children":
|
|
85
|
-
|
|
81
|
+
{
|
|
82
|
+
"children": [
|
|
83
|
+
{
|
|
84
|
+
"children": [
|
|
85
|
+
{
|
|
86
86
|
"alt": "alt",
|
|
87
87
|
"caption": "caption",
|
|
88
88
|
"credit": "credit",
|
|
@@ -106,20 +106,20 @@ describe('bodyXMLToTree', () => {
|
|
|
106
106
|
it('includes known children of unknown tags', () => {
|
|
107
107
|
const xml = `<body><p>P1</p><unknown><p>P2</p></unknown></body>`;
|
|
108
108
|
expect((0, bodyXMLToTree_1.default)(xml, tagMappings_1.default)).toMatchInlineSnapshot(`
|
|
109
|
-
|
|
110
|
-
"children":
|
|
111
|
-
|
|
112
|
-
"children":
|
|
113
|
-
|
|
109
|
+
{
|
|
110
|
+
"children": [
|
|
111
|
+
{
|
|
112
|
+
"children": [
|
|
113
|
+
{
|
|
114
114
|
"type": "text",
|
|
115
115
|
"value": "P1",
|
|
116
116
|
},
|
|
117
117
|
],
|
|
118
118
|
"type": "paragraph",
|
|
119
119
|
},
|
|
120
|
-
|
|
121
|
-
"children":
|
|
122
|
-
|
|
120
|
+
{
|
|
121
|
+
"children": [
|
|
122
|
+
{
|
|
123
123
|
"type": "text",
|
|
124
124
|
"value": "P2",
|
|
125
125
|
},
|
|
@@ -135,9 +135,9 @@ describe('bodyXMLToTree', () => {
|
|
|
135
135
|
it("maps tags that aren't expected to have any children (e.g. tweet reference)", () => {
|
|
136
136
|
const xml = '<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>';
|
|
137
137
|
expect((0, bodyXMLToTree_1.default)(xml, tagMappings_1.default)).toMatchInlineSnapshot(`
|
|
138
|
-
|
|
139
|
-
"children":
|
|
140
|
-
|
|
138
|
+
{
|
|
139
|
+
"children": [
|
|
140
|
+
{
|
|
141
141
|
"id": "https://twitter.com/EllliotttB/status/1610358432577748992?s=20&t=pcwJG65_c10H3snOQWzI4w",
|
|
142
142
|
"type": "tweet",
|
|
143
143
|
},
|
|
@@ -150,20 +150,20 @@ describe('bodyXMLToTree', () => {
|
|
|
150
150
|
it('collapses nested .n-content-layout__slots', () => {
|
|
151
151
|
const xml = '<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>';
|
|
152
152
|
expect((0, bodyXMLToTree_1.default)(xml, tagMappings_1.default)).toMatchInlineSnapshot(`
|
|
153
|
-
|
|
154
|
-
"children":
|
|
155
|
-
|
|
156
|
-
"children":
|
|
157
|
-
|
|
158
|
-
"children":
|
|
159
|
-
|
|
160
|
-
"children":
|
|
153
|
+
{
|
|
154
|
+
"children": [
|
|
155
|
+
{
|
|
156
|
+
"children": [
|
|
157
|
+
{
|
|
158
|
+
"children": [
|
|
159
|
+
{
|
|
160
|
+
"children": [],
|
|
161
161
|
"level": "label",
|
|
162
162
|
"type": "heading",
|
|
163
163
|
},
|
|
164
|
-
|
|
165
|
-
"children":
|
|
166
|
-
|
|
164
|
+
{
|
|
165
|
+
"children": [
|
|
166
|
+
{
|
|
167
167
|
"type": "text",
|
|
168
168
|
"value": "text",
|
|
169
169
|
},
|
|
@@ -191,16 +191,16 @@ describe('bodyXMLToTree', () => {
|
|
|
191
191
|
it('should handle slots', () => {
|
|
192
192
|
const xml = '<body><div class="n-content-layout"><div class="n-content-layout__slot"></div><div class="n-content-layout__slot"></div></body>';
|
|
193
193
|
expect((0, bodyXMLToTree_1.default)(xml, tagMappings_1.default)).toMatchInlineSnapshot(`
|
|
194
|
-
|
|
195
|
-
"children":
|
|
196
|
-
|
|
197
|
-
"children":
|
|
198
|
-
|
|
199
|
-
"children":
|
|
194
|
+
{
|
|
195
|
+
"children": [
|
|
196
|
+
{
|
|
197
|
+
"children": [
|
|
198
|
+
{
|
|
199
|
+
"children": [],
|
|
200
200
|
"type": "layout-slot",
|
|
201
201
|
},
|
|
202
|
-
|
|
203
|
-
"children":
|
|
202
|
+
{
|
|
203
|
+
"children": [],
|
|
204
204
|
"type": "layout-slot",
|
|
205
205
|
},
|
|
206
206
|
],
|
|
@@ -218,21 +218,21 @@ describe('bodyXMLToTree', () => {
|
|
|
218
218
|
it('should handle heading and slots', () => {
|
|
219
219
|
const xml = '<body><div class="n-content-layout"><h3></h3><div class="n-content-layout__slot"></div><div class="n-content-layout__slot"></div></body>';
|
|
220
220
|
expect((0, bodyXMLToTree_1.default)(xml, tagMappings_1.default, mockContext)).toMatchInlineSnapshot(`
|
|
221
|
-
|
|
222
|
-
"children":
|
|
223
|
-
|
|
224
|
-
"children":
|
|
225
|
-
|
|
226
|
-
"children":
|
|
221
|
+
{
|
|
222
|
+
"children": [
|
|
223
|
+
{
|
|
224
|
+
"children": [
|
|
225
|
+
{
|
|
226
|
+
"children": [],
|
|
227
227
|
"level": "subheading",
|
|
228
228
|
"type": "heading",
|
|
229
229
|
},
|
|
230
|
-
|
|
231
|
-
"children":
|
|
230
|
+
{
|
|
231
|
+
"children": [],
|
|
232
232
|
"type": "layout-slot",
|
|
233
233
|
},
|
|
234
|
-
|
|
235
|
-
"children":
|
|
234
|
+
{
|
|
235
|
+
"children": [],
|
|
236
236
|
"type": "layout-slot",
|
|
237
237
|
},
|
|
238
238
|
],
|
|
@@ -250,21 +250,21 @@ describe('bodyXMLToTree', () => {
|
|
|
250
250
|
it('should log an error on unexpected child after heading', () => {
|
|
251
251
|
const xml = '<body><div class="n-content-layout"><h3></h3><div class="n-content-layout__slot"></div><p></p></body>';
|
|
252
252
|
expect((0, bodyXMLToTree_1.default)(xml, tagMappings_1.default, mockContext)).toMatchInlineSnapshot(`
|
|
253
|
-
|
|
254
|
-
"children":
|
|
255
|
-
|
|
256
|
-
"children":
|
|
257
|
-
|
|
258
|
-
"children":
|
|
253
|
+
{
|
|
254
|
+
"children": [
|
|
255
|
+
{
|
|
256
|
+
"children": [
|
|
257
|
+
{
|
|
258
|
+
"children": [],
|
|
259
259
|
"level": "subheading",
|
|
260
260
|
"type": "heading",
|
|
261
261
|
},
|
|
262
|
-
|
|
263
|
-
"children":
|
|
262
|
+
{
|
|
263
|
+
"children": [],
|
|
264
264
|
"type": "layout-slot",
|
|
265
265
|
},
|
|
266
|
-
|
|
267
|
-
"children":
|
|
266
|
+
{
|
|
267
|
+
"children": [],
|
|
268
268
|
"type": "paragraph",
|
|
269
269
|
},
|
|
270
270
|
],
|
|
@@ -279,10 +279,10 @@ describe('bodyXMLToTree', () => {
|
|
|
279
279
|
`);
|
|
280
280
|
expect(mockLogWarn).toBeCalled();
|
|
281
281
|
expect(mockLogWarn.mock.lastCall).toMatchInlineSnapshot(`
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
"error":
|
|
285
|
-
"actual":
|
|
282
|
+
[
|
|
283
|
+
{
|
|
284
|
+
"error": {
|
|
285
|
+
"actual": [
|
|
286
286
|
"layout-slot",
|
|
287
287
|
"paragraph",
|
|
288
288
|
],
|
|
@@ -298,16 +298,16 @@ describe('bodyXMLToTree', () => {
|
|
|
298
298
|
it('should log an error on unexpected child after slots', () => {
|
|
299
299
|
const xml = '<body><div class="n-content-layout"><div class="n-content-layout__slot"></div><p></p></body>';
|
|
300
300
|
expect((0, bodyXMLToTree_1.default)(xml, tagMappings_1.default, mockContext)).toMatchInlineSnapshot(`
|
|
301
|
-
|
|
302
|
-
"children":
|
|
303
|
-
|
|
304
|
-
"children":
|
|
305
|
-
|
|
306
|
-
"children":
|
|
301
|
+
{
|
|
302
|
+
"children": [
|
|
303
|
+
{
|
|
304
|
+
"children": [
|
|
305
|
+
{
|
|
306
|
+
"children": [],
|
|
307
307
|
"type": "layout-slot",
|
|
308
308
|
},
|
|
309
|
-
|
|
310
|
-
"children":
|
|
309
|
+
{
|
|
310
|
+
"children": [],
|
|
311
311
|
"type": "paragraph",
|
|
312
312
|
},
|
|
313
313
|
],
|
|
@@ -322,10 +322,10 @@ describe('bodyXMLToTree', () => {
|
|
|
322
322
|
`);
|
|
323
323
|
expect(mockLogWarn).toBeCalled();
|
|
324
324
|
expect(mockLogWarn.mock.lastCall).toMatchInlineSnapshot(`
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
"error":
|
|
328
|
-
"actual":
|
|
325
|
+
[
|
|
326
|
+
{
|
|
327
|
+
"error": {
|
|
328
|
+
"actual": [
|
|
329
329
|
"layout-slot",
|
|
330
330
|
"paragraph",
|
|
331
331
|
],
|
|
@@ -343,26 +343,26 @@ describe('bodyXMLToTree', () => {
|
|
|
343
343
|
it('parses tables', () => {
|
|
344
344
|
const xml = '<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>';
|
|
345
345
|
expect((0, bodyXMLToTree_1.default)(xml, tagMappings_1.default, mockContext)).toMatchInlineSnapshot(`
|
|
346
|
-
|
|
347
|
-
"children":
|
|
348
|
-
|
|
349
|
-
"children":
|
|
350
|
-
|
|
351
|
-
"children":
|
|
352
|
-
|
|
346
|
+
{
|
|
347
|
+
"children": [
|
|
348
|
+
{
|
|
349
|
+
"children": [
|
|
350
|
+
{
|
|
351
|
+
"children": [
|
|
352
|
+
{
|
|
353
353
|
"type": "text",
|
|
354
354
|
"value": "Nulla iaculis tempus augue",
|
|
355
355
|
},
|
|
356
356
|
],
|
|
357
357
|
"type": "table-caption",
|
|
358
358
|
},
|
|
359
|
-
|
|
360
|
-
"children":
|
|
361
|
-
|
|
362
|
-
"children":
|
|
363
|
-
|
|
364
|
-
"children":
|
|
365
|
-
|
|
359
|
+
{
|
|
360
|
+
"children": [
|
|
361
|
+
{
|
|
362
|
+
"children": [
|
|
363
|
+
{
|
|
364
|
+
"children": [
|
|
365
|
+
{
|
|
366
366
|
"type": "text",
|
|
367
367
|
"value": "libero mollis",
|
|
368
368
|
},
|
|
@@ -370,9 +370,9 @@ describe('bodyXMLToTree', () => {
|
|
|
370
370
|
"heading": true,
|
|
371
371
|
"type": "table-cell",
|
|
372
372
|
},
|
|
373
|
-
|
|
374
|
-
"children":
|
|
375
|
-
|
|
373
|
+
{
|
|
374
|
+
"children": [
|
|
375
|
+
{
|
|
376
376
|
"type": "text",
|
|
377
377
|
"value": "pretium nunc",
|
|
378
378
|
},
|
|
@@ -380,9 +380,9 @@ describe('bodyXMLToTree', () => {
|
|
|
380
380
|
"heading": true,
|
|
381
381
|
"type": "table-cell",
|
|
382
382
|
},
|
|
383
|
-
|
|
384
|
-
"children":
|
|
385
|
-
|
|
383
|
+
{
|
|
384
|
+
"children": [
|
|
385
|
+
{
|
|
386
386
|
"type": "text",
|
|
387
387
|
"value": "euismod nunc",
|
|
388
388
|
},
|
|
@@ -393,29 +393,29 @@ describe('bodyXMLToTree', () => {
|
|
|
393
393
|
],
|
|
394
394
|
"type": "table-row",
|
|
395
395
|
},
|
|
396
|
-
|
|
397
|
-
"children":
|
|
398
|
-
|
|
399
|
-
"children":
|
|
400
|
-
|
|
396
|
+
{
|
|
397
|
+
"children": [
|
|
398
|
+
{
|
|
399
|
+
"children": [
|
|
400
|
+
{
|
|
401
401
|
"type": "text",
|
|
402
402
|
"value": "Aenean ",
|
|
403
403
|
},
|
|
404
404
|
],
|
|
405
405
|
"type": "table-cell",
|
|
406
406
|
},
|
|
407
|
-
|
|
408
|
-
"children":
|
|
409
|
-
|
|
407
|
+
{
|
|
408
|
+
"children": [
|
|
409
|
+
{
|
|
410
410
|
"type": "text",
|
|
411
411
|
"value": "14134",
|
|
412
412
|
},
|
|
413
413
|
],
|
|
414
414
|
"type": "table-cell",
|
|
415
415
|
},
|
|
416
|
-
|
|
417
|
-
"children":
|
|
418
|
-
|
|
416
|
+
{
|
|
417
|
+
"children": [
|
|
418
|
+
{
|
|
419
419
|
"type": "text",
|
|
420
420
|
"value": "dfdsfd",
|
|
421
421
|
},
|
|
@@ -425,29 +425,29 @@ describe('bodyXMLToTree', () => {
|
|
|
425
425
|
],
|
|
426
426
|
"type": "table-row",
|
|
427
427
|
},
|
|
428
|
-
|
|
429
|
-
"children":
|
|
430
|
-
|
|
431
|
-
"children":
|
|
432
|
-
|
|
428
|
+
{
|
|
429
|
+
"children": [
|
|
430
|
+
{
|
|
431
|
+
"children": [
|
|
432
|
+
{
|
|
433
433
|
"type": "text",
|
|
434
434
|
"value": "lobortis ",
|
|
435
435
|
},
|
|
436
436
|
],
|
|
437
437
|
"type": "table-cell",
|
|
438
438
|
},
|
|
439
|
-
|
|
440
|
-
"children":
|
|
441
|
-
|
|
439
|
+
{
|
|
440
|
+
"children": [
|
|
441
|
+
{
|
|
442
442
|
"type": "text",
|
|
443
443
|
"value": "3434",
|
|
444
444
|
},
|
|
445
445
|
],
|
|
446
446
|
"type": "table-cell",
|
|
447
447
|
},
|
|
448
|
-
|
|
449
|
-
"children":
|
|
450
|
-
|
|
448
|
+
{
|
|
449
|
+
"children": [
|
|
450
|
+
{
|
|
451
451
|
"type": "text",
|
|
452
452
|
"value": "fdsf dsf ",
|
|
453
453
|
},
|
|
@@ -457,29 +457,29 @@ describe('bodyXMLToTree', () => {
|
|
|
457
457
|
],
|
|
458
458
|
"type": "table-row",
|
|
459
459
|
},
|
|
460
|
-
|
|
461
|
-
"children":
|
|
462
|
-
|
|
463
|
-
"children":
|
|
464
|
-
|
|
460
|
+
{
|
|
461
|
+
"children": [
|
|
462
|
+
{
|
|
463
|
+
"children": [
|
|
464
|
+
{
|
|
465
465
|
"type": "text",
|
|
466
466
|
"value": "volutpat ",
|
|
467
467
|
},
|
|
468
468
|
],
|
|
469
469
|
"type": "table-cell",
|
|
470
470
|
},
|
|
471
|
-
|
|
472
|
-
"children":
|
|
473
|
-
|
|
471
|
+
{
|
|
472
|
+
"children": [
|
|
473
|
+
{
|
|
474
474
|
"type": "text",
|
|
475
475
|
"value": "234234",
|
|
476
476
|
},
|
|
477
477
|
],
|
|
478
478
|
"type": "table-cell",
|
|
479
479
|
},
|
|
480
|
-
|
|
481
|
-
"children":
|
|
482
|
-
|
|
480
|
+
{
|
|
481
|
+
"children": [
|
|
482
|
+
{
|
|
483
483
|
"type": "text",
|
|
484
484
|
"value": "sd fsd",
|
|
485
485
|
},
|
|
@@ -489,29 +489,29 @@ describe('bodyXMLToTree', () => {
|
|
|
489
489
|
],
|
|
490
490
|
"type": "table-row",
|
|
491
491
|
},
|
|
492
|
-
|
|
493
|
-
"children":
|
|
494
|
-
|
|
495
|
-
"children":
|
|
496
|
-
|
|
492
|
+
{
|
|
493
|
+
"children": [
|
|
494
|
+
{
|
|
495
|
+
"children": [
|
|
496
|
+
{
|
|
497
497
|
"type": "text",
|
|
498
498
|
"value": "vitae ",
|
|
499
499
|
},
|
|
500
500
|
],
|
|
501
501
|
"type": "table-cell",
|
|
502
502
|
},
|
|
503
|
-
|
|
504
|
-
"children":
|
|
505
|
-
|
|
503
|
+
{
|
|
504
|
+
"children": [
|
|
505
|
+
{
|
|
506
506
|
"type": "text",
|
|
507
507
|
"value": "2423",
|
|
508
508
|
},
|
|
509
509
|
],
|
|
510
510
|
"type": "table-cell",
|
|
511
511
|
},
|
|
512
|
-
|
|
513
|
-
"children":
|
|
514
|
-
|
|
512
|
+
{
|
|
513
|
+
"children": [
|
|
514
|
+
{
|
|
515
515
|
"type": "text",
|
|
516
516
|
"value": "s fsdf",
|
|
517
517
|
},
|
|
@@ -521,29 +521,29 @@ describe('bodyXMLToTree', () => {
|
|
|
521
521
|
],
|
|
522
522
|
"type": "table-row",
|
|
523
523
|
},
|
|
524
|
-
|
|
525
|
-
"children":
|
|
526
|
-
|
|
527
|
-
"children":
|
|
528
|
-
|
|
524
|
+
{
|
|
525
|
+
"children": [
|
|
526
|
+
{
|
|
527
|
+
"children": [
|
|
528
|
+
{
|
|
529
529
|
"type": "text",
|
|
530
530
|
"value": "elementumus",
|
|
531
531
|
},
|
|
532
532
|
],
|
|
533
533
|
"type": "table-cell",
|
|
534
534
|
},
|
|
535
|
-
|
|
536
|
-
"children":
|
|
537
|
-
|
|
535
|
+
{
|
|
536
|
+
"children": [
|
|
537
|
+
{
|
|
538
538
|
"type": "text",
|
|
539
539
|
"value": "23423",
|
|
540
540
|
},
|
|
541
541
|
],
|
|
542
542
|
"type": "table-cell",
|
|
543
543
|
},
|
|
544
|
-
|
|
545
|
-
"children":
|
|
546
|
-
|
|
544
|
+
{
|
|
545
|
+
"children": [
|
|
546
|
+
{
|
|
547
547
|
"type": "text",
|
|
548
548
|
"value": "f sdf",
|
|
549
549
|
},
|
|
@@ -556,9 +556,9 @@ describe('bodyXMLToTree', () => {
|
|
|
556
556
|
],
|
|
557
557
|
"type": "table-body",
|
|
558
558
|
},
|
|
559
|
-
|
|
560
|
-
"children":
|
|
561
|
-
|
|
559
|
+
{
|
|
560
|
+
"children": [
|
|
561
|
+
{
|
|
562
562
|
"type": "text",
|
|
563
563
|
"value": "Aenean sodales sapien",
|
|
564
564
|
},
|
|
@@ -567,18 +567,18 @@ describe('bodyXMLToTree', () => {
|
|
|
567
567
|
},
|
|
568
568
|
],
|
|
569
569
|
"collapseAfterHowManyRows": undefined,
|
|
570
|
-
"columnSettings":
|
|
571
|
-
|
|
570
|
+
"columnSettings": [
|
|
571
|
+
{
|
|
572
572
|
"hideOnMobile": false,
|
|
573
573
|
"sortType": "text",
|
|
574
574
|
"sortable": false,
|
|
575
575
|
},
|
|
576
|
-
|
|
576
|
+
{
|
|
577
577
|
"hideOnMobile": false,
|
|
578
578
|
"sortType": "text",
|
|
579
579
|
"sortable": false,
|
|
580
580
|
},
|
|
581
|
-
|
|
581
|
+
{
|
|
582
582
|
"hideOnMobile": false,
|
|
583
583
|
"sortType": "text",
|
|
584
584
|
"sortable": false,
|
|
@@ -599,13 +599,13 @@ describe('bodyXMLToTree', () => {
|
|
|
599
599
|
it('parses single cell tables as infoboxes', () => {
|
|
600
600
|
const xml = '<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>';
|
|
601
601
|
expect((0, bodyXMLToTree_1.default)(xml, tagMappings_1.default, mockContext)).toMatchInlineSnapshot(`
|
|
602
|
-
|
|
603
|
-
"children":
|
|
604
|
-
|
|
605
|
-
"children":
|
|
606
|
-
|
|
607
|
-
"children":
|
|
608
|
-
|
|
602
|
+
{
|
|
603
|
+
"children": [
|
|
604
|
+
{
|
|
605
|
+
"children": [
|
|
606
|
+
{
|
|
607
|
+
"children": [
|
|
608
|
+
{
|
|
609
609
|
"type": "text",
|
|
610
610
|
"value": "Emerging markets outlook for 2017",
|
|
611
611
|
},
|
|
@@ -613,20 +613,20 @@ describe('bodyXMLToTree', () => {
|
|
|
613
613
|
"level": "subheading",
|
|
614
614
|
"type": "heading",
|
|
615
615
|
},
|
|
616
|
-
|
|
617
|
-
"children":
|
|
618
|
-
|
|
619
|
-
"children":
|
|
620
|
-
|
|
616
|
+
{
|
|
617
|
+
"children": [
|
|
618
|
+
{
|
|
619
|
+
"children": [
|
|
620
|
+
{
|
|
621
621
|
"type": "text",
|
|
622
622
|
"value": "Brazil",
|
|
623
623
|
},
|
|
624
624
|
],
|
|
625
625
|
"type": "paragraph",
|
|
626
626
|
},
|
|
627
|
-
|
|
628
|
-
"children":
|
|
629
|
-
|
|
627
|
+
{
|
|
628
|
+
"children": [
|
|
629
|
+
{
|
|
630
630
|
"type": "text",
|
|
631
631
|
"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.",
|
|
632
632
|
},
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@ const REQUEST_TIMEOUT = process.env.ORIGAMI_DATASOURCE_REQUEST_TIMEOUT
|
|
|
6
6
|
: 200
|
|
7
7
|
|
|
8
8
|
export class OrigamiImageDataSource extends InstrumentedRESTDataSource {
|
|
9
|
-
baseURL = 'https://images.ft.com/v3/image'
|
|
9
|
+
baseURL = 'https://images.ft.com/v3/image/'
|
|
10
10
|
get backendSystemCode() {
|
|
11
11
|
return 'image-service'
|
|
12
12
|
}
|
|
@@ -29,7 +29,7 @@ export class OrigamiImageDataSource extends InstrumentedRESTDataSource {
|
|
|
29
29
|
url: string
|
|
30
30
|
): Promise<{ width: number; height: number }> {
|
|
31
31
|
const imageMetadata = await this.get(
|
|
32
|
-
`metadata/${encodeURIComponent(url)}?source=
|
|
32
|
+
`metadata/${encodeURIComponent(url)}?source=cp-content-pipeline-api`
|
|
33
33
|
)
|
|
34
34
|
|
|
35
35
|
this.calls.push(url)
|