@ndla/article-converter 1.0.1 → 1.0.2

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.
Files changed (113) hide show
  1. package/README.md +32 -0
  2. package/es/plugins/{AsidePlugin.js → asidePlugin.js} +1 -1
  3. package/es/plugins/{CopyParagraphPlugin.js → copyParagraphPlugin.js} +1 -1
  4. package/es/plugins/{DivPlugin.js → divPlugin.js} +1 -1
  5. package/es/plugins/embed/{AudioEmbedPlugin.js → audioEmbedPlugin.js} +1 -1
  6. package/es/plugins/embed/{BrightcoveEmbedPlugin.js → brightcoveEmbedPlugin.js} +1 -1
  7. package/es/plugins/embed/{CodeEmbedPlugin.js → codeEmbedPlugin.js} +1 -1
  8. package/es/plugins/embed/{ConceptEmbedPlugin.js → conceptEmbedPlugin.js} +1 -1
  9. package/es/plugins/embed/{ConceptListEmbedPlugin.js → conceptListEmbedPlugin.js} +1 -1
  10. package/es/plugins/embed/{ContentLinkEmbedPlugin.js → contentLinkEmbedPlugin.js} +1 -1
  11. package/es/plugins/embed/{ExternalEmbedPlugin.js → externalEmbedPlugin.js} +1 -1
  12. package/es/plugins/embed/{FileEmbedPlugin.js → fileEmbedPlugin.js} +1 -1
  13. package/es/plugins/embed/{FootnoteEmbedPlugin.js → footnoteEmbedPlugin.js} +1 -1
  14. package/es/plugins/embed/{H5pEmbedPlugin.js → h5pEmbedPlugin.js} +1 -1
  15. package/es/plugins/embed/{IframeEmbedPlugin.js → iframeEmbedPlugin.js} +1 -1
  16. package/es/plugins/embed/{ImageEmbedPlugin.js → imageEmbedPlugin.js} +1 -1
  17. package/es/plugins/embed/index.js +26 -26
  18. package/es/plugins/embed/{RelatedContentEmbedPlugin.js → relatedContentEmbedPlugin.js} +1 -1
  19. package/es/plugins/{H3Plugin.js → h3Plugin.js} +1 -1
  20. package/es/plugins/index.js +22 -20
  21. package/es/plugins/{MathPlugin.js → mathPlugin.js} +1 -1
  22. package/es/plugins/oembed/{AnchorPlugin.js → anchorPlugin.js} +1 -1
  23. package/es/plugins/{OLPlugin.js → olPlugin.js} +1 -1
  24. package/es/plugins/{ParagraphPlugin.js → paragraphPlugin.js} +1 -1
  25. package/es/plugins/{SpanPlugin.js → spanPlugin.js} +1 -1
  26. package/es/plugins/{TablePlugin.js → tablePlugin.js} +1 -1
  27. package/es/plugins/{ULPlugin.js → ulPlugin.js} +1 -1
  28. package/lib/plugins/{AsidePlugin.d.ts → asidePlugin.d.ts} +1 -1
  29. package/lib/plugins/{AsidePlugin.js → asidePlugin.js} +3 -3
  30. package/lib/plugins/{CopyParagraphPlugin.d.ts → copyParagraphPlugin.d.ts} +1 -1
  31. package/lib/plugins/{CopyParagraphPlugin.js → copyParagraphPlugin.js} +3 -3
  32. package/lib/plugins/{DivPlugin.d.ts → divPlugin.d.ts} +1 -1
  33. package/lib/plugins/{DivPlugin.js → divPlugin.js} +3 -3
  34. package/lib/plugins/embed/{AudioEmbedPlugin.d.ts → audioEmbedPlugin.d.ts} +1 -1
  35. package/lib/plugins/embed/{AudioEmbedPlugin.js → audioEmbedPlugin.js} +3 -3
  36. package/lib/plugins/embed/{BrightcoveEmbedPlugin.d.ts → brightcoveEmbedPlugin.d.ts} +1 -1
  37. package/lib/plugins/embed/{BrightcoveEmbedPlugin.js → brightcoveEmbedPlugin.js} +3 -3
  38. package/lib/plugins/embed/{FileEmbedPlugin.d.ts → codeEmbedPlugin.d.ts} +1 -1
  39. package/lib/plugins/embed/{CodeEmbedPlugin.js → codeEmbedPlugin.js} +3 -3
  40. package/lib/plugins/embed/{ConceptEmbedPlugin.d.ts → conceptEmbedPlugin.d.ts} +1 -1
  41. package/lib/plugins/embed/{ConceptEmbedPlugin.js → conceptEmbedPlugin.js} +3 -3
  42. package/lib/plugins/embed/conceptListEmbedPlugin.d.ts +9 -0
  43. package/lib/plugins/embed/{ConceptListEmbedPlugin.js → conceptListEmbedPlugin.js} +3 -3
  44. package/lib/plugins/embed/contentLinkEmbedPlugin.d.ts +9 -0
  45. package/lib/plugins/embed/{ContentLinkEmbedPlugin.js → contentLinkEmbedPlugin.js} +3 -3
  46. package/lib/plugins/embed/{ExternalEmbedPlugin.d.ts → externalEmbedPlugin.d.ts} +1 -1
  47. package/lib/plugins/embed/{ExternalEmbedPlugin.js → externalEmbedPlugin.js} +3 -3
  48. package/lib/plugins/embed/{CodeEmbedPlugin.d.ts → fileEmbedPlugin.d.ts} +1 -1
  49. package/lib/plugins/embed/{FileEmbedPlugin.js → fileEmbedPlugin.js} +3 -3
  50. package/lib/plugins/embed/footnoteEmbedPlugin.d.ts +9 -0
  51. package/lib/plugins/embed/{FootnoteEmbedPlugin.js → footnoteEmbedPlugin.js} +3 -3
  52. package/lib/plugins/embed/{H5pEmbedPlugin.d.ts → h5pEmbedPlugin.d.ts} +1 -1
  53. package/lib/plugins/embed/{H5pEmbedPlugin.js → h5pEmbedPlugin.js} +3 -3
  54. package/lib/plugins/embed/iframeEmbedPlugin.d.ts +9 -0
  55. package/lib/plugins/embed/{IframeEmbedPlugin.js → iframeEmbedPlugin.js} +3 -3
  56. package/lib/plugins/embed/imageEmbedPlugin.d.ts +9 -0
  57. package/lib/plugins/embed/{ImageEmbedPlugin.js → imageEmbedPlugin.js} +3 -3
  58. package/lib/plugins/embed/index.js +26 -26
  59. package/lib/plugins/embed/relatedContentEmbedPlugin.d.ts +9 -0
  60. package/lib/plugins/embed/{RelatedContentEmbedPlugin.js → relatedContentEmbedPlugin.js} +3 -3
  61. package/lib/plugins/{OLPlugin.d.ts → h3Plugin.d.ts} +1 -1
  62. package/lib/plugins/{H3Plugin.js → h3Plugin.js} +3 -3
  63. package/lib/plugins/index.js +22 -20
  64. package/lib/plugins/{MathPlugin.d.ts → mathPlugin.d.ts} +1 -1
  65. package/lib/plugins/{MathPlugin.js → mathPlugin.js} +3 -3
  66. package/lib/plugins/oembed/{AnchorPlugin.d.ts → anchorPlugin.d.ts} +1 -1
  67. package/lib/plugins/oembed/{AnchorPlugin.js → anchorPlugin.js} +3 -3
  68. package/lib/plugins/{ULPlugin.d.ts → olPlugin.d.ts} +1 -1
  69. package/lib/plugins/{OLPlugin.js → olPlugin.js} +3 -3
  70. package/lib/plugins/paragraphPlugin.d.ts +9 -0
  71. package/lib/plugins/{ParagraphPlugin.js → paragraphPlugin.js} +3 -3
  72. package/lib/plugins/spanPlugin.d.ts +9 -0
  73. package/lib/plugins/{SpanPlugin.js → spanPlugin.js} +3 -3
  74. package/lib/plugins/tablePlugin.d.ts +9 -0
  75. package/lib/plugins/{TablePlugin.js → tablePlugin.js} +3 -3
  76. package/lib/plugins/{H3Plugin.d.ts → ulPlugin.d.ts} +1 -1
  77. package/lib/plugins/{ULPlugin.js → ulPlugin.js} +3 -3
  78. package/package.json +5 -5
  79. package/src/plugins/{AsidePlugin.tsx → asidePlugin.tsx} +1 -1
  80. package/src/plugins/{CopyParagraphPlugin.tsx → copyParagraphPlugin.tsx} +1 -1
  81. package/src/plugins/{DivPlugin.tsx → divPlugin.tsx} +1 -1
  82. package/src/plugins/embed/{AudioEmbedPlugin.tsx → audioEmbedPlugin.tsx} +1 -1
  83. package/src/plugins/embed/{BrightcoveEmbedPlugin.tsx → brightcoveEmbedPlugin.tsx} +1 -1
  84. package/src/plugins/embed/{CodeEmbedPlugin.tsx → codeEmbedPlugin.tsx} +1 -1
  85. package/src/plugins/embed/{ConceptEmbedPlugin.tsx → conceptEmbedPlugin.tsx} +1 -1
  86. package/src/plugins/embed/{ConceptListEmbedPlugin.tsx → conceptListEmbedPlugin.tsx} +1 -1
  87. package/src/plugins/embed/{ContentLinkEmbedPlugin.tsx → contentLinkEmbedPlugin.tsx} +1 -1
  88. package/src/plugins/embed/{ExternalEmbedPlugin.tsx → externalEmbedPlugin.tsx} +1 -1
  89. package/src/plugins/embed/{FileEmbedPlugin.tsx → fileEmbedPlugin.tsx} +1 -1
  90. package/src/plugins/embed/{FootnoteEmbedPlugin.tsx → footnoteEmbedPlugin.tsx} +1 -1
  91. package/src/plugins/embed/{H5pEmbedPlugin.tsx → h5pEmbedPlugin.tsx} +1 -1
  92. package/src/plugins/embed/{IframeEmbedPlugin.tsx → iframeEmbedPlugin.tsx} +1 -1
  93. package/src/plugins/embed/{ImageEmbedPlugin.tsx → imageEmbedPlugin.tsx} +1 -1
  94. package/src/plugins/embed/index.ts +26 -26
  95. package/src/plugins/embed/{RelatedContentEmbedPlugin.tsx → relatedContentEmbedPlugin.tsx} +1 -1
  96. package/src/plugins/{H3Plugin.tsx → h3Plugin.tsx} +1 -1
  97. package/src/plugins/index.ts +22 -20
  98. package/src/plugins/{MathPlugin.tsx → mathPlugin.tsx} +1 -1
  99. package/src/plugins/oembed/{AnchorPlugin.tsx → anchorPlugin.tsx} +1 -1
  100. package/src/plugins/{OLPlugin.tsx → olPlugin.tsx} +1 -1
  101. package/src/plugins/{ParagraphPlugin.tsx → paragraphPlugin.tsx} +1 -1
  102. package/src/plugins/{SpanPlugin.tsx → spanPlugin.tsx} +1 -1
  103. package/src/plugins/{TablePlugin.tsx → tablePlugin.tsx} +1 -1
  104. package/src/plugins/{ULPlugin.tsx → ulPlugin.tsx} +1 -1
  105. package/lib/plugins/ParagraphPlugin.d.ts +0 -9
  106. package/lib/plugins/SpanPlugin.d.ts +0 -9
  107. package/lib/plugins/TablePlugin.d.ts +0 -9
  108. package/lib/plugins/embed/ConceptListEmbedPlugin.d.ts +0 -9
  109. package/lib/plugins/embed/ContentLinkEmbedPlugin.d.ts +0 -9
  110. package/lib/plugins/embed/FootnoteEmbedPlugin.d.ts +0 -9
  111. package/lib/plugins/embed/IframeEmbedPlugin.d.ts +0 -9
  112. package/lib/plugins/embed/ImageEmbedPlugin.d.ts +0 -9
  113. package/lib/plugins/embed/RelatedContentEmbedPlugin.d.ts +0 -9
@@ -3,17 +3,17 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.TablePlugin = void 0;
6
+ exports.tablePlugin = void 0;
7
7
  var _ui = require("@ndla/ui");
8
8
  var _htmlReactParser = require("html-react-parser");
9
9
  var _jsxRuntime = require("@emotion/react/jsx-runtime");
10
10
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
11
11
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
12
12
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
13
- var TablePlugin = function TablePlugin(node, opts) {
13
+ var tablePlugin = function tablePlugin(node, opts) {
14
14
  var props = (0, _htmlReactParser.attributesToProps)(node.attribs);
15
15
  return (0, _jsxRuntime.jsx)(_ui.Table, _objectSpread(_objectSpread({}, props), {}, {
16
16
  children: (0, _htmlReactParser.domToReact)(node.children, opts)
17
17
  }));
18
18
  };
19
- exports.TablePlugin = TablePlugin;
19
+ exports.tablePlugin = tablePlugin;
@@ -6,4 +6,4 @@
6
6
  *
7
7
  */
8
8
  import { PluginType } from './types';
9
- export declare const H3Plugin: PluginType;
9
+ export declare const ulPlugin: PluginType;
@@ -3,13 +3,13 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.OLPlugin = void 0;
6
+ exports.ulPlugin = void 0;
7
7
  var _htmlReactParser = require("html-react-parser");
8
8
  var _jsxRuntime = require("@emotion/react/jsx-runtime");
9
9
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
10
10
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
11
11
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
12
- var OLPlugin = function OLPlugin(node, opts) {
12
+ var ulPlugin = function ulPlugin(node, opts) {
13
13
  if (node.attribs['data-type'] === 'two-column') {
14
14
  var _node$attribs$class;
15
15
  var props = (0, _htmlReactParser.attributesToProps)(node.attribs);
@@ -24,4 +24,4 @@ var OLPlugin = function OLPlugin(node, opts) {
24
24
  }
25
25
  return null;
26
26
  };
27
- exports.OLPlugin = OLPlugin;
27
+ exports.ulPlugin = ulPlugin;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ndla/article-converter",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "Transforms NDLA articles into extended html versions",
5
5
  "license": "GPL-3.0",
6
6
  "main": "lib/index.js",
@@ -27,11 +27,11 @@
27
27
  "src"
28
28
  ],
29
29
  "devDependencies": {
30
- "@ndla/types-embed": "^1.0.0"
30
+ "@ndla/types-embed": "^1.0.1"
31
31
  },
32
32
  "dependencies": {
33
- "@ndla/code": "^2.1.18",
34
- "@ndla/ui": "^34.6.3",
33
+ "@ndla/code": "^2.1.19",
34
+ "@ndla/ui": "^34.6.4",
35
35
  "html-react-parser": "^3.0.8",
36
36
  "lodash": "^4.17.20"
37
37
  },
@@ -44,5 +44,5 @@
44
44
  "publishConfig": {
45
45
  "access": "public"
46
46
  },
47
- "gitHead": "3be4405a57a209633f9e8534b5f208ab50bae6f0"
47
+ "gitHead": "22850ec146bbc6fe00fe4e29801109edc0acc975"
48
48
  }
@@ -9,7 +9,7 @@
9
9
  import { domToReact } from 'html-react-parser';
10
10
  import { Aside, FactBoxV2 } from '@ndla/ui';
11
11
  import { PluginType } from './types';
12
- export const AsidePlugin: PluginType = (node, opts) => {
12
+ export const asidePlugin: PluginType = (node, opts) => {
13
13
  if (node.attribs['data-type'] === 'factAside') {
14
14
  return <FactBoxV2>{domToReact(node.children, opts)}</FactBoxV2>;
15
15
  } else if (node.attribs['data-type'] === 'rightAside') {
@@ -9,7 +9,7 @@
9
9
  import { CopyParagraphButtonV2 } from '@ndla/ui';
10
10
  import { domToReact } from 'html-react-parser';
11
11
  import { PluginType } from './types';
12
- export const CopyParagraphPlugin: PluginType = (node, opts) => {
12
+ export const copyParagraphPlugin: PluginType = (node, opts) => {
13
13
  return (
14
14
  <CopyParagraphButtonV2 copyText={node.attribs['data-text']}>
15
15
  {domToReact(node.children, opts)}
@@ -10,7 +10,7 @@ import partition from 'lodash/partition';
10
10
  import { domToReact, attributesToProps, Element } from 'html-react-parser';
11
11
  import { FileListV2, RelatedArticleListV2 } from '@ndla/ui';
12
12
  import { PluginType } from './types';
13
- export const DivPlugin: PluginType = (node, opts) => {
13
+ export const divPlugin: PluginType = (node, opts) => {
14
14
  if (node.attribs['data-type'] === 'related-content' && node.children.length) {
15
15
  const props = attributesToProps(node.attribs);
16
16
 
@@ -11,7 +11,7 @@ import { AudioMetaData } from '@ndla/types-embed';
11
11
  import { AudioEmbed } from '@ndla/ui';
12
12
  import { PluginType } from '../types';
13
13
 
14
- export const AudioEmbedPlugin: PluginType = (element, _, opts) => {
14
+ export const audioEmbedPlugin: PluginType = (element, _, opts) => {
15
15
  const props = attributesToProps(element.attribs);
16
16
  const data = JSON.parse(props['data-json']) as AudioMetaData;
17
17
  return <AudioEmbed embed={data} articlePath={opts.path} />;
@@ -11,7 +11,7 @@ import { BrightcoveMetaData } from '@ndla/types-embed';
11
11
  import { BrightcoveEmbed } from '@ndla/ui';
12
12
  import { PluginType } from '../types';
13
13
 
14
- export const BrightcoveEmbedPlugin: PluginType = (element) => {
14
+ export const brightcoveEmbedPlugin: PluginType = (element) => {
15
15
  const props = attributesToProps(element.attribs);
16
16
  const data = JSON.parse(props['data-json']) as BrightcoveMetaData;
17
17
  return <BrightcoveEmbed embed={data} />;
@@ -11,7 +11,7 @@ import { CodeMetaData } from '@ndla/types-embed';
11
11
  import { CodeEmbed } from '@ndla/code';
12
12
  import { PluginType } from '../types';
13
13
 
14
- export const CodeEmbedPlugin: PluginType = (element) => {
14
+ export const codeEmbedPlugin: PluginType = (element) => {
15
15
  const props = attributesToProps(element.attribs);
16
16
  const data = JSON.parse(props['data-json']) as CodeMetaData;
17
17
  return <CodeEmbed embed={data} />;
@@ -11,7 +11,7 @@ import { ConceptMetaData } from '@ndla/types-embed';
11
11
  import { ConceptEmbed } from '@ndla/ui';
12
12
  import { PluginType } from '../types';
13
13
 
14
- export const ConceptEmbedPlugin: PluginType = (element) => {
14
+ export const conceptEmbedPlugin: PluginType = (element) => {
15
15
  const props = attributesToProps(element.attribs);
16
16
  const data = JSON.parse(props['data-json']) as ConceptMetaData;
17
17
  return <ConceptEmbed embed={data} fullWidth />;
@@ -11,7 +11,7 @@ import { ConceptListMetaData } from '@ndla/types-embed';
11
11
  import { ConceptListEmbed } from '@ndla/ui';
12
12
  import { PluginType } from '../types';
13
13
 
14
- export const ConceptListEmbedPlugin: PluginType = (element) => {
14
+ export const conceptListEmbedPlugin: PluginType = (element) => {
15
15
  const props = attributesToProps(element.attribs);
16
16
  const data = JSON.parse(props['data-json']) as ConceptListMetaData;
17
17
  return <ConceptListEmbed embed={data} />;
@@ -11,7 +11,7 @@ import { ContentLinkMetaData } from '@ndla/types-embed';
11
11
  import { ContentLinkEmbed } from '@ndla/ui';
12
12
  import { PluginType } from '../types';
13
13
 
14
- export const ContentLinkEmbedPlugin: PluginType = (element, _, { isOembed }) => {
14
+ export const contentLinkEmbedPlugin: PluginType = (element, _, { isOembed }) => {
15
15
  const props = attributesToProps(element.attribs);
16
16
  const data = JSON.parse(props['data-json']) as ContentLinkMetaData;
17
17
  return <ContentLinkEmbed embed={data} isOembed={isOembed} />;
@@ -11,7 +11,7 @@ import { OembedMetaData } from '@ndla/types-embed';
11
11
  import { ExternalEmbed } from '@ndla/ui';
12
12
  import { PluginType } from '../types';
13
13
 
14
- export const ExternalEmbedPlugin: PluginType = (element) => {
14
+ export const externalEmbedPlugin: PluginType = (element) => {
15
15
  const props = attributesToProps(element.attribs);
16
16
  const data = JSON.parse(props['data-json']) as OembedMetaData;
17
17
  return <ExternalEmbed embed={data} />;
@@ -11,7 +11,7 @@ import { FileMetaData } from '@ndla/types-embed';
11
11
  import { PdfFile, FileV2 } from '@ndla/ui';
12
12
  import { PluginType } from '../types';
13
13
 
14
- export const FileEmbedPlugin: PluginType = (element) => {
14
+ export const fileEmbedPlugin: PluginType = (element) => {
15
15
  const props = attributesToProps(element.attribs);
16
16
  const data = JSON.parse(props['data-json']) as FileMetaData;
17
17
  const { type, title, url } = data.embedData;
@@ -11,7 +11,7 @@ import { FootnoteMetaData } from '@ndla/types-embed';
11
11
  import { FootnoteEmbed } from '@ndla/ui';
12
12
  import { PluginType } from '../types';
13
13
 
14
- export const FootnoteEmbedPlugin: PluginType = (element) => {
14
+ export const footnoteEmbedPlugin: PluginType = (element) => {
15
15
  const props = attributesToProps(element.attribs);
16
16
  const data = JSON.parse(props['data-json']) as FootnoteMetaData;
17
17
  return <FootnoteEmbed embed={data} />;
@@ -11,7 +11,7 @@ import { H5pMetaData } from '@ndla/types-embed';
11
11
  import { H5pEmbed } from '@ndla/ui';
12
12
  import { PluginType } from '../types';
13
13
 
14
- export const H5pEmbedPlugin: PluginType = (element) => {
14
+ export const h5pEmbedPlugin: PluginType = (element) => {
15
15
  const props = attributesToProps(element.attribs);
16
16
  const data = JSON.parse(props['data-json']) as H5pMetaData;
17
17
  return <H5pEmbed embed={data} />;
@@ -11,7 +11,7 @@ import { IframeMetaData } from '@ndla/types-embed';
11
11
  import { IframeEmbed } from '@ndla/ui';
12
12
  import { PluginType } from '../types';
13
13
 
14
- export const IframeEmbedPlugin: PluginType = (element) => {
14
+ export const iframeEmbedPlugin: PluginType = (element) => {
15
15
  const props = attributesToProps(element.attribs);
16
16
  const data = JSON.parse(props['data-json']) as IframeMetaData;
17
17
  return <IframeEmbed embed={data} />;
@@ -11,7 +11,7 @@ import { attributesToProps } from 'html-react-parser';
11
11
  import { ImageMetaData } from '@ndla/types-embed';
12
12
  import { PluginType } from '../types';
13
13
 
14
- export const ImageEmbedPlugin: PluginType = (element, _, opts) => {
14
+ export const imageEmbedPlugin: PluginType = (element, _, opts) => {
15
15
  const props = attributesToProps(element.attribs);
16
16
  const data = JSON.parse(props['data-json']) as ImageMetaData;
17
17
  return <ImageEmbed embed={data} articlePath={opts.path} previewAlt={opts.previewAlt} />;
@@ -7,32 +7,32 @@
7
7
  */
8
8
 
9
9
  import { PluginType } from '../types';
10
- import { AudioEmbedPlugin } from './AudioEmbedPlugin';
11
- import { ExternalEmbedPlugin } from './ExternalEmbedPlugin';
12
- import { H5pEmbedPlugin } from './H5pEmbedPlugin';
13
- import { IframeEmbedPlugin } from './IframeEmbedPlugin';
14
- import { ImageEmbedPlugin } from './ImageEmbedPlugin';
15
- import { FootnoteEmbedPlugin } from './FootnoteEmbedPlugin';
16
- import { BrightcoveEmbedPlugin } from './BrightcoveEmbedPlugin';
17
- import { RelatedContentEmbedPlugin } from './RelatedContentEmbedPlugin';
18
- import { ContentLinkEmbedPlugin } from './ContentLinkEmbedPlugin';
19
- import { ConceptEmbedPlugin } from './ConceptEmbedPlugin';
20
- import { ConceptListEmbedPlugin } from './ConceptListEmbedPlugin';
21
- import { FileEmbedPlugin } from './FileEmbedPlugin';
22
- import { CodeEmbedPlugin } from './CodeEmbedPlugin';
10
+ import { audioEmbedPlugin } from './audioEmbedPlugin';
11
+ import { externalEmbedPlugin } from './externalEmbedPlugin';
12
+ import { h5pEmbedPlugin } from './h5pEmbedPlugin';
13
+ import { iframeEmbedPlugin } from './iframeEmbedPlugin';
14
+ import { imageEmbedPlugin } from './imageEmbedPlugin';
15
+ import { footnoteEmbedPlugin } from './footnoteEmbedPlugin';
16
+ import { brightcoveEmbedPlugin } from './brightcoveEmbedPlugin';
17
+ import { relatedContentEmbedPlugin } from './relatedContentEmbedPlugin';
18
+ import { contentLinkEmbedPlugin } from './contentLinkEmbedPlugin';
19
+ import { conceptEmbedPlugin } from './conceptEmbedPlugin';
20
+ import { conceptListEmbedPlugin } from './conceptListEmbedPlugin';
21
+ import { fileEmbedPlugin } from './fileEmbedPlugin';
22
+ import { codeEmbedPlugin } from './codeEmbedPlugin';
23
23
 
24
24
  export const embedPlugins: Record<string, PluginType> = {
25
- image: ImageEmbedPlugin,
26
- audio: AudioEmbedPlugin,
27
- h5p: H5pEmbedPlugin,
28
- 'code-block': CodeEmbedPlugin,
29
- external: ExternalEmbedPlugin,
30
- iframe: IframeEmbedPlugin,
31
- footnote: FootnoteEmbedPlugin,
32
- brightcove: BrightcoveEmbedPlugin,
33
- 'related-content': RelatedContentEmbedPlugin,
34
- 'content-link': ContentLinkEmbedPlugin,
35
- concept: ConceptEmbedPlugin,
36
- 'concept-list': ConceptListEmbedPlugin,
37
- file: FileEmbedPlugin,
25
+ image: imageEmbedPlugin,
26
+ audio: audioEmbedPlugin,
27
+ h5p: h5pEmbedPlugin,
28
+ 'code-block': codeEmbedPlugin,
29
+ external: externalEmbedPlugin,
30
+ iframe: iframeEmbedPlugin,
31
+ footnote: footnoteEmbedPlugin,
32
+ brightcove: brightcoveEmbedPlugin,
33
+ 'related-content': relatedContentEmbedPlugin,
34
+ 'content-link': contentLinkEmbedPlugin,
35
+ concept: conceptEmbedPlugin,
36
+ 'concept-list': conceptListEmbedPlugin,
37
+ file: fileEmbedPlugin,
38
38
  };
@@ -11,7 +11,7 @@ import { RelatedContentMetaData } from '@ndla/types-embed';
11
11
  import { RelatedContentEmbed } from '@ndla/ui';
12
12
  import { PluginType } from '../types';
13
13
 
14
- export const RelatedContentEmbedPlugin: PluginType = (element, _, opts) => {
14
+ export const relatedContentEmbedPlugin: PluginType = (element, _, opts) => {
15
15
  const props = attributesToProps(element.attribs);
16
16
  const data = JSON.parse(props['data-json']) as RelatedContentMetaData;
17
17
  return <RelatedContentEmbed embed={data} subject={opts.subject} ndlaFrontendDomain={opts.frontendDomain} />;
@@ -8,7 +8,7 @@
8
8
 
9
9
  import { attributesToProps, domToReact } from 'html-react-parser';
10
10
  import { PluginType } from './types';
11
- export const H3Plugin: PluginType = (node, opts) => {
11
+ export const h3Plugin: PluginType = (node, opts) => {
12
12
  const props = attributesToProps(node.attribs);
13
13
  return (
14
14
  // eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
@@ -6,31 +6,33 @@
6
6
  *
7
7
  */
8
8
 
9
- import { CopyParagraphPlugin } from './CopyParagraphPlugin';
9
+ import { copyParagraphPlugin } from './copyParagraphPlugin';
10
10
  import { PluginType } from './types';
11
- import { OLPlugin } from './OLPlugin';
12
- import { ParagraphPlugin } from './ParagraphPlugin';
13
- import { SpanPlugin } from './SpanPlugin';
14
- import { H3Plugin } from './H3Plugin';
15
- import { MathPlugin } from './MathPlugin';
16
- import { AnchorPlugin } from './oembed/AnchorPlugin';
17
- import { DivPlugin } from './DivPlugin';
18
- import { TablePlugin } from './TablePlugin';
19
- import { AsidePlugin } from './AsidePlugin';
11
+ import { olPlugin } from './olPlugin';
12
+ import { paragraphPlugin } from './paragraphPlugin';
13
+ import { spanPlugin } from './spanPlugin';
14
+ import { h3Plugin } from './h3Plugin';
15
+ import { mathPlugin } from './mathPlugin';
16
+ import { anchorPlugin } from './oembed/anchorPlugin';
17
+ import { divPlugin } from './divPlugin';
18
+ import { tablePlugin } from './tablePlugin';
19
+ import { asidePlugin } from './asidePlugin';
20
+ import { ulPlugin } from './ulPlugin';
20
21
 
21
22
  export const basePlugins: Record<string, PluginType> = {
22
- h2: CopyParagraphPlugin,
23
- h3: H3Plugin,
24
- ol: OLPlugin,
25
- p: ParagraphPlugin,
26
- span: SpanPlugin,
27
- math: MathPlugin,
28
- div: DivPlugin,
29
- table: TablePlugin,
30
- aside: AsidePlugin,
23
+ h2: copyParagraphPlugin,
24
+ h3: h3Plugin,
25
+ ol: olPlugin,
26
+ p: paragraphPlugin,
27
+ span: spanPlugin,
28
+ math: mathPlugin,
29
+ div: divPlugin,
30
+ table: tablePlugin,
31
+ aside: asidePlugin,
32
+ ul: ulPlugin,
31
33
  };
32
34
 
33
35
  export const oembedPlugins: Record<string, PluginType> = {
34
36
  ...basePlugins,
35
- a: AnchorPlugin,
37
+ a: anchorPlugin,
36
38
  };
@@ -8,7 +8,7 @@
8
8
 
9
9
  import { attributesToProps } from 'html-react-parser';
10
10
  import { PluginType } from './types';
11
- export const MathPlugin: PluginType = (node) => {
11
+ export const mathPlugin: PluginType = (node) => {
12
12
  const props = attributesToProps(node.attribs);
13
13
  return <span dangerouslySetInnerHTML={{ __html: `<math display="block">${props['data-math']}</math>` }} />;
14
14
  };
@@ -8,7 +8,7 @@
8
8
 
9
9
  import { attributesToProps, domToReact } from 'html-react-parser';
10
10
  import { PluginType } from '../types';
11
- export const AnchorPlugin: PluginType = (node, options) => {
11
+ export const anchorPlugin: PluginType = (node, options) => {
12
12
  const props = attributesToProps(node.attribs);
13
13
  return (
14
14
  <a {...props} target="_blank">
@@ -8,7 +8,7 @@
8
8
 
9
9
  import { attributesToProps, domToReact } from 'html-react-parser';
10
10
  import { PluginType } from './types';
11
- export const OLPlugin: PluginType = (node, opts) => {
11
+ export const olPlugin: PluginType = (node, opts) => {
12
12
  const props = attributesToProps(node.attribs);
13
13
  const letterClass = node.attribs['data-type'] === 'letters' ? 'ol-list--roman' : false;
14
14
  const num = node.attribs['start'];
@@ -8,7 +8,7 @@
8
8
 
9
9
  import { attributesToProps, domToReact } from 'html-react-parser';
10
10
  import { PluginType } from './types';
11
- export const ParagraphPlugin: PluginType = (node, opts) => {
11
+ export const paragraphPlugin: PluginType = (node, opts) => {
12
12
  if (node.attribs['data-align'] === 'center') {
13
13
  const props = attributesToProps(node.attribs);
14
14
  const classes = [node.attribs.class ?? '', 'u-text-center'].filter((c) => !!c).join(' ');
@@ -8,7 +8,7 @@
8
8
 
9
9
  import { attributesToProps, domToReact } from 'html-react-parser';
10
10
  import { PluginType } from './types';
11
- export const SpanPlugin: PluginType = (node, opts) => {
11
+ export const spanPlugin: PluginType = (node, opts) => {
12
12
  if (node.attribs['data-size'] === 'large') {
13
13
  const props = attributesToProps(node.attribs);
14
14
  return (
@@ -9,7 +9,7 @@
9
9
  import { Table } from '@ndla/ui';
10
10
  import { attributesToProps, domToReact } from 'html-react-parser';
11
11
  import { PluginType } from './types';
12
- export const TablePlugin: PluginType = (node, opts) => {
12
+ export const tablePlugin: PluginType = (node, opts) => {
13
13
  const props = attributesToProps(node.attribs);
14
14
  return <Table {...props}>{domToReact(node.children, opts)}</Table>;
15
15
  };
@@ -8,7 +8,7 @@
8
8
 
9
9
  import { attributesToProps, domToReact } from 'html-react-parser';
10
10
  import { PluginType } from './types';
11
- export const OLPlugin: PluginType = (node, opts) => {
11
+ export const ulPlugin: PluginType = (node, opts) => {
12
12
  if (node.attribs['data-type'] === 'two-column') {
13
13
  const props = attributesToProps(node.attribs);
14
14
  const classes = [node.attribs.class ?? '', 'o-list--two-columns'].filter((c) => !!c).join(' ');
@@ -1,9 +0,0 @@
1
- /**
2
- * Copyright (c) 2023-present, NDLA.
3
- *
4
- * This source code is licensed under the GPLv3 license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- */
8
- import { PluginType } from './types';
9
- export declare const ParagraphPlugin: PluginType;
@@ -1,9 +0,0 @@
1
- /**
2
- * Copyright (c) 2023-present, NDLA.
3
- *
4
- * This source code is licensed under the GPLv3 license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- */
8
- import { PluginType } from './types';
9
- export declare const SpanPlugin: PluginType;
@@ -1,9 +0,0 @@
1
- /**
2
- * Copyright (c) 2023-present, NDLA.
3
- *
4
- * This source code is licensed under the GPLv3 license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- */
8
- import { PluginType } from './types';
9
- export declare const TablePlugin: PluginType;
@@ -1,9 +0,0 @@
1
- /**
2
- * Copyright (c) 2023-present, NDLA.
3
- *
4
- * This source code is licensed under the GPLv3 license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- */
8
- import { PluginType } from '../types';
9
- export declare const ConceptListEmbedPlugin: PluginType;
@@ -1,9 +0,0 @@
1
- /**
2
- * Copyright (c) 2023-present, NDLA.
3
- *
4
- * This source code is licensed under the GPLv3 license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- */
8
- import { PluginType } from '../types';
9
- export declare const ContentLinkEmbedPlugin: PluginType;
@@ -1,9 +0,0 @@
1
- /**
2
- * Copyright (c) 2023-present, NDLA.
3
- *
4
- * This source code is licensed under the GPLv3 license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- */
8
- import { PluginType } from '../types';
9
- export declare const FootnoteEmbedPlugin: PluginType;
@@ -1,9 +0,0 @@
1
- /**
2
- * Copyright (c) 2023-present, NDLA.
3
- *
4
- * This source code is licensed under the GPLv3 license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- */
8
- import { PluginType } from '../types';
9
- export declare const IframeEmbedPlugin: PluginType;
@@ -1,9 +0,0 @@
1
- /**
2
- * Copyright (c) 2023-present, NDLA.
3
- *
4
- * This source code is licensed under the GPLv3 license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- */
8
- import { PluginType } from '../types';
9
- export declare const ImageEmbedPlugin: PluginType;
@@ -1,9 +0,0 @@
1
- /**
2
- * Copyright (c) 2023-present, NDLA.
3
- *
4
- * This source code is licensed under the GPLv3 license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- */
8
- import { PluginType } from '../types';
9
- export declare const RelatedContentEmbedPlugin: PluginType;