@parameter1/base-cms-marko-web 3.13.4 → 3.14.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -20,6 +20,17 @@
20
20
  "@attrs": "object",
21
21
  "@link": "expression"
22
22
  },
23
+ "<marko-web-content-transcript>": {
24
+ "template": "./transcript.marko",
25
+ "<embed-options>": {},
26
+ "@block-name": "string",
27
+ "@obj": "object",
28
+ "@tag": "string",
29
+ "@class": "string",
30
+ "@modifiers": "string",
31
+ "@attrs": "object",
32
+ "@link": "expression"
33
+ },
23
34
  "<marko-web-content-byline>": {
24
35
  "template": "./byline.marko",
25
36
  "@block-name": "string",
@@ -0,0 +1,22 @@
1
+ import { get, getAsObject } from "@parameter1/base-cms-object-path";
2
+ import extractRender from "../extract-render";
3
+
4
+ $ const transcript = get(input.obj, "transcript");
5
+ $ const v = transcript == null ? "" : `${transcript}`.trim();
6
+ $ const obj = { transcript: v };
7
+
8
+ <if(v)>
9
+ <marko-web-obj-text
10
+ type="content"
11
+ block-name=input.blockName
12
+ obj=obj
13
+ field="transcript"
14
+ html=true
15
+ tag=input.tag
16
+ class=input.class
17
+ modifiers=input.modifiers
18
+ attrs=input.attrs
19
+ link=input.link
20
+ ...extractRender(input)
21
+ />
22
+ </if>
@@ -33,10 +33,15 @@ fragment ContentPageMetadataFragment on Content {
33
33
  }
34
34
  ... on ContentVideo {
35
35
  embedSrc
36
+ transcript
36
37
  }
37
38
  ... on ContentPodcast {
38
39
  fileSrc
39
40
  fileName
41
+ transcript
42
+ }
43
+ ... on ContentWebinar {
44
+ transcript
40
45
  }
41
46
  ... on Authorable {
42
47
  authors {
@@ -1,4 +1,11 @@
1
1
  const objectPath = require('@parameter1/base-cms-object-path');
2
+ const cheerio = require('cheerio');
3
+
4
+ const convertHtmlToString = (value) => {
5
+ if (!value) return null;
6
+ const $ = cheerio.load(value);
7
+ return $.text();
8
+ };
2
9
 
3
10
  const { getAsArray } = objectPath;
4
11
 
@@ -49,6 +56,7 @@ module.exports = (node) => {
49
56
  uploadDate: publishedISOString,
50
57
  contentUrl: get(node, 'siteContext.canonicalUrl'),
51
58
  embedUrl: get(node, 'embedSrc'),
59
+ ...(get(node, 'transcript') && convertHtmlToString(get(node, 'transcript')) && { transcript: convertHtmlToString(get(node, 'transcript')) }),
52
60
  });
53
61
  }
54
62
 
@@ -66,6 +74,7 @@ module.exports = (node) => {
66
74
  '@type': 'PodcastEpisode',
67
75
  headline: get(node, 'metadata.title'),
68
76
  ...(associatedMedia && { associatedMedia }),
77
+ ...(get(node, 'transcript') && convertHtmlToString(' ') && { transcript: convertHtmlToString(' ') }),
69
78
  });
70
79
  }
71
80
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parameter1/base-cms-marko-web",
3
- "version": "3.13.4",
3
+ "version": "3.14.0",
4
4
  "description": "Core Marko+Express components for BaseCMS websites",
5
5
  "author": "Jacob Bare <jacob@parameter1.com>",
6
6
  "main": "index.js",
@@ -16,16 +16,17 @@
16
16
  "dependencies": {
17
17
  "@godaddy/terminus": "^4.9.0",
18
18
  "@parameter1/base-cms-apollo-ssr": "^3.0.0",
19
- "@parameter1/base-cms-embedded-media": "^3.13.4",
19
+ "@parameter1/base-cms-embedded-media": "^3.13.5",
20
20
  "@parameter1/base-cms-express-apollo": "^3.0.0",
21
21
  "@parameter1/base-cms-graphql-fragment-types": "^3.0.0",
22
- "@parameter1/base-cms-image": "^3.13.4",
22
+ "@parameter1/base-cms-image": "^3.13.5",
23
23
  "@parameter1/base-cms-inflector": "^3.0.0",
24
24
  "@parameter1/base-cms-marko-node-require": "^3.0.0",
25
25
  "@parameter1/base-cms-object-path": "^3.0.0",
26
26
  "@parameter1/base-cms-tenant-context": "^3.0.0",
27
27
  "@parameter1/base-cms-utils": "^3.0.0",
28
28
  "@parameter1/base-cms-web-common": "^3.3.1",
29
+ "cheerio": "^1.0.0-rc.10",
29
30
  "cookie-parser": "^1.4.5",
30
31
  "express": "^4.17.1",
31
32
  "express-http-proxy": "^1.6.2",
@@ -46,5 +47,5 @@
46
47
  "publishConfig": {
47
48
  "access": "public"
48
49
  },
49
- "gitHead": "803329a0c3073e3005cdb75912dea472ded781f6"
50
+ "gitHead": "b0dea489d56baebedbf0ef1cb2f48673a6928fcd"
50
51
  }