@manuscripts/transform 4.3.53 → 4.4.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.
- package/dist/cjs/jats/__tests__/jats-roundtrip.test.js +3 -3
- package/dist/cjs/version.js +1 -1
- package/dist/es/jats/__tests__/jats-roundtrip.test.js +3 -3
- package/dist/es/version.js +1 -1
- package/dist/types/jats/__tests__/utils.d.ts +1 -1
- package/dist/types/version.d.ts +1 -1
- package/package.json +22 -21
- package/src/errors.ts +28 -0
- package/src/getVersion.ts +21 -0
- package/src/index.ts +28 -0
- package/src/jats/__tests__/__fixtures__/debug-example.xml +136 -0
- package/src/jats/__tests__/__fixtures__/jats-abstract-no-body.xml +163 -0
- package/src/jats/__tests__/__fixtures__/jats-citations.xml +472 -0
- package/src/jats/__tests__/__fixtures__/jats-comments.xml +46 -0
- package/src/jats/__tests__/__fixtures__/jats-document.xml +134 -0
- package/src/jats/__tests__/__fixtures__/jats-example-doc.xml +1235 -0
- package/src/jats/__tests__/__fixtures__/jats-example-front-only.xml +26 -0
- package/src/jats/__tests__/__fixtures__/jats-example-full.xml +209 -0
- package/src/jats/__tests__/__fixtures__/jats-example-no-back.xml +156 -0
- package/src/jats/__tests__/__fixtures__/jats-example-no-body.xml +91 -0
- package/src/jats/__tests__/__fixtures__/jats-example.xml +221 -0
- package/src/jats/__tests__/__fixtures__/jats-fn-group.xml +60 -0
- package/src/jats/__tests__/__fixtures__/jats-import-no-refs.xml +1077 -0
- package/src/jats/__tests__/__fixtures__/jats-import.xml +1561 -0
- package/src/jats/__tests__/__fixtures__/jats-roundtrip.xml +133 -0
- package/src/jats/__tests__/__fixtures__/jats-tables-example.xml +2043 -0
- package/src/jats/__tests__/__fixtures__/math-fragment.xml +12 -0
- package/src/jats/__tests__/__snapshots__/citeproc.test.ts.snap +57 -0
- package/src/jats/__tests__/__snapshots__/create-article-node.test.ts.snap +65 -0
- package/src/jats/__tests__/__snapshots__/jats-exporter.test.ts.snap +7 -0
- package/src/jats/__tests__/__snapshots__/jats-importer.test.ts.snap +59605 -0
- package/src/jats/__tests__/__snapshots__/jats-roundtrip.test.ts.snap +18 -0
- package/src/jats/__tests__/citations.ts +25 -0
- package/src/jats/__tests__/citeproc.test.ts +195 -0
- package/src/jats/__tests__/create-article-node.test.ts +29 -0
- package/src/jats/__tests__/data/section-categories.ts +212 -0
- package/src/jats/__tests__/files.ts +24 -0
- package/src/jats/__tests__/jats-exporter.test.ts +223 -0
- package/src/jats/__tests__/jats-importer.test.ts +567 -0
- package/src/jats/__tests__/jats-roundtrip.test.ts +66 -0
- package/src/jats/__tests__/utils.ts +90 -0
- package/src/jats/exporter/citeproc.ts +265 -0
- package/src/jats/exporter/jats-exporter.ts +2090 -0
- package/src/jats/exporter/jats-versions.ts +50 -0
- package/src/jats/exporter/labels.ts +101 -0
- package/src/jats/importer/create-article-node.ts +52 -0
- package/src/jats/importer/jats-comments.ts +111 -0
- package/src/jats/importer/jats-dom-parser.ts +1260 -0
- package/src/jats/importer/jats-parser-utils.ts +234 -0
- package/src/jats/importer/jats-transformations.ts +591 -0
- package/src/jats/importer/parse-jats-article.ts +106 -0
- package/src/jats/index.ts +21 -0
- package/src/jats/types.ts +16 -0
- package/src/lib/__tests__/footnotes.test.ts +36 -0
- package/src/lib/citeproc.ts +30 -0
- package/src/lib/credit-roles.ts +91 -0
- package/src/lib/deafults.ts +17 -0
- package/src/lib/footnotes.ts +85 -0
- package/src/lib/html.ts +56 -0
- package/src/lib/section-categories.ts +27 -0
- package/src/lib/utils.ts +145 -0
- package/src/lib/xml.ts +28 -0
- package/src/schema/__tests__/docs.ts +1911 -0
- package/src/schema/__tests__/groups.test.ts +61 -0
- package/src/schema/__tests__/migration.test.ts +23 -0
- package/src/schema/groups.ts +36 -0
- package/src/schema/index.ts +286 -0
- package/src/schema/marks.ts +254 -0
- package/src/schema/migration/migrate.ts +77 -0
- package/src/schema/migration/migration-script.ts +26 -0
- package/src/schema/migration/migration-scripts/1.2.5.ts +44 -0
- package/src/schema/migration/migration-scripts/2.3.22.ts +52 -0
- package/src/schema/migration/migration-scripts/3.0.12.ts +33 -0
- package/src/schema/migration/migration-scripts/3.0.21.ts +50 -0
- package/src/schema/migration/migration-scripts/3.0.30.ts +65 -0
- package/src/schema/migration/migration-scripts/3.0.31.ts +40 -0
- package/src/schema/migration/migration-scripts/3.0.41.ts +37 -0
- package/src/schema/migration/migration-scripts/3.0.55.ts +42 -0
- package/src/schema/migration/migration-scripts/3.0.56.ts +114 -0
- package/src/schema/migration/migration-scripts/4.2.13.ts +37 -0
- package/src/schema/migration/migration-scripts/4.2.15.ts +48 -0
- package/src/schema/migration/migration-scripts/4.3.23.ts +55 -0
- package/src/schema/migration/migration-scripts/4.3.34.ts +132 -0
- package/src/schema/migration/migration-scripts/4.3.35.ts +41 -0
- package/src/schema/migration/migration-scripts/index.ts +49 -0
- package/src/schema/nodes/abstracts.ts +29 -0
- package/src/schema/nodes/affiliation.ts +88 -0
- package/src/schema/nodes/affiliations.ts +30 -0
- package/src/schema/nodes/alt_text.ts +36 -0
- package/src/schema/nodes/alt_title.ts +40 -0
- package/src/schema/nodes/alt_titles_section.ts +58 -0
- package/src/schema/nodes/attachment.ts +46 -0
- package/src/schema/nodes/attachments.ts +45 -0
- package/src/schema/nodes/attribution.ts +38 -0
- package/src/schema/nodes/author_notes.ts +44 -0
- package/src/schema/nodes/award.ts +52 -0
- package/src/schema/nodes/awards.ts +45 -0
- package/src/schema/nodes/backmatter.ts +31 -0
- package/src/schema/nodes/bibliography_element.ts +58 -0
- package/src/schema/nodes/bibliography_item.ts +108 -0
- package/src/schema/nodes/bibliography_section.ts +60 -0
- package/src/schema/nodes/blockquote_element.ts +79 -0
- package/src/schema/nodes/body.ts +29 -0
- package/src/schema/nodes/box_element.ts +67 -0
- package/src/schema/nodes/caption.ts +67 -0
- package/src/schema/nodes/caption_title.ts +67 -0
- package/src/schema/nodes/citation.ts +70 -0
- package/src/schema/nodes/comment.ts +50 -0
- package/src/schema/nodes/comments.ts +28 -0
- package/src/schema/nodes/contributor.ts +87 -0
- package/src/schema/nodes/contributors.ts +40 -0
- package/src/schema/nodes/core_section.ts +27 -0
- package/src/schema/nodes/corresp.ts +49 -0
- package/src/schema/nodes/cross_reference.ts +64 -0
- package/src/schema/nodes/doc.ts +21 -0
- package/src/schema/nodes/embed.ts +55 -0
- package/src/schema/nodes/equation.ts +65 -0
- package/src/schema/nodes/equation_element.ts +61 -0
- package/src/schema/nodes/figure.ts +65 -0
- package/src/schema/nodes/figure_element.ts +73 -0
- package/src/schema/nodes/footnote.ts +95 -0
- package/src/schema/nodes/footnotes_element.ts +69 -0
- package/src/schema/nodes/footnotes_section.ts +61 -0
- package/src/schema/nodes/general_table_footnote.ts +42 -0
- package/src/schema/nodes/graphical_abstract_section.ts +62 -0
- package/src/schema/nodes/hard_break.ts +36 -0
- package/src/schema/nodes/hero_image.ts +46 -0
- package/src/schema/nodes/highlight_marker.ts +68 -0
- package/src/schema/nodes/image_element.ts +49 -0
- package/src/schema/nodes/inline_equation.ts +68 -0
- package/src/schema/nodes/inline_footnote.ts +66 -0
- package/src/schema/nodes/keyword.ts +61 -0
- package/src/schema/nodes/keyword_group.ts +63 -0
- package/src/schema/nodes/keywords.ts +59 -0
- package/src/schema/nodes/keywords_element.ts +64 -0
- package/src/schema/nodes/link.ts +79 -0
- package/src/schema/nodes/list.ts +134 -0
- package/src/schema/nodes/listing.ts +91 -0
- package/src/schema/nodes/listing_element.ts +61 -0
- package/src/schema/nodes/long_desc.ts +36 -0
- package/src/schema/nodes/manuscript.ts +86 -0
- package/src/schema/nodes/missing_figure.ts +59 -0
- package/src/schema/nodes/paragraph.ts +77 -0
- package/src/schema/nodes/placeholder.ts +62 -0
- package/src/schema/nodes/placeholder_element.ts +60 -0
- package/src/schema/nodes/pullquote_element.ts +81 -0
- package/src/schema/nodes/quote_image.ts +64 -0
- package/src/schema/nodes/section.ts +69 -0
- package/src/schema/nodes/section_label.ts +39 -0
- package/src/schema/nodes/section_title.ts +58 -0
- package/src/schema/nodes/subtitle.ts +40 -0
- package/src/schema/nodes/subtitles.ts +51 -0
- package/src/schema/nodes/supplement.ts +77 -0
- package/src/schema/nodes/supplements.ts +60 -0
- package/src/schema/nodes/table.ts +144 -0
- package/src/schema/nodes/table_col.ts +76 -0
- package/src/schema/nodes/table_element.ts +67 -0
- package/src/schema/nodes/table_element_footer.ts +42 -0
- package/src/schema/nodes/text.ts +31 -0
- package/src/schema/nodes/title.ts +43 -0
- package/src/schema/nodes/trans_abstract.ts +58 -0
- package/src/schema/nodes/trans_graphical_abstract.ts +67 -0
- package/src/schema/types.ts +240 -0
- package/src/tests.ts +33 -0
- package/src/transformer/id.ts +23 -0
- package/src/transformer/index.ts +21 -0
- package/src/transformer/node-names.ts +73 -0
- package/src/transformer/node-title.ts +111 -0
- package/src/transformer/node-types.ts +39 -0
- package/src/transformer/node-validator.ts +82 -0
- package/src/types.ts +25 -0
- package/src/version.ts +1 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2019 Atypon Systems LLC
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { NodeSpec } from 'prosemirror-model'
|
|
18
|
+
|
|
19
|
+
import { ManuscriptNode } from '../types'
|
|
20
|
+
|
|
21
|
+
interface Attrs {
|
|
22
|
+
id: string
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface AuthorNotesNode extends ManuscriptNode {
|
|
26
|
+
attrs: Attrs
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export const authorNotes: NodeSpec = {
|
|
30
|
+
attrs: {
|
|
31
|
+
id: { default: '' },
|
|
32
|
+
dataTracked: { default: null },
|
|
33
|
+
},
|
|
34
|
+
content: 'section_title (corresp | footnote | paragraph)+',
|
|
35
|
+
group: 'block element',
|
|
36
|
+
toDOM: (node) => [
|
|
37
|
+
'div',
|
|
38
|
+
{
|
|
39
|
+
class: 'author-notes',
|
|
40
|
+
id: node.attrs.id,
|
|
41
|
+
},
|
|
42
|
+
0,
|
|
43
|
+
],
|
|
44
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2024 Atypon Systems LLC
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { NodeSpec } from 'prosemirror-model'
|
|
18
|
+
|
|
19
|
+
import { ManuscriptNode } from '../types'
|
|
20
|
+
|
|
21
|
+
interface Attrs {
|
|
22
|
+
id: string
|
|
23
|
+
recipient: string
|
|
24
|
+
code: string
|
|
25
|
+
source: string
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface AwardNode extends ManuscriptNode {
|
|
29
|
+
attrs: Attrs
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export const award: NodeSpec = {
|
|
33
|
+
attrs: {
|
|
34
|
+
id: { default: '' },
|
|
35
|
+
recipient: { default: undefined },
|
|
36
|
+
code: { default: undefined },
|
|
37
|
+
source: { default: undefined },
|
|
38
|
+
dataTracked: { default: null },
|
|
39
|
+
},
|
|
40
|
+
toDOM: (node) => {
|
|
41
|
+
return [
|
|
42
|
+
'div',
|
|
43
|
+
{
|
|
44
|
+
class: 'award',
|
|
45
|
+
id: node.attrs.id,
|
|
46
|
+
},
|
|
47
|
+
]
|
|
48
|
+
},
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export const isAwardNode = (node: ManuscriptNode): node is AwardNode =>
|
|
52
|
+
node.type === node.type.schema.nodes.award
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2024 Atypon Systems LLC
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { NodeSpec } from 'prosemirror-model'
|
|
18
|
+
|
|
19
|
+
import { ManuscriptNode } from '../types'
|
|
20
|
+
|
|
21
|
+
interface Attrs {
|
|
22
|
+
id: string
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface AwardsNode extends ManuscriptNode {
|
|
26
|
+
attrs: Attrs
|
|
27
|
+
}
|
|
28
|
+
export const awards: NodeSpec = {
|
|
29
|
+
content: 'award*',
|
|
30
|
+
attrs: {
|
|
31
|
+
id: { default: '' },
|
|
32
|
+
},
|
|
33
|
+
toDOM: (node) => {
|
|
34
|
+
return [
|
|
35
|
+
'div',
|
|
36
|
+
{
|
|
37
|
+
class: 'awards',
|
|
38
|
+
id: node.attrs.id,
|
|
39
|
+
},
|
|
40
|
+
]
|
|
41
|
+
},
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export const isAwardsNode = (node: ManuscriptNode): node is AwardsNode =>
|
|
45
|
+
node.type === node.type.schema.nodes.awards
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2019 Atypon Systems LLC
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { NodeSpec } from 'prosemirror-model'
|
|
18
|
+
|
|
19
|
+
// This node has no representation in json-schema
|
|
20
|
+
// It exists for the purpose of styling in the UI
|
|
21
|
+
|
|
22
|
+
export const backmatter: NodeSpec = {
|
|
23
|
+
content: 'sections*',
|
|
24
|
+
attrs: {
|
|
25
|
+
id: { default: '' },
|
|
26
|
+
placeholder: { default: ' ' },
|
|
27
|
+
},
|
|
28
|
+
group: 'block element',
|
|
29
|
+
parseDOM: [{ tag: 'div.backmatter' }],
|
|
30
|
+
toDOM: () => ['div', { class: 'backmatter' }, 0],
|
|
31
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2019 Atypon Systems LLC
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { NodeSpec } from 'prosemirror-model'
|
|
18
|
+
|
|
19
|
+
import { ManuscriptNode } from '../types'
|
|
20
|
+
|
|
21
|
+
interface Attrs {
|
|
22
|
+
id: string
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface BibliographyElementNode extends ManuscriptNode {
|
|
26
|
+
attrs: Attrs
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export const bibliographyElement: NodeSpec = {
|
|
30
|
+
content: 'bibliography_item*',
|
|
31
|
+
attrs: {
|
|
32
|
+
id: { default: '' },
|
|
33
|
+
contents: { default: '' },
|
|
34
|
+
dataTracked: { default: null },
|
|
35
|
+
},
|
|
36
|
+
selectable: false,
|
|
37
|
+
group: 'block element',
|
|
38
|
+
parseDOM: [
|
|
39
|
+
{
|
|
40
|
+
tag: 'div.csl-bib-body',
|
|
41
|
+
getAttrs: () => {
|
|
42
|
+
return {
|
|
43
|
+
contents: '',
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
],
|
|
48
|
+
toDOM: () => {
|
|
49
|
+
const dom = document.createElement('div')
|
|
50
|
+
dom.className = 'csl-bib-body'
|
|
51
|
+
return dom
|
|
52
|
+
},
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export const isBibliographyElementNode = (
|
|
56
|
+
node: ManuscriptNode
|
|
57
|
+
): node is BibliographyElementNode =>
|
|
58
|
+
node.type === node.type.schema.nodes.bibliography_element
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2022 Atypon Systems LLC
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { NodeSpec } from 'prosemirror-model'
|
|
18
|
+
|
|
19
|
+
import { ManuscriptNode } from '../types'
|
|
20
|
+
|
|
21
|
+
export type BibliographyItemType =
|
|
22
|
+
| 'article-journal' //journal
|
|
23
|
+
| 'book'
|
|
24
|
+
| 'chapter'
|
|
25
|
+
| 'confproc'
|
|
26
|
+
| 'thesis'
|
|
27
|
+
| 'webpage'
|
|
28
|
+
| 'other'
|
|
29
|
+
| 'standard'
|
|
30
|
+
| 'dataset'
|
|
31
|
+
| 'preprint'
|
|
32
|
+
| 'literal'
|
|
33
|
+
|
|
34
|
+
export interface BibliographyItemAttrs {
|
|
35
|
+
id: string
|
|
36
|
+
type: BibliographyItemType
|
|
37
|
+
author?: CSL.Person[]
|
|
38
|
+
issued?: CSL.Date
|
|
39
|
+
'container-title'?: string
|
|
40
|
+
volume?: string
|
|
41
|
+
issue?: string
|
|
42
|
+
supplement?: string
|
|
43
|
+
page?: string
|
|
44
|
+
title?: string
|
|
45
|
+
literal?: string
|
|
46
|
+
std?: string
|
|
47
|
+
'collection-title'?: string
|
|
48
|
+
edition?: string
|
|
49
|
+
'publisher-place'?: string
|
|
50
|
+
publisher?: string
|
|
51
|
+
event?: string
|
|
52
|
+
'event-place'?: string
|
|
53
|
+
'event-date'?: CSL.Date
|
|
54
|
+
institution?: string
|
|
55
|
+
editor?: CSL.Person[]
|
|
56
|
+
locator?: string
|
|
57
|
+
URL?: string
|
|
58
|
+
'number-of-pages'?: string
|
|
59
|
+
accessed?: CSL.Date // date-in-citation
|
|
60
|
+
DOI?: string
|
|
61
|
+
comment?: string
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export interface BibliographyItemNode extends ManuscriptNode {
|
|
65
|
+
attrs: BibliographyItemAttrs
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export const bibliographyItem: NodeSpec = {
|
|
69
|
+
// this is to help the prosemirror decoration to reach HTML of this node
|
|
70
|
+
attrs: {
|
|
71
|
+
id: { default: '' },
|
|
72
|
+
type: { default: undefined },
|
|
73
|
+
author: { default: undefined },
|
|
74
|
+
DOI: { default: undefined },
|
|
75
|
+
issued: { default: undefined },
|
|
76
|
+
'container-title': { default: undefined },
|
|
77
|
+
volume: { default: undefined },
|
|
78
|
+
issue: { default: undefined },
|
|
79
|
+
supplement: { default: undefined },
|
|
80
|
+
page: { default: undefined },
|
|
81
|
+
title: { default: undefined },
|
|
82
|
+
literal: { default: undefined },
|
|
83
|
+
std: { default: undefined },
|
|
84
|
+
'collection-title': { default: undefined },
|
|
85
|
+
edition: { default: undefined },
|
|
86
|
+
publisher: { default: undefined }, //publisher-name
|
|
87
|
+
'publisher-place': { default: undefined }, //publisher-loc
|
|
88
|
+
event: { default: undefined }, //conf-name
|
|
89
|
+
'event-place': { default: undefined }, //conf-loc
|
|
90
|
+
'event-date': { default: undefined }, //conf-date
|
|
91
|
+
institution: { default: undefined },
|
|
92
|
+
editor: { default: undefined },
|
|
93
|
+
locator: { default: undefined },
|
|
94
|
+
'number-of-pages': { default: undefined }, //size @unit=pages
|
|
95
|
+
pubIDs: { default: undefined },
|
|
96
|
+
accessed: { default: undefined },
|
|
97
|
+
URL: { default: undefined },
|
|
98
|
+
comment: { default: undefined },
|
|
99
|
+
dataTracked: { default: null },
|
|
100
|
+
},
|
|
101
|
+
selectable: false,
|
|
102
|
+
group: 'block',
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export const isBibliographyItemNode = (
|
|
106
|
+
node: ManuscriptNode
|
|
107
|
+
): node is BibliographyItemNode =>
|
|
108
|
+
node.type === node.type.schema.nodes.bibliography_item
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2019 Atypon Systems LLC
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { NodeSpec } from 'prosemirror-model'
|
|
18
|
+
|
|
19
|
+
import { ManuscriptNode } from '../types'
|
|
20
|
+
|
|
21
|
+
interface Attrs {
|
|
22
|
+
id: string
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface BibliographySectionNode extends ManuscriptNode {
|
|
26
|
+
attrs: Attrs
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export const bibliographySection: NodeSpec = {
|
|
30
|
+
content: 'section_title bibliography_element',
|
|
31
|
+
attrs: {
|
|
32
|
+
id: { default: '' },
|
|
33
|
+
dataTracked: { default: null },
|
|
34
|
+
},
|
|
35
|
+
group: 'block sections',
|
|
36
|
+
selectable: false,
|
|
37
|
+
parseDOM: [
|
|
38
|
+
{
|
|
39
|
+
tag: 'section.bibliography',
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
toDOM: (node) => {
|
|
43
|
+
const bibliographySectionNode = node as BibliographySectionNode
|
|
44
|
+
|
|
45
|
+
return [
|
|
46
|
+
'section',
|
|
47
|
+
{
|
|
48
|
+
id: bibliographySectionNode.attrs.id,
|
|
49
|
+
class: 'bibliography',
|
|
50
|
+
spellcheck: 'false',
|
|
51
|
+
},
|
|
52
|
+
0,
|
|
53
|
+
]
|
|
54
|
+
},
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export const isBibliographySectionNode = (
|
|
58
|
+
node: ManuscriptNode
|
|
59
|
+
): node is BibliographySectionNode =>
|
|
60
|
+
node.type === node.type.schema.nodes.bibliography_section
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2019 Atypon Systems LLC
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { NodeSpec } from 'prosemirror-model'
|
|
18
|
+
|
|
19
|
+
import { ManuscriptNode } from '../types'
|
|
20
|
+
|
|
21
|
+
interface Attrs {
|
|
22
|
+
id: string
|
|
23
|
+
placeholder: string
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface BlockquoteElementNode extends ManuscriptNode {
|
|
27
|
+
attrs: Attrs
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export const blockquoteElement: NodeSpec = {
|
|
31
|
+
content: 'text_block+ attribution',
|
|
32
|
+
attrs: {
|
|
33
|
+
id: { default: '' },
|
|
34
|
+
placeholder: { default: '' },
|
|
35
|
+
dataTracked: { default: null },
|
|
36
|
+
},
|
|
37
|
+
group: 'block element',
|
|
38
|
+
selectable: false,
|
|
39
|
+
parseDOM: [
|
|
40
|
+
{
|
|
41
|
+
tag: 'blockquote',
|
|
42
|
+
getAttrs: (blockquote) => {
|
|
43
|
+
const dom = blockquote as HTMLQuoteElement
|
|
44
|
+
|
|
45
|
+
const attrs: Partial<Attrs> = {
|
|
46
|
+
id: dom.getAttribute('id') || undefined,
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const placeholder = dom.getAttribute('data-placeholder-text')
|
|
50
|
+
|
|
51
|
+
if (placeholder) {
|
|
52
|
+
attrs.placeholder = placeholder
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return attrs
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
],
|
|
59
|
+
toDOM: (node) => {
|
|
60
|
+
const blockquoteElementNode = node as BlockquoteElementNode
|
|
61
|
+
|
|
62
|
+
const attrs: { [key: string]: string } = {}
|
|
63
|
+
|
|
64
|
+
if (blockquoteElementNode.attrs.id) {
|
|
65
|
+
attrs.id = blockquoteElementNode.attrs.id
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (blockquoteElementNode.attrs.placeholder) {
|
|
69
|
+
attrs['data-placeholder-text'] = blockquoteElementNode.attrs.placeholder
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return ['blockquote', attrs, 0]
|
|
73
|
+
},
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export const isBlockquoteElement = (
|
|
77
|
+
node: ManuscriptNode
|
|
78
|
+
): node is BlockquoteElementNode =>
|
|
79
|
+
node.type === node.type.schema.nodes.blockquote_element
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2019 Atypon Systems LLC
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { NodeSpec } from 'prosemirror-model'
|
|
18
|
+
|
|
19
|
+
// This node has no representation in json-schema
|
|
20
|
+
// It exists for the purpose of styling in the UI
|
|
21
|
+
|
|
22
|
+
export const body: NodeSpec = {
|
|
23
|
+
content: 'element* sections*',
|
|
24
|
+
attrs: {
|
|
25
|
+
id: { default: '' },
|
|
26
|
+
},
|
|
27
|
+
group: 'block',
|
|
28
|
+
toDOM: () => ['div', { class: 'body' }, 0],
|
|
29
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2019 Atypon Systems LLC
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { NodeSpec } from 'prosemirror-model'
|
|
18
|
+
|
|
19
|
+
import { ManuscriptNode } from '../types'
|
|
20
|
+
|
|
21
|
+
export interface BoxElementAttrs {
|
|
22
|
+
id: string
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface BoxElementNode extends ManuscriptNode {
|
|
26
|
+
attrs: BoxElementAttrs
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export const box_element: NodeSpec = {
|
|
30
|
+
content: 'caption_title? caption? section?',
|
|
31
|
+
attrs: {
|
|
32
|
+
id: { default: '' },
|
|
33
|
+
dataTracked: { default: null },
|
|
34
|
+
},
|
|
35
|
+
group: 'block element',
|
|
36
|
+
selectable: false,
|
|
37
|
+
parseDOM: [
|
|
38
|
+
{
|
|
39
|
+
tag: 'div.boxed-text',
|
|
40
|
+
getAttrs: (p) => {
|
|
41
|
+
const dom = p as HTMLParagraphElement
|
|
42
|
+
|
|
43
|
+
const attrs: Partial<BoxElementAttrs> = {
|
|
44
|
+
id: dom.getAttribute('id') || undefined,
|
|
45
|
+
}
|
|
46
|
+
return attrs
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
toDOM: (node) => {
|
|
51
|
+
const boxElementNode = node as BoxElementNode
|
|
52
|
+
|
|
53
|
+
const attrs: { [key: string]: string } = {}
|
|
54
|
+
|
|
55
|
+
if (boxElementNode.attrs.id) {
|
|
56
|
+
attrs.id = boxElementNode.attrs.id
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return [
|
|
60
|
+
'div',
|
|
61
|
+
{
|
|
62
|
+
class: 'boxed-text',
|
|
63
|
+
...attrs,
|
|
64
|
+
},
|
|
65
|
+
]
|
|
66
|
+
},
|
|
67
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2019 Atypon Systems LLC
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { NodeSpec } from 'prosemirror-model'
|
|
18
|
+
|
|
19
|
+
import { ManuscriptNode } from '../types'
|
|
20
|
+
|
|
21
|
+
interface Attrs {
|
|
22
|
+
placeholder: string
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface CaptionNode extends ManuscriptNode {
|
|
26
|
+
attrs: Attrs
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export const caption: NodeSpec = {
|
|
30
|
+
content: 'text_block+',
|
|
31
|
+
attrs: {
|
|
32
|
+
placeholder: { default: 'Caption...' },
|
|
33
|
+
dataTracked: { default: null },
|
|
34
|
+
},
|
|
35
|
+
selectable: false,
|
|
36
|
+
isolating: true,
|
|
37
|
+
group: 'block',
|
|
38
|
+
parseDOM: [
|
|
39
|
+
{
|
|
40
|
+
tag: 'p',
|
|
41
|
+
getAttrs: (node) => {
|
|
42
|
+
const dom = node as HTMLParagraphElement
|
|
43
|
+
|
|
44
|
+
return {
|
|
45
|
+
placeholder: dom.getAttribute('data-placeholder-text'),
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
toDOM: (node) => {
|
|
51
|
+
const captionNode = node as CaptionNode
|
|
52
|
+
|
|
53
|
+
const attrs: { [key: string]: string } = {}
|
|
54
|
+
|
|
55
|
+
attrs.class = 'caption-description'
|
|
56
|
+
|
|
57
|
+
if (captionNode.attrs.placeholder) {
|
|
58
|
+
attrs['data-placeholder-text'] = captionNode.attrs.placeholder
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if (!captionNode.textContent) {
|
|
62
|
+
attrs.class = `${attrs.class} placeholder`
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return ['p', attrs, 0]
|
|
66
|
+
},
|
|
67
|
+
}
|