@manuscripts/transform 2.1.12-LEAN-3514.1 → 2.1.12-LEAN-3144-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.
@@ -36,4 +36,67 @@ exports.bibliographyItem = {
36
36
  },
37
37
  selectable: false,
38
38
  group: 'block',
39
+ parseDOM: [
40
+ {
41
+ tag: 'div.csl-entry',
42
+ getAttrs: (p) => {
43
+ const dom = p;
44
+ return {
45
+ id: dom.getAttribute('id'),
46
+ type: dom.getAttribute('data-type'),
47
+ author: dom.getAttribute('data-author') || undefined,
48
+ issued: dom.getAttribute('data-issued') || undefined,
49
+ containerTitle: dom.getAttribute('data-container-title') || undefined,
50
+ doi: dom.getAttribute('data-doi') || undefined,
51
+ volume: dom.getAttribute('data-volume') || undefined,
52
+ issue: dom.getAttribute('data-issue') || undefined,
53
+ supplement: dom.getAttribute('data-supplement') || undefined,
54
+ page: dom.getAttribute('data-page') || undefined,
55
+ title: dom.getAttribute('data-title') || undefined,
56
+ literal: dom.getAttribute('data-literal') || undefined,
57
+ };
58
+ },
59
+ },
60
+ ],
61
+ toDOM: (node) => {
62
+ const bibliographyItemNode = node;
63
+ const attrs = {};
64
+ attrs.class = 'csl-entry';
65
+ const { id, type, author, issued, containerTitle, doi, volume, issue, supplement, page, title, literal, } = bibliographyItemNode.attrs;
66
+ attrs.id = id;
67
+ if (type) {
68
+ attrs['data-type'] = type;
69
+ }
70
+ if (author) {
71
+ attrs['data-author'] = author.join(',');
72
+ }
73
+ if (issued) {
74
+ attrs['data-issued'] = issued;
75
+ }
76
+ if (containerTitle) {
77
+ attrs['data-container-title'] = containerTitle;
78
+ }
79
+ if (doi) {
80
+ attrs['data-doi'] = doi;
81
+ }
82
+ if (volume) {
83
+ attrs['data-volume'] = volume;
84
+ }
85
+ if (issue) {
86
+ attrs['data-issue'] = issue;
87
+ }
88
+ if (supplement) {
89
+ attrs['data-supplement'] = supplement;
90
+ }
91
+ if (page) {
92
+ attrs['data-page'] = page;
93
+ }
94
+ if (title) {
95
+ attrs['data-title'] = title;
96
+ }
97
+ if (literal) {
98
+ attrs['data-literal'] = literal;
99
+ }
100
+ return ['div', attrs, 0];
101
+ },
39
102
  };
@@ -43,7 +43,7 @@ exports.inlineFootnote = {
43
43
  const footnoteNode = node;
44
44
  const dom = document.createElement('span');
45
45
  dom.className = 'footnote';
46
- dom.setAttribute('data-reference-id', footnoteNode.attrs.rids.join(''));
46
+ dom.setAttribute('data-reference-id', footnoteNode.attrs.rids.join(' '));
47
47
  dom.textContent = footnoteNode.attrs.contents;
48
48
  return dom;
49
49
  },
@@ -33,4 +33,67 @@ export const bibliographyItem = {
33
33
  },
34
34
  selectable: false,
35
35
  group: 'block',
36
+ parseDOM: [
37
+ {
38
+ tag: 'div.csl-entry',
39
+ getAttrs: (p) => {
40
+ const dom = p;
41
+ return {
42
+ id: dom.getAttribute('id'),
43
+ type: dom.getAttribute('data-type'),
44
+ author: dom.getAttribute('data-author') || undefined,
45
+ issued: dom.getAttribute('data-issued') || undefined,
46
+ containerTitle: dom.getAttribute('data-container-title') || undefined,
47
+ doi: dom.getAttribute('data-doi') || undefined,
48
+ volume: dom.getAttribute('data-volume') || undefined,
49
+ issue: dom.getAttribute('data-issue') || undefined,
50
+ supplement: dom.getAttribute('data-supplement') || undefined,
51
+ page: dom.getAttribute('data-page') || undefined,
52
+ title: dom.getAttribute('data-title') || undefined,
53
+ literal: dom.getAttribute('data-literal') || undefined,
54
+ };
55
+ },
56
+ },
57
+ ],
58
+ toDOM: (node) => {
59
+ const bibliographyItemNode = node;
60
+ const attrs = {};
61
+ attrs.class = 'csl-entry';
62
+ const { id, type, author, issued, containerTitle, doi, volume, issue, supplement, page, title, literal, } = bibliographyItemNode.attrs;
63
+ attrs.id = id;
64
+ if (type) {
65
+ attrs['data-type'] = type;
66
+ }
67
+ if (author) {
68
+ attrs['data-author'] = author.join(',');
69
+ }
70
+ if (issued) {
71
+ attrs['data-issued'] = issued;
72
+ }
73
+ if (containerTitle) {
74
+ attrs['data-container-title'] = containerTitle;
75
+ }
76
+ if (doi) {
77
+ attrs['data-doi'] = doi;
78
+ }
79
+ if (volume) {
80
+ attrs['data-volume'] = volume;
81
+ }
82
+ if (issue) {
83
+ attrs['data-issue'] = issue;
84
+ }
85
+ if (supplement) {
86
+ attrs['data-supplement'] = supplement;
87
+ }
88
+ if (page) {
89
+ attrs['data-page'] = page;
90
+ }
91
+ if (title) {
92
+ attrs['data-title'] = title;
93
+ }
94
+ if (literal) {
95
+ attrs['data-literal'] = literal;
96
+ }
97
+ return ['div', attrs, 0];
98
+ },
36
99
  };
@@ -40,7 +40,7 @@ export const inlineFootnote = {
40
40
  const footnoteNode = node;
41
41
  const dom = document.createElement('span');
42
42
  dom.className = 'footnote';
43
- dom.setAttribute('data-reference-id', footnoteNode.attrs.rids.join(''));
43
+ dom.setAttribute('data-reference-id', footnoteNode.attrs.rids.join(' '));
44
44
  dom.textContent = footnoteNode.attrs.contents;
45
45
  return dom;
46
46
  },
@@ -15,12 +15,11 @@
15
15
  */
16
16
  import { NodeSpec } from 'prosemirror-model';
17
17
  import { ManuscriptNode } from '../types';
18
- import { BibliographicDate, BibliographicName } from "@manuscripts/json-schema";
19
18
  interface Attrs {
20
19
  id: string;
21
20
  type: string;
22
- author?: BibliographicName[];
23
- issued?: BibliographicDate;
21
+ author?: string[];
22
+ issued?: string;
24
23
  containerTitle?: string;
25
24
  doi?: string;
26
25
  volume?: string;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@manuscripts/transform",
3
3
  "description": "ProseMirror transformer for Manuscripts applications",
4
- "version": "2.1.12-LEAN-3514.1",
4
+ "version": "2.1.12-LEAN-3144-0",
5
5
  "repository": "github:Atypon-OpenSource/manuscripts-transform",
6
6
  "license": "Apache-2.0",
7
7
  "main": "dist/cjs",
@@ -78,4 +78,4 @@
78
78
  "rimraf": "^3.0.2",
79
79
  "typescript": "^4.0.5"
80
80
  }
81
- }
81
+ }