@ndla/article-converter 10.0.160-alpha.0 → 10.0.161-alpha.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.
@@ -11,7 +11,7 @@ import { BlockQuote } from "@ndla/primitives";
11
11
  *
12
12
  */
13
13
  const blockquotePlugin = (node, opts) => {
14
- const { "data-variant": variant,...props } = attributesToProps(node.attribs);
14
+ const { "data-variant": variant, ...props } = attributesToProps(node.attribs);
15
15
  return /* @__PURE__ */ jsx(BlockQuote, {
16
16
  ...props,
17
17
  variant: variant === "colored" ? "brand1" : void 0,
@@ -1 +1 @@
1
- {"version":3,"file":"blockquotePlugin.mjs","names":["blockquotePlugin: PluginType"],"sources":["../../src/plugins/blockquotePlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) 2024-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { type DOMNode, attributesToProps, domToReact } from \"html-react-parser\";\nimport { BlockQuote } from \"@ndla/primitives\";\nimport { type PluginType } from \"./types\";\n\nexport const blockquotePlugin: PluginType = (node, opts) => {\n const { \"data-variant\": variant, ...props } = attributesToProps(node.attribs);\n return (\n <BlockQuote {...props} variant={variant === \"colored\" ? \"brand1\" : undefined}>\n {domToReact(node.children as DOMNode[], opts)}\n </BlockQuote>\n );\n};\n"],"mappings":";;;;;;;;;;;;AAYA,MAAaA,oBAAgC,MAAM,SAAS;CAC1D,MAAM,EAAE,gBAAgB,QAAS,GAAG,UAAU,kBAAkB,KAAK,QAAQ;AAC7E,QACE,oBAAC;EAAW,GAAI;EAAO,SAAS,YAAY,YAAY,WAAW;YAChE,WAAW,KAAK,UAAuB,KAAK;GAClC"}
1
+ {"version":3,"file":"blockquotePlugin.mjs","names":["blockquotePlugin: PluginType"],"sources":["../../src/plugins/blockquotePlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) 2024-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { type DOMNode, attributesToProps, domToReact } from \"html-react-parser\";\nimport { BlockQuote } from \"@ndla/primitives\";\nimport { type PluginType } from \"./types\";\n\nexport const blockquotePlugin: PluginType = (node, opts) => {\n const { \"data-variant\": variant, ...props } = attributesToProps(node.attribs);\n return (\n <BlockQuote {...props} variant={variant === \"colored\" ? \"brand1\" : undefined}>\n {domToReact(node.children as DOMNode[], opts)}\n </BlockQuote>\n );\n};\n"],"mappings":";;;;;;;;;;;;AAYA,MAAaA,oBAAgC,MAAM,SAAS;CAC1D,MAAM,EAAE,gBAAgB,SAAS,GAAG,UAAU,kBAAkB,KAAK,QAAQ;AAC7E,QACE,oBAAC;EAAW,GAAI;EAAO,SAAS,YAAY,YAAY,WAAW;YAChE,WAAW,KAAK,UAAuB,KAAK;GAClC"}
@@ -13,7 +13,7 @@ import { FramedContent } from "@ndla/primitives";
13
13
  */
14
14
  const divPlugin = (node, opts) => {
15
15
  if (node.attribs["data-type"] === "framed-content" || node.attribs.class === "c-bodybox") {
16
- const { "data-variant": variant,...props } = attributesToProps(node.attribs);
16
+ const { "data-variant": variant, ...props } = attributesToProps(node.attribs);
17
17
  return /* @__PURE__ */ jsx(FramedContent, {
18
18
  colorTheme: variant === "colored" ? "brand1" : void 0,
19
19
  ...props,
@@ -1 +1 @@
1
- {"version":3,"file":"divPlugin.mjs","names":["divPlugin: PluginType"],"sources":["../../src/plugins/divPlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { domToReact, attributesToProps, Element, type DOMNode } from \"html-react-parser\";\nimport { FramedContent } from \"@ndla/primitives\";\nimport { FileListEmbed, RelatedArticleList, Grid, type GridType, GridParallaxItem } from \"@ndla/ui\";\nimport { type PluginType } from \"./types\";\n\nexport const divPlugin: PluginType = (node, opts) => {\n if (node.attribs[\"data-type\"] === \"framed-content\" || node.attribs.class === \"c-bodybox\") {\n const { \"data-variant\": variant, ...props } = attributesToProps(node.attribs);\n return (\n <FramedContent colorTheme={variant === \"colored\" ? \"brand1\" : undefined} {...props}>\n {domToReact(node.children as DOMNode[], opts)}\n </FramedContent>\n );\n }\n if (node.attribs[\"data-type\"] === \"related-content\" && node.children.length) {\n const props = attributesToProps(node.attribs);\n\n return (\n <RelatedArticleList {...props}>\n {/* @ts-expect-error - This works, the types just won't match entirely */}\n {domToReact(node.children, opts)}\n </RelatedArticleList>\n );\n }\n if (node.attribs[\"data-type\"] === \"file\" && node.childNodes.length) {\n const elements = node.childNodes.filter(\n (c): c is Element => c.type === \"tag\" && c.name === \"ndlaembed\" && c.attribs[\"data-resource\"] === \"file\",\n );\n const [pdfs, files] = elements.reduce<[Element[], Element[]]>(\n (acc, el) => {\n const arr = el.attribs[\"data-type\"] === \"pdf\" && el.attribs[\"data-display\"] === \"block\" ? acc[0] : acc[1];\n arr.push(el);\n return acc;\n },\n [[], []],\n );\n\n return (\n <>\n {files.length ? <FileListEmbed>{domToReact(files, opts)}</FileListEmbed> : undefined}\n {domToReact(pdfs, opts)}\n </>\n );\n }\n if (node.attribs[\"data-type\"] === \"grid\" && node.children.length > 0) {\n const props = attributesToProps(node.attribs);\n const columns = props[\"data-columns\"] as GridType[\"columns\"];\n const border = props[\"data-border\"] as GridType[\"border\"];\n const background = props[\"data-background\"] as GridType[\"background\"];\n return (\n <Grid border={border} columns={columns} background={background} {...props}>\n {/* @ts-expect-error - This works, the types just won't match entirely */}\n {domToReact(node.children, opts)}\n </Grid>\n );\n }\n if (node.attribs[\"data-parallax-cell\"] === \"true\" && node.children.length) {\n return <GridParallaxItem>{domToReact(node.children as DOMNode[], opts)}</GridParallaxItem>;\n }\n return null;\n};\n"],"mappings":";;;;;;;;;;;;;AAaA,MAAaA,aAAyB,MAAM,SAAS;AACnD,KAAI,KAAK,QAAQ,iBAAiB,oBAAoB,KAAK,QAAQ,UAAU,aAAa;EACxF,MAAM,EAAE,gBAAgB,QAAS,GAAG,UAAU,kBAAkB,KAAK,QAAQ;AAC7E,SACE,oBAAC;GAAc,YAAY,YAAY,YAAY,WAAW;GAAW,GAAI;aAC1E,WAAW,KAAK,UAAuB,KAAK;IAC/B;;AAGpB,KAAI,KAAK,QAAQ,iBAAiB,qBAAqB,KAAK,SAAS,OAGnE,QACE,oBAAC;EAAmB,GAHR,kBAAkB,KAAK,QAAQ;YAKxC,WAAW,KAAK,UAAU,KAAK;GACb;AAGzB,KAAI,KAAK,QAAQ,iBAAiB,UAAU,KAAK,WAAW,QAAQ;EAIlE,MAAM,CAAC,MAAM,SAHI,KAAK,WAAW,QAC9B,MAAoB,EAAE,SAAS,SAAS,EAAE,SAAS,eAAe,EAAE,QAAQ,qBAAqB,OACnG,CAC8B,QAC5B,KAAK,OAAO;AAEX,IADY,GAAG,QAAQ,iBAAiB,SAAS,GAAG,QAAQ,oBAAoB,UAAU,IAAI,KAAK,IAAI,IACnG,KAAK,GAAG;AACZ,UAAO;KAET,CAAC,EAAE,EAAE,EAAE,CAAC,CACT;AAED,SACE,4CACG,MAAM,SAAS,oBAAC,2BAAe,WAAW,OAAO,KAAK,GAAiB,GAAG,QAC1E,WAAW,MAAM,KAAK,IACtB;;AAGP,KAAI,KAAK,QAAQ,iBAAiB,UAAU,KAAK,SAAS,SAAS,GAAG;EACpE,MAAM,QAAQ,kBAAkB,KAAK,QAAQ;EAC7C,MAAM,UAAU,MAAM;EACtB,MAAM,SAAS,MAAM;EACrB,MAAM,aAAa,MAAM;AACzB,SACE,oBAAC;GAAa;GAAiB;GAAqB;GAAY,GAAI;aAEjE,WAAW,KAAK,UAAU,KAAK;IAC3B;;AAGX,KAAI,KAAK,QAAQ,0BAA0B,UAAU,KAAK,SAAS,OACjE,QAAO,oBAAC,8BAAkB,WAAW,KAAK,UAAuB,KAAK,GAAoB;AAE5F,QAAO"}
1
+ {"version":3,"file":"divPlugin.mjs","names":["divPlugin: PluginType"],"sources":["../../src/plugins/divPlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { domToReact, attributesToProps, Element, type DOMNode } from \"html-react-parser\";\nimport { FramedContent } from \"@ndla/primitives\";\nimport { FileListEmbed, RelatedArticleList, Grid, type GridType, GridParallaxItem } from \"@ndla/ui\";\nimport { type PluginType } from \"./types\";\n\nexport const divPlugin: PluginType = (node, opts) => {\n if (node.attribs[\"data-type\"] === \"framed-content\" || node.attribs.class === \"c-bodybox\") {\n const { \"data-variant\": variant, ...props } = attributesToProps(node.attribs);\n return (\n <FramedContent colorTheme={variant === \"colored\" ? \"brand1\" : undefined} {...props}>\n {domToReact(node.children as DOMNode[], opts)}\n </FramedContent>\n );\n }\n if (node.attribs[\"data-type\"] === \"related-content\" && node.children.length) {\n const props = attributesToProps(node.attribs);\n\n return (\n <RelatedArticleList {...props}>\n {/* @ts-expect-error - This works, the types just won't match entirely */}\n {domToReact(node.children, opts)}\n </RelatedArticleList>\n );\n }\n if (node.attribs[\"data-type\"] === \"file\" && node.childNodes.length) {\n const elements = node.childNodes.filter(\n (c): c is Element => c.type === \"tag\" && c.name === \"ndlaembed\" && c.attribs[\"data-resource\"] === \"file\",\n );\n const [pdfs, files] = elements.reduce<[Element[], Element[]]>(\n (acc, el) => {\n const arr = el.attribs[\"data-type\"] === \"pdf\" && el.attribs[\"data-display\"] === \"block\" ? acc[0] : acc[1];\n arr.push(el);\n return acc;\n },\n [[], []],\n );\n\n return (\n <>\n {files.length ? <FileListEmbed>{domToReact(files, opts)}</FileListEmbed> : undefined}\n {domToReact(pdfs, opts)}\n </>\n );\n }\n if (node.attribs[\"data-type\"] === \"grid\" && node.children.length > 0) {\n const props = attributesToProps(node.attribs);\n const columns = props[\"data-columns\"] as GridType[\"columns\"];\n const border = props[\"data-border\"] as GridType[\"border\"];\n const background = props[\"data-background\"] as GridType[\"background\"];\n return (\n <Grid border={border} columns={columns} background={background} {...props}>\n {/* @ts-expect-error - This works, the types just won't match entirely */}\n {domToReact(node.children, opts)}\n </Grid>\n );\n }\n if (node.attribs[\"data-parallax-cell\"] === \"true\" && node.children.length) {\n return <GridParallaxItem>{domToReact(node.children as DOMNode[], opts)}</GridParallaxItem>;\n }\n return null;\n};\n"],"mappings":";;;;;;;;;;;;;AAaA,MAAaA,aAAyB,MAAM,SAAS;AACnD,KAAI,KAAK,QAAQ,iBAAiB,oBAAoB,KAAK,QAAQ,UAAU,aAAa;EACxF,MAAM,EAAE,gBAAgB,SAAS,GAAG,UAAU,kBAAkB,KAAK,QAAQ;AAC7E,SACE,oBAAC;GAAc,YAAY,YAAY,YAAY,WAAW;GAAW,GAAI;aAC1E,WAAW,KAAK,UAAuB,KAAK;IAC/B;;AAGpB,KAAI,KAAK,QAAQ,iBAAiB,qBAAqB,KAAK,SAAS,OAGnE,QACE,oBAAC;EAAmB,GAHR,kBAAkB,KAAK,QAAQ;YAKxC,WAAW,KAAK,UAAU,KAAK;GACb;AAGzB,KAAI,KAAK,QAAQ,iBAAiB,UAAU,KAAK,WAAW,QAAQ;EAIlE,MAAM,CAAC,MAAM,SAHI,KAAK,WAAW,QAC9B,MAAoB,EAAE,SAAS,SAAS,EAAE,SAAS,eAAe,EAAE,QAAQ,qBAAqB,OACnG,CAC8B,QAC5B,KAAK,OAAO;AAEX,IADY,GAAG,QAAQ,iBAAiB,SAAS,GAAG,QAAQ,oBAAoB,UAAU,IAAI,KAAK,IAAI,IACnG,KAAK,GAAG;AACZ,UAAO;KAET,CAAC,EAAE,EAAE,EAAE,CAAC,CACT;AAED,SACE,4CACG,MAAM,SAAS,oBAAC,2BAAe,WAAW,OAAO,KAAK,GAAiB,GAAG,QAC1E,WAAW,MAAM,KAAK,IACtB;;AAGP,KAAI,KAAK,QAAQ,iBAAiB,UAAU,KAAK,SAAS,SAAS,GAAG;EACpE,MAAM,QAAQ,kBAAkB,KAAK,QAAQ;EAC7C,MAAM,UAAU,MAAM;EACtB,MAAM,SAAS,MAAM;EACrB,MAAM,aAAa,MAAM;AACzB,SACE,oBAAC;GAAa;GAAiB;GAAqB;GAAY,GAAI;aAEjE,WAAW,KAAK,UAAU,KAAK;IAC3B;;AAGX,KAAI,KAAK,QAAQ,0BAA0B,UAAU,KAAK,SAAS,OACjE,QAAO,oBAAC,8BAAkB,WAAW,KAAK,UAAuB,KAAK,GAAoB;AAE5F,QAAO"}
@@ -10,7 +10,7 @@ import { jsx } from "react/jsx-runtime";
10
10
  *
11
11
  */
12
12
  const mathPlugin = (node) => {
13
- const { "data-math": mathContent,...props } = attributesToProps(node.attribs);
13
+ const { "data-math": mathContent, ...props } = attributesToProps(node.attribs);
14
14
  return /* @__PURE__ */ jsx("math", {
15
15
  xmlns: "http://www.w3.org/1998/Math/MathML",
16
16
  ...props,
@@ -1 +1 @@
1
- {"version":3,"file":"mathPlugin.mjs","names":["mathPlugin: PluginType"],"sources":["../../src/plugins/mathPlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { attributesToProps } from \"html-react-parser\";\nimport { type PluginType } from \"./types\";\nexport const mathPlugin: PluginType = (node) => {\n const { \"data-math\": mathContent, ...props } = attributesToProps(node.attribs);\n return (\n // @ts-expect-error - math is a valid tag\n <math xmlns=\"http://www.w3.org/1998/Math/MathML\" {...props} dangerouslySetInnerHTML={{ __html: mathContent }} />\n );\n};\n"],"mappings":";;;;;;;;;;;AAUA,MAAaA,cAA0B,SAAS;CAC9C,MAAM,EAAE,aAAa,YAAa,GAAG,UAAU,kBAAkB,KAAK,QAAQ;AAC9E,QAEE,oBAAC;EAAK,OAAM;EAAqC,GAAI;EAAO,yBAAyB,EAAE,QAAQ,aAAa;GAAI"}
1
+ {"version":3,"file":"mathPlugin.mjs","names":["mathPlugin: PluginType"],"sources":["../../src/plugins/mathPlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { attributesToProps } from \"html-react-parser\";\nimport { type PluginType } from \"./types\";\nexport const mathPlugin: PluginType = (node) => {\n const { \"data-math\": mathContent, ...props } = attributesToProps(node.attribs);\n return (\n // @ts-expect-error - math is a valid tag\n <math xmlns=\"http://www.w3.org/1998/Math/MathML\" {...props} dangerouslySetInnerHTML={{ __html: mathContent }} />\n );\n};\n"],"mappings":";;;;;;;;;;;AAUA,MAAaA,cAA0B,SAAS;CAC9C,MAAM,EAAE,aAAa,aAAa,GAAG,UAAU,kBAAkB,KAAK,QAAQ;AAC9E,QAEE,oBAAC;EAAK,OAAM;EAAqC,GAAI;EAAO,yBAAyB,EAAE,QAAQ,aAAa;GAAI"}
@@ -6,12 +6,16 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __getProtoOf = Object.getPrototypeOf;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
8
  var __copyProps = (to, from, except, desc) => {
9
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
10
- key = keys[i];
11
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
12
- get: ((k) => from[k]).bind(null, key),
13
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
14
- });
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
11
+ key = keys[i];
12
+ if (!__hasOwnProp.call(to, key) && key !== except) {
13
+ __defProp(to, key, {
14
+ get: ((k) => from[k]).bind(null, key),
15
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
+ });
17
+ }
18
+ }
15
19
  }
16
20
  return to;
17
21
  };
@@ -12,7 +12,7 @@ let __ndla_primitives = require("@ndla/primitives");
12
12
  *
13
13
  */
14
14
  const blockquotePlugin = (node, opts) => {
15
- const { "data-variant": variant,...props } = (0, html_react_parser.attributesToProps)(node.attribs);
15
+ const { "data-variant": variant, ...props } = (0, html_react_parser.attributesToProps)(node.attribs);
16
16
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__ndla_primitives.BlockQuote, {
17
17
  ...props,
18
18
  variant: variant === "colored" ? "brand1" : void 0,
@@ -1 +1 @@
1
- {"version":3,"file":"blockquotePlugin.js","names":["blockquotePlugin: PluginType","BlockQuote"],"sources":["../../src/plugins/blockquotePlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) 2024-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { type DOMNode, attributesToProps, domToReact } from \"html-react-parser\";\nimport { BlockQuote } from \"@ndla/primitives\";\nimport { type PluginType } from \"./types\";\n\nexport const blockquotePlugin: PluginType = (node, opts) => {\n const { \"data-variant\": variant, ...props } = attributesToProps(node.attribs);\n return (\n <BlockQuote {...props} variant={variant === \"colored\" ? \"brand1\" : undefined}>\n {domToReact(node.children as DOMNode[], opts)}\n </BlockQuote>\n );\n};\n"],"mappings":";;;;;;;;;;;;;AAYA,MAAaA,oBAAgC,MAAM,SAAS;CAC1D,MAAM,EAAE,gBAAgB,QAAS,GAAG,mDAA4B,KAAK,QAAQ;AAC7E,QACE,2CAACC;EAAW,GAAI;EAAO,SAAS,YAAY,YAAY,WAAW;8CACrD,KAAK,UAAuB,KAAK;GAClC"}
1
+ {"version":3,"file":"blockquotePlugin.js","names":["blockquotePlugin: PluginType","BlockQuote"],"sources":["../../src/plugins/blockquotePlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) 2024-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { type DOMNode, attributesToProps, domToReact } from \"html-react-parser\";\nimport { BlockQuote } from \"@ndla/primitives\";\nimport { type PluginType } from \"./types\";\n\nexport const blockquotePlugin: PluginType = (node, opts) => {\n const { \"data-variant\": variant, ...props } = attributesToProps(node.attribs);\n return (\n <BlockQuote {...props} variant={variant === \"colored\" ? \"brand1\" : undefined}>\n {domToReact(node.children as DOMNode[], opts)}\n </BlockQuote>\n );\n};\n"],"mappings":";;;;;;;;;;;;;AAYA,MAAaA,oBAAgC,MAAM,SAAS;CAC1D,MAAM,EAAE,gBAAgB,SAAS,GAAG,mDAA4B,KAAK,QAAQ;AAC7E,QACE,2CAACC;EAAW,GAAI;EAAO,SAAS,YAAY,YAAY,WAAW;8CACrD,KAAK,UAAuB,KAAK;GAClC"}
@@ -14,7 +14,7 @@ let __ndla_primitives = require("@ndla/primitives");
14
14
  */
15
15
  const divPlugin = (node, opts) => {
16
16
  if (node.attribs["data-type"] === "framed-content" || node.attribs.class === "c-bodybox") {
17
- const { "data-variant": variant,...props } = (0, html_react_parser.attributesToProps)(node.attribs);
17
+ const { "data-variant": variant, ...props } = (0, html_react_parser.attributesToProps)(node.attribs);
18
18
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__ndla_primitives.FramedContent, {
19
19
  colorTheme: variant === "colored" ? "brand1" : void 0,
20
20
  ...props,
@@ -1 +1 @@
1
- {"version":3,"file":"divPlugin.js","names":["divPlugin: PluginType","FramedContent","RelatedArticleList","FileListEmbed","Grid","GridParallaxItem"],"sources":["../../src/plugins/divPlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { domToReact, attributesToProps, Element, type DOMNode } from \"html-react-parser\";\nimport { FramedContent } from \"@ndla/primitives\";\nimport { FileListEmbed, RelatedArticleList, Grid, type GridType, GridParallaxItem } from \"@ndla/ui\";\nimport { type PluginType } from \"./types\";\n\nexport const divPlugin: PluginType = (node, opts) => {\n if (node.attribs[\"data-type\"] === \"framed-content\" || node.attribs.class === \"c-bodybox\") {\n const { \"data-variant\": variant, ...props } = attributesToProps(node.attribs);\n return (\n <FramedContent colorTheme={variant === \"colored\" ? \"brand1\" : undefined} {...props}>\n {domToReact(node.children as DOMNode[], opts)}\n </FramedContent>\n );\n }\n if (node.attribs[\"data-type\"] === \"related-content\" && node.children.length) {\n const props = attributesToProps(node.attribs);\n\n return (\n <RelatedArticleList {...props}>\n {/* @ts-expect-error - This works, the types just won't match entirely */}\n {domToReact(node.children, opts)}\n </RelatedArticleList>\n );\n }\n if (node.attribs[\"data-type\"] === \"file\" && node.childNodes.length) {\n const elements = node.childNodes.filter(\n (c): c is Element => c.type === \"tag\" && c.name === \"ndlaembed\" && c.attribs[\"data-resource\"] === \"file\",\n );\n const [pdfs, files] = elements.reduce<[Element[], Element[]]>(\n (acc, el) => {\n const arr = el.attribs[\"data-type\"] === \"pdf\" && el.attribs[\"data-display\"] === \"block\" ? acc[0] : acc[1];\n arr.push(el);\n return acc;\n },\n [[], []],\n );\n\n return (\n <>\n {files.length ? <FileListEmbed>{domToReact(files, opts)}</FileListEmbed> : undefined}\n {domToReact(pdfs, opts)}\n </>\n );\n }\n if (node.attribs[\"data-type\"] === \"grid\" && node.children.length > 0) {\n const props = attributesToProps(node.attribs);\n const columns = props[\"data-columns\"] as GridType[\"columns\"];\n const border = props[\"data-border\"] as GridType[\"border\"];\n const background = props[\"data-background\"] as GridType[\"background\"];\n return (\n <Grid border={border} columns={columns} background={background} {...props}>\n {/* @ts-expect-error - This works, the types just won't match entirely */}\n {domToReact(node.children, opts)}\n </Grid>\n );\n }\n if (node.attribs[\"data-parallax-cell\"] === \"true\" && node.children.length) {\n return <GridParallaxItem>{domToReact(node.children as DOMNode[], opts)}</GridParallaxItem>;\n }\n return null;\n};\n"],"mappings":";;;;;;;;;;;;;;AAaA,MAAaA,aAAyB,MAAM,SAAS;AACnD,KAAI,KAAK,QAAQ,iBAAiB,oBAAoB,KAAK,QAAQ,UAAU,aAAa;EACxF,MAAM,EAAE,gBAAgB,QAAS,GAAG,mDAA4B,KAAK,QAAQ;AAC7E,SACE,2CAACC;GAAc,YAAY,YAAY,YAAY,WAAW;GAAW,GAAI;+CAC/D,KAAK,UAAuB,KAAK;IAC/B;;AAGpB,KAAI,KAAK,QAAQ,iBAAiB,qBAAqB,KAAK,SAAS,OAGnE,QACE,2CAACC;EAAmB,4CAHU,KAAK,QAAQ;8CAK7B,KAAK,UAAU,KAAK;GACb;AAGzB,KAAI,KAAK,QAAQ,iBAAiB,UAAU,KAAK,WAAW,QAAQ;EAIlE,MAAM,CAAC,MAAM,SAHI,KAAK,WAAW,QAC9B,MAAoB,EAAE,SAAS,SAAS,EAAE,SAAS,eAAe,EAAE,QAAQ,qBAAqB,OACnG,CAC8B,QAC5B,KAAK,OAAO;AAEX,IADY,GAAG,QAAQ,iBAAiB,SAAS,GAAG,QAAQ,oBAAoB,UAAU,IAAI,KAAK,IAAI,IACnG,KAAK,GAAG;AACZ,UAAO;KAET,CAAC,EAAE,EAAE,EAAE,CAAC,CACT;AAED,SACE,qFACG,MAAM,SAAS,2CAACC,uEAA0B,OAAO,KAAK,GAAiB,GAAG,0CAC/D,MAAM,KAAK,IACtB;;AAGP,KAAI,KAAK,QAAQ,iBAAiB,UAAU,KAAK,SAAS,SAAS,GAAG;EACpE,MAAM,iDAA0B,KAAK,QAAQ;EAC7C,MAAM,UAAU,MAAM;EACtB,MAAM,SAAS,MAAM;EACrB,MAAM,aAAa,MAAM;AACzB,SACE,2CAACC;GAAa;GAAiB;GAAqB;GAAY,GAAI;+CAEtD,KAAK,UAAU,KAAK;IAC3B;;AAGX,KAAI,KAAK,QAAQ,0BAA0B,UAAU,KAAK,SAAS,OACjE,QAAO,2CAACC,0EAA6B,KAAK,UAAuB,KAAK,GAAoB;AAE5F,QAAO"}
1
+ {"version":3,"file":"divPlugin.js","names":["divPlugin: PluginType","FramedContent","RelatedArticleList","FileListEmbed","Grid","GridParallaxItem"],"sources":["../../src/plugins/divPlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { domToReact, attributesToProps, Element, type DOMNode } from \"html-react-parser\";\nimport { FramedContent } from \"@ndla/primitives\";\nimport { FileListEmbed, RelatedArticleList, Grid, type GridType, GridParallaxItem } from \"@ndla/ui\";\nimport { type PluginType } from \"./types\";\n\nexport const divPlugin: PluginType = (node, opts) => {\n if (node.attribs[\"data-type\"] === \"framed-content\" || node.attribs.class === \"c-bodybox\") {\n const { \"data-variant\": variant, ...props } = attributesToProps(node.attribs);\n return (\n <FramedContent colorTheme={variant === \"colored\" ? \"brand1\" : undefined} {...props}>\n {domToReact(node.children as DOMNode[], opts)}\n </FramedContent>\n );\n }\n if (node.attribs[\"data-type\"] === \"related-content\" && node.children.length) {\n const props = attributesToProps(node.attribs);\n\n return (\n <RelatedArticleList {...props}>\n {/* @ts-expect-error - This works, the types just won't match entirely */}\n {domToReact(node.children, opts)}\n </RelatedArticleList>\n );\n }\n if (node.attribs[\"data-type\"] === \"file\" && node.childNodes.length) {\n const elements = node.childNodes.filter(\n (c): c is Element => c.type === \"tag\" && c.name === \"ndlaembed\" && c.attribs[\"data-resource\"] === \"file\",\n );\n const [pdfs, files] = elements.reduce<[Element[], Element[]]>(\n (acc, el) => {\n const arr = el.attribs[\"data-type\"] === \"pdf\" && el.attribs[\"data-display\"] === \"block\" ? acc[0] : acc[1];\n arr.push(el);\n return acc;\n },\n [[], []],\n );\n\n return (\n <>\n {files.length ? <FileListEmbed>{domToReact(files, opts)}</FileListEmbed> : undefined}\n {domToReact(pdfs, opts)}\n </>\n );\n }\n if (node.attribs[\"data-type\"] === \"grid\" && node.children.length > 0) {\n const props = attributesToProps(node.attribs);\n const columns = props[\"data-columns\"] as GridType[\"columns\"];\n const border = props[\"data-border\"] as GridType[\"border\"];\n const background = props[\"data-background\"] as GridType[\"background\"];\n return (\n <Grid border={border} columns={columns} background={background} {...props}>\n {/* @ts-expect-error - This works, the types just won't match entirely */}\n {domToReact(node.children, opts)}\n </Grid>\n );\n }\n if (node.attribs[\"data-parallax-cell\"] === \"true\" && node.children.length) {\n return <GridParallaxItem>{domToReact(node.children as DOMNode[], opts)}</GridParallaxItem>;\n }\n return null;\n};\n"],"mappings":";;;;;;;;;;;;;;AAaA,MAAaA,aAAyB,MAAM,SAAS;AACnD,KAAI,KAAK,QAAQ,iBAAiB,oBAAoB,KAAK,QAAQ,UAAU,aAAa;EACxF,MAAM,EAAE,gBAAgB,SAAS,GAAG,mDAA4B,KAAK,QAAQ;AAC7E,SACE,2CAACC;GAAc,YAAY,YAAY,YAAY,WAAW;GAAW,GAAI;+CAC/D,KAAK,UAAuB,KAAK;IAC/B;;AAGpB,KAAI,KAAK,QAAQ,iBAAiB,qBAAqB,KAAK,SAAS,OAGnE,QACE,2CAACC;EAAmB,4CAHU,KAAK,QAAQ;8CAK7B,KAAK,UAAU,KAAK;GACb;AAGzB,KAAI,KAAK,QAAQ,iBAAiB,UAAU,KAAK,WAAW,QAAQ;EAIlE,MAAM,CAAC,MAAM,SAHI,KAAK,WAAW,QAC9B,MAAoB,EAAE,SAAS,SAAS,EAAE,SAAS,eAAe,EAAE,QAAQ,qBAAqB,OACnG,CAC8B,QAC5B,KAAK,OAAO;AAEX,IADY,GAAG,QAAQ,iBAAiB,SAAS,GAAG,QAAQ,oBAAoB,UAAU,IAAI,KAAK,IAAI,IACnG,KAAK,GAAG;AACZ,UAAO;KAET,CAAC,EAAE,EAAE,EAAE,CAAC,CACT;AAED,SACE,qFACG,MAAM,SAAS,2CAACC,uEAA0B,OAAO,KAAK,GAAiB,GAAG,0CAC/D,MAAM,KAAK,IACtB;;AAGP,KAAI,KAAK,QAAQ,iBAAiB,UAAU,KAAK,SAAS,SAAS,GAAG;EACpE,MAAM,iDAA0B,KAAK,QAAQ;EAC7C,MAAM,UAAU,MAAM;EACtB,MAAM,SAAS,MAAM;EACrB,MAAM,aAAa,MAAM;AACzB,SACE,2CAACC;GAAa;GAAiB;GAAqB;GAAY,GAAI;+CAEtD,KAAK,UAAU,KAAK;IAC3B;;AAGX,KAAI,KAAK,QAAQ,0BAA0B,UAAU,KAAK,SAAS,OACjE,QAAO,2CAACC,0EAA6B,KAAK,UAAuB,KAAK,GAAoB;AAE5F,QAAO"}
@@ -11,7 +11,7 @@ let react_jsx_runtime = require("react/jsx-runtime");
11
11
  *
12
12
  */
13
13
  const mathPlugin = (node) => {
14
- const { "data-math": mathContent,...props } = (0, html_react_parser.attributesToProps)(node.attribs);
14
+ const { "data-math": mathContent, ...props } = (0, html_react_parser.attributesToProps)(node.attribs);
15
15
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("math", {
16
16
  xmlns: "http://www.w3.org/1998/Math/MathML",
17
17
  ...props,
@@ -1 +1 @@
1
- {"version":3,"file":"mathPlugin.js","names":["mathPlugin: PluginType"],"sources":["../../src/plugins/mathPlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { attributesToProps } from \"html-react-parser\";\nimport { type PluginType } from \"./types\";\nexport const mathPlugin: PluginType = (node) => {\n const { \"data-math\": mathContent, ...props } = attributesToProps(node.attribs);\n return (\n // @ts-expect-error - math is a valid tag\n <math xmlns=\"http://www.w3.org/1998/Math/MathML\" {...props} dangerouslySetInnerHTML={{ __html: mathContent }} />\n );\n};\n"],"mappings":";;;;;;;;;;;;AAUA,MAAaA,cAA0B,SAAS;CAC9C,MAAM,EAAE,aAAa,YAAa,GAAG,mDAA4B,KAAK,QAAQ;AAC9E,QAEE,2CAAC;EAAK,OAAM;EAAqC,GAAI;EAAO,yBAAyB,EAAE,QAAQ,aAAa;GAAI"}
1
+ {"version":3,"file":"mathPlugin.js","names":["mathPlugin: PluginType"],"sources":["../../src/plugins/mathPlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { attributesToProps } from \"html-react-parser\";\nimport { type PluginType } from \"./types\";\nexport const mathPlugin: PluginType = (node) => {\n const { \"data-math\": mathContent, ...props } = attributesToProps(node.attribs);\n return (\n // @ts-expect-error - math is a valid tag\n <math xmlns=\"http://www.w3.org/1998/Math/MathML\" {...props} dangerouslySetInnerHTML={{ __html: mathContent }} />\n );\n};\n"],"mappings":";;;;;;;;;;;;AAUA,MAAaA,cAA0B,SAAS;CAC9C,MAAM,EAAE,aAAa,aAAa,GAAG,mDAA4B,KAAK,QAAQ;AAC9E,QAEE,2CAAC;EAAK,OAAM;EAAqC,GAAI;EAAO,yBAAyB,EAAE,QAAQ,aAAa;GAAI"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ndla/article-converter",
3
3
  "type": "module",
4
- "version": "10.0.160-alpha.0",
4
+ "version": "10.0.161-alpha.0",
5
5
  "description": "Transforms NDLA articles into extended html versions",
6
6
  "license": "GPL-3.0",
7
7
  "exports": {
@@ -31,13 +31,13 @@
31
31
  "src"
32
32
  ],
33
33
  "devDependencies": {
34
- "@ndla/types-backend": "^1.0.50",
35
- "@ndla/types-embed": "^5.0.17-alpha.0"
34
+ "@ndla/types-backend": "^1.0.82",
35
+ "@ndla/types-embed": "^5.0.18-alpha.0"
36
36
  },
37
37
  "dependencies": {
38
38
  "@ndla/primitives": "^1.0.109-alpha.0",
39
39
  "@ndla/safelink": "^7.0.112-alpha.0",
40
- "@ndla/ui": "^56.0.156-alpha.0",
40
+ "@ndla/ui": "^56.0.157-alpha.0",
41
41
  "html-react-parser": "^5.2.8"
42
42
  },
43
43
  "peerDependencies": {
@@ -50,5 +50,5 @@
50
50
  "publishConfig": {
51
51
  "access": "public"
52
52
  },
53
- "gitHead": "5a949912b848631d194d74fec102e8fe5657f194"
53
+ "gitHead": "f640957c55acc5c10e4b6f495e4ffc3390557649"
54
54
  }