Skip to content

Commit f4d650c

Browse files
authored
Merge pull request #80 from Financial-Times/flourish-fixes
Flourish fixes
2 parents 75ad59d + ec75d81 commit f4d650c

File tree

6 files changed

+10
-128
lines changed

6 files changed

+10
-128
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ interface Flourish extends Node {
511511
flourishType: string
512512
description?: string
513513
timestamp?: string
514-
fallbackImage?: Image
514+
external fallbackImage?: Image
515515
}
516516
```
517517

content-tree.d.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -699,7 +699,6 @@ export declare namespace ContentTree {
699699
flourishType: string;
700700
description?: string;
701701
timestamp?: string;
702-
fallbackImage?: Image;
703702
}
704703
interface BigNumber extends Node {
705704
type: "big-number";

libraries/from-bodyxml/index.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,6 @@ export let defaultTransformers = {
249249
return {
250250
type: "video",
251251
id: content.attributes.url ?? "",
252-
embedded: content.attributes["data-embedded"] == "true" ? true : false,
253252
children: null,
254253
};
255254
},
@@ -258,20 +257,23 @@ export let defaultTransformers = {
258257
* @type {Transformer<ContentTree.transit.Flourish | ContentTree.transit.Link>}
259258
*/
260259
[ContentType.content](content) {
260+
const id = content.attributes.url ?? "";
261+
const uuid = id.split("/").pop();
262+
261263
if (content.attributes["data-asset-type"] == "flourish") {
262264
return /** @type {ContentTree.transit.Flourish} */ ({
263265
type: "flourish",
266+
id: uuid,
264267
flourishType: content.attributes["data-flourish-type"] || "",
265268
layoutWidth: toValidLayoutWidth(
266269
content.attributes["data-layout-width"] || ""
267270
),
268271
description: content.attributes["alt"] || "",
269272
timestamp: content.attributes["data-time-stamp"] || "",
270-
// fallbackImage -- TODO should this be external in content-tree?
273+
children: null,
271274
});
272275
}
273-
const id = content.attributes.url ?? "";
274-
const uuid = id.split("/").pop();
276+
275277
return /** @type {ContentTree.transit.Link} */ ({
276278
type: "link",
277279
url: `https://www.ft.com/content/${uuid}`,

schemas/body-tree.schema.json

Lines changed: 0 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -189,66 +189,6 @@
189189
"description": {
190190
"type": "string"
191191
},
192-
"fallbackImage": {
193-
"additionalProperties": false,
194-
"properties": {
195-
"format": {
196-
"enum": [
197-
"desktop",
198-
"mobile",
199-
"square",
200-
"square-ftedit",
201-
"standard",
202-
"standard-inline",
203-
"wide"
204-
],
205-
"type": "string"
206-
},
207-
"height": {
208-
"type": "number"
209-
},
210-
"id": {
211-
"type": "string"
212-
},
213-
"sourceSet": {
214-
"items": {
215-
"additionalProperties": false,
216-
"properties": {
217-
"dpr": {
218-
"type": "number"
219-
},
220-
"url": {
221-
"type": "string"
222-
},
223-
"width": {
224-
"type": "number"
225-
}
226-
},
227-
"required": [
228-
"dpr",
229-
"url",
230-
"width"
231-
],
232-
"type": "object"
233-
},
234-
"type": "array"
235-
},
236-
"url": {
237-
"type": "string"
238-
},
239-
"width": {
240-
"type": "number"
241-
}
242-
},
243-
"required": [
244-
"format",
245-
"height",
246-
"id",
247-
"url",
248-
"width"
249-
],
250-
"type": "object"
251-
},
252192
"flourishType": {
253193
"type": "string"
254194
},

schemas/transit-tree.schema.json

Lines changed: 0 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -214,66 +214,6 @@
214214
"description": {
215215
"type": "string"
216216
},
217-
"fallbackImage": {
218-
"additionalProperties": false,
219-
"properties": {
220-
"format": {
221-
"enum": [
222-
"desktop",
223-
"mobile",
224-
"square",
225-
"square-ftedit",
226-
"standard",
227-
"standard-inline",
228-
"wide"
229-
],
230-
"type": "string"
231-
},
232-
"height": {
233-
"type": "number"
234-
},
235-
"id": {
236-
"type": "string"
237-
},
238-
"sourceSet": {
239-
"items": {
240-
"additionalProperties": false,
241-
"properties": {
242-
"dpr": {
243-
"type": "number"
244-
},
245-
"url": {
246-
"type": "string"
247-
},
248-
"width": {
249-
"type": "number"
250-
}
251-
},
252-
"required": [
253-
"dpr",
254-
"url",
255-
"width"
256-
],
257-
"type": "object"
258-
},
259-
"type": "array"
260-
},
261-
"url": {
262-
"type": "string"
263-
},
264-
"width": {
265-
"type": "number"
266-
}
267-
},
268-
"required": [
269-
"format",
270-
"height",
271-
"id",
272-
"url",
273-
"width"
274-
],
275-
"type": "object"
276-
},
277217
"flourishType": {
278218
"type": "string"
279219
},

tools/maketypes/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ const full = code.replace(/^(\s+)external (.+)$/gm, "$1$2")
2020
// in the transit tree, externals must not be present
2121
const transit = code.replace(/^\s+external (.+:).+$/gm, "")
2222
// in the loose tree, externals are optional
23-
const loose = code.replace(/^(\s+)external (.+):(.+)$/gm, "$1$2?:$3")
24-
23+
const loose = code
24+
.replace(/^(\s+)external (.+)\?:(.+)$/gm, "$1$2?:$3")
25+
.replace(/^(\s+)external (.+):(.+)$/gm, "$1$2?:$3")
2526
process.stdout.write("export namespace ContentTree {\n")
2627
// make content-tree nodes available on the root namespace
2728
process.stdout.write(full.replace(/^/gm, "\t"))

0 commit comments

Comments
 (0)