@manuscripts/transform 1.0.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/LICENSE +201 -0
- package/README.md +193 -0
- package/dist/cjs/errors.js +17 -0
- package/dist/cjs/index.js +27 -0
- package/dist/cjs/jats/importer/index.js +24 -0
- package/dist/cjs/jats/importer/jats-body-dom-parser.js +650 -0
- package/dist/cjs/jats/importer/jats-body-transformations.js +269 -0
- package/dist/cjs/jats/importer/jats-comments.js +131 -0
- package/dist/cjs/jats/importer/jats-front-parser.js +341 -0
- package/dist/cjs/jats/importer/jats-journal-meta-parser.js +77 -0
- package/dist/cjs/jats/importer/jats-parser-utils.js +145 -0
- package/dist/cjs/jats/importer/jats-reference-parser.js +180 -0
- package/dist/cjs/jats/importer/parse-jats-article.js +237 -0
- package/dist/cjs/jats/index.js +40 -0
- package/dist/cjs/jats/jats-exporter.js +1569 -0
- package/dist/cjs/jats/jats-versions.js +41 -0
- package/dist/cjs/lib/attributes.js +26 -0
- package/dist/cjs/lib/html.js +48 -0
- package/dist/cjs/lib/styled-content.js +28 -0
- package/dist/cjs/lib/table-cell-styles.js +52 -0
- package/dist/cjs/lib/utils.js +66 -0
- package/dist/cjs/mathjax/index.js +41 -0
- package/dist/cjs/mathjax/mathjax-packages.js +20 -0
- package/dist/cjs/mathjax/mathml-to-svg.js +56 -0
- package/dist/cjs/mathjax/tex-to-mathml.js +49 -0
- package/dist/cjs/mathjax/tex-to-svg.js +59 -0
- package/dist/cjs/schema/groups.js +31 -0
- package/dist/cjs/schema/index.js +195 -0
- package/dist/cjs/schema/marks.js +159 -0
- package/dist/cjs/schema/nodes/attribution.js +32 -0
- package/dist/cjs/schema/nodes/bibliography_element.js +44 -0
- package/dist/cjs/schema/nodes/bibliography_item.js +101 -0
- package/dist/cjs/schema/nodes/bibliography_section.js +46 -0
- package/dist/cjs/schema/nodes/blockquote_element.js +62 -0
- package/dist/cjs/schema/nodes/caption.js +52 -0
- package/dist/cjs/schema/nodes/caption_title.js +51 -0
- package/dist/cjs/schema/nodes/citation.js +52 -0
- package/dist/cjs/schema/nodes/comment.js +26 -0
- package/dist/cjs/schema/nodes/cross_reference.js +58 -0
- package/dist/cjs/schema/nodes/doc.js +21 -0
- package/dist/cjs/schema/nodes/equation.js +55 -0
- package/dist/cjs/schema/nodes/equation_element.js +52 -0
- package/dist/cjs/schema/nodes/figcaption.js +31 -0
- package/dist/cjs/schema/nodes/figure.js +52 -0
- package/dist/cjs/schema/nodes/figure_element.js +78 -0
- package/dist/cjs/schema/nodes/footnote.js +67 -0
- package/dist/cjs/schema/nodes/footnotes_element.js +54 -0
- package/dist/cjs/schema/nodes/footnotes_section.js +45 -0
- package/dist/cjs/schema/nodes/graphical_abstract_section.js +46 -0
- package/dist/cjs/schema/nodes/hard_break.js +30 -0
- package/dist/cjs/schema/nodes/highlight_marker.js +53 -0
- package/dist/cjs/schema/nodes/inline_equation.js +58 -0
- package/dist/cjs/schema/nodes/inline_footnote.js +51 -0
- package/dist/cjs/schema/nodes/keywords_element.js +52 -0
- package/dist/cjs/schema/nodes/keywords_section.js +46 -0
- package/dist/cjs/schema/nodes/link.js +61 -0
- package/dist/cjs/schema/nodes/list.js +121 -0
- package/dist/cjs/schema/nodes/listing.js +73 -0
- package/dist/cjs/schema/nodes/listing_element.js +52 -0
- package/dist/cjs/schema/nodes/manuscript.js +46 -0
- package/dist/cjs/schema/nodes/missing_figure.js +50 -0
- package/dist/cjs/schema/nodes/paragraph.js +63 -0
- package/dist/cjs/schema/nodes/placeholder.js +49 -0
- package/dist/cjs/schema/nodes/placeholder_element.js +48 -0
- package/dist/cjs/schema/nodes/pullquote_element.js +65 -0
- package/dist/cjs/schema/nodes/section.js +94 -0
- package/dist/cjs/schema/nodes/section_label.js +30 -0
- package/dist/cjs/schema/nodes/section_title.js +48 -0
- package/dist/cjs/schema/nodes/table.js +70 -0
- package/dist/cjs/schema/nodes/table_col.js +57 -0
- package/dist/cjs/schema/nodes/table_element.js +62 -0
- package/dist/cjs/schema/nodes/table_row.js +123 -0
- package/dist/cjs/schema/nodes/text.js +21 -0
- package/dist/cjs/schema/nodes/toc_element.js +52 -0
- package/dist/cjs/schema/nodes/toc_section.js +46 -0
- package/dist/cjs/schema/types.js +17 -0
- package/dist/cjs/tests.js +30 -0
- package/dist/cjs/transformer/builders.js +305 -0
- package/dist/cjs/transformer/bundles-data.js +36 -0
- package/dist/cjs/transformer/bundles.js +32 -0
- package/dist/cjs/transformer/decode.js +619 -0
- package/dist/cjs/transformer/document-object-types.js +31 -0
- package/dist/cjs/transformer/encode.js +545 -0
- package/dist/cjs/transformer/filename.js +27 -0
- package/dist/cjs/transformer/footnote-category.js +20 -0
- package/dist/cjs/transformer/footnotes-order.js +59 -0
- package/dist/cjs/transformer/highlight-markers.js +126 -0
- package/dist/cjs/transformer/html.js +414 -0
- package/dist/cjs/transformer/id.js +28 -0
- package/dist/cjs/transformer/index.js +54 -0
- package/dist/cjs/transformer/labels.js +85 -0
- package/dist/cjs/transformer/manuscript-dependencies.js +74 -0
- package/dist/cjs/transformer/model-map.js +26 -0
- package/dist/cjs/transformer/models.js +17 -0
- package/dist/cjs/transformer/node-names.js +42 -0
- package/dist/cjs/transformer/node-title.js +87 -0
- package/dist/cjs/transformer/node-types.js +62 -0
- package/dist/cjs/transformer/object-types.js +57 -0
- package/dist/cjs/transformer/project-bundle.js +86 -0
- package/dist/cjs/transformer/section-category.js +222 -0
- package/dist/cjs/transformer/serializer.js +23 -0
- package/dist/cjs/transformer/shared-data.js +31 -0
- package/dist/cjs/transformer/tei-grobid-importer.js +121 -0
- package/dist/cjs/transformer/timestamp.js +20 -0
- package/dist/cjs/transformer/update-identifiers.js +93 -0
- package/dist/cjs/types.js +2 -0
- package/dist/es/errors.js +12 -0
- package/dist/es/index.js +9 -0
- package/dist/es/jats/importer/index.js +16 -0
- package/dist/es/jats/importer/jats-body-dom-parser.js +644 -0
- package/dist/es/jats/importer/jats-body-transformations.js +266 -0
- package/dist/es/jats/importer/jats-comments.js +124 -0
- package/dist/es/jats/importer/jats-front-parser.js +335 -0
- package/dist/es/jats/importer/jats-journal-meta-parser.js +70 -0
- package/dist/es/jats/importer/jats-parser-utils.js +139 -0
- package/dist/es/jats/importer/jats-reference-parser.js +177 -0
- package/dist/es/jats/importer/parse-jats-article.js +229 -0
- package/dist/es/jats/index.js +18 -0
- package/dist/es/jats/jats-exporter.js +1561 -0
- package/dist/es/jats/jats-versions.js +36 -0
- package/dist/es/lib/attributes.js +22 -0
- package/dist/es/lib/html.js +43 -0
- package/dist/es/lib/styled-content.js +23 -0
- package/dist/es/lib/table-cell-styles.js +47 -0
- package/dist/es/lib/utils.js +59 -0
- package/dist/es/mathjax/index.js +12 -0
- package/dist/es/mathjax/mathjax-packages.js +17 -0
- package/dist/es/mathjax/mathml-to-svg.js +52 -0
- package/dist/es/mathjax/tex-to-mathml.js +45 -0
- package/dist/es/mathjax/tex-to-svg.js +55 -0
- package/dist/es/schema/groups.js +27 -0
- package/dist/es/schema/index.js +178 -0
- package/dist/es/schema/marks.js +156 -0
- package/dist/es/schema/nodes/attribution.js +29 -0
- package/dist/es/schema/nodes/bibliography_element.js +41 -0
- package/dist/es/schema/nodes/bibliography_item.js +98 -0
- package/dist/es/schema/nodes/bibliography_section.js +42 -0
- package/dist/es/schema/nodes/blockquote_element.js +58 -0
- package/dist/es/schema/nodes/caption.js +49 -0
- package/dist/es/schema/nodes/caption_title.js +48 -0
- package/dist/es/schema/nodes/citation.js +48 -0
- package/dist/es/schema/nodes/comment.js +23 -0
- package/dist/es/schema/nodes/cross_reference.js +55 -0
- package/dist/es/schema/nodes/doc.js +18 -0
- package/dist/es/schema/nodes/equation.js +52 -0
- package/dist/es/schema/nodes/equation_element.js +49 -0
- package/dist/es/schema/nodes/figcaption.js +28 -0
- package/dist/es/schema/nodes/figure.js +49 -0
- package/dist/es/schema/nodes/figure_element.js +74 -0
- package/dist/es/schema/nodes/footnote.js +63 -0
- package/dist/es/schema/nodes/footnotes_element.js +50 -0
- package/dist/es/schema/nodes/footnotes_section.js +41 -0
- package/dist/es/schema/nodes/graphical_abstract_section.js +42 -0
- package/dist/es/schema/nodes/hard_break.js +27 -0
- package/dist/es/schema/nodes/highlight_marker.js +49 -0
- package/dist/es/schema/nodes/inline_equation.js +55 -0
- package/dist/es/schema/nodes/inline_footnote.js +47 -0
- package/dist/es/schema/nodes/keywords_element.js +49 -0
- package/dist/es/schema/nodes/keywords_section.js +42 -0
- package/dist/es/schema/nodes/link.js +58 -0
- package/dist/es/schema/nodes/list.js +117 -0
- package/dist/es/schema/nodes/listing.js +69 -0
- package/dist/es/schema/nodes/listing_element.js +49 -0
- package/dist/es/schema/nodes/manuscript.js +43 -0
- package/dist/es/schema/nodes/missing_figure.js +47 -0
- package/dist/es/schema/nodes/paragraph.js +59 -0
- package/dist/es/schema/nodes/placeholder.js +46 -0
- package/dist/es/schema/nodes/placeholder_element.js +45 -0
- package/dist/es/schema/nodes/pullquote_element.js +61 -0
- package/dist/es/schema/nodes/section.js +90 -0
- package/dist/es/schema/nodes/section_label.js +26 -0
- package/dist/es/schema/nodes/section_title.js +44 -0
- package/dist/es/schema/nodes/table.js +67 -0
- package/dist/es/schema/nodes/table_col.js +54 -0
- package/dist/es/schema/nodes/table_element.js +59 -0
- package/dist/es/schema/nodes/table_row.js +120 -0
- package/dist/es/schema/nodes/text.js +18 -0
- package/dist/es/schema/nodes/toc_element.js +49 -0
- package/dist/es/schema/nodes/toc_section.js +42 -0
- package/dist/es/schema/types.js +16 -0
- package/dist/es/tests.js +28 -0
- package/dist/es/transformer/builders.js +261 -0
- package/dist/es/transformer/bundles-data.js +8 -0
- package/dist/es/transformer/bundles.js +27 -0
- package/dist/es/transformer/decode.js +608 -0
- package/dist/es/transformer/document-object-types.js +28 -0
- package/dist/es/transformer/encode.js +535 -0
- package/dist/es/transformer/filename.js +23 -0
- package/dist/es/transformer/footnote-category.js +16 -0
- package/dist/es/transformer/footnotes-order.js +53 -0
- package/dist/es/transformer/highlight-markers.js +120 -0
- package/dist/es/transformer/html.js +407 -0
- package/dist/es/transformer/id.js +23 -0
- package/dist/es/transformer/index.js +38 -0
- package/dist/es/transformer/labels.js +81 -0
- package/dist/es/transformer/manuscript-dependencies.js +64 -0
- package/dist/es/transformer/model-map.js +22 -0
- package/dist/es/transformer/models.js +16 -0
- package/dist/es/transformer/node-names.js +39 -0
- package/dist/es/transformer/node-title.js +82 -0
- package/dist/es/transformer/node-types.js +55 -0
- package/dist/es/transformer/object-types.js +52 -0
- package/dist/es/transformer/project-bundle.js +77 -0
- package/dist/es/transformer/section-category.js +210 -0
- package/dist/es/transformer/serializer.js +17 -0
- package/dist/es/transformer/shared-data.js +1 -0
- package/dist/es/transformer/tei-grobid-importer.js +115 -0
- package/dist/es/transformer/timestamp.js +16 -0
- package/dist/es/transformer/update-identifiers.js +87 -0
- package/dist/es/types.js +1 -0
- package/dist/types/errors.d.ts +6 -0
- package/dist/types/index.d.ts +9 -0
- package/dist/types/jats/importer/index.d.ts +16 -0
- package/dist/types/jats/importer/jats-body-dom-parser.d.ts +24 -0
- package/dist/types/jats/importer/jats-body-transformations.d.ts +31 -0
- package/dist/types/jats/importer/jats-comments.d.ts +26 -0
- package/dist/types/jats/importer/jats-front-parser.d.ts +62 -0
- package/dist/types/jats/importer/jats-journal-meta-parser.d.ts +37 -0
- package/dist/types/jats/importer/jats-parser-utils.d.ts +23 -0
- package/dist/types/jats/importer/jats-reference-parser.d.ts +23 -0
- package/dist/types/jats/importer/parse-jats-article.d.ts +30 -0
- package/dist/types/jats/index.d.ts +18 -0
- package/dist/types/jats/jats-exporter.d.ts +72 -0
- package/dist/types/jats/jats-versions.d.ts +23 -0
- package/dist/types/lib/attributes.d.ts +20 -0
- package/dist/types/lib/html.d.ts +17 -0
- package/dist/types/lib/styled-content.d.ts +22 -0
- package/dist/types/lib/table-cell-styles.d.ts +27 -0
- package/dist/types/lib/utils.d.ts +26 -0
- package/dist/types/mathjax/index.d.ts +3 -0
- package/dist/types/mathjax/mathjax-packages.d.ts +16 -0
- package/dist/types/mathjax/mathml-to-svg.d.ts +17 -0
- package/dist/types/mathjax/tex-to-mathml.d.ts +17 -0
- package/dist/types/mathjax/tex-to-svg.d.ts +17 -0
- package/dist/types/schema/groups.d.ts +22 -0
- package/dist/types/schema/index.d.ts +65 -0
- package/dist/types/schema/marks.d.ts +27 -0
- package/dist/types/schema/nodes/attribution.d.ts +21 -0
- package/dist/types/schema/nodes/bibliography_element.d.ts +26 -0
- package/dist/types/schema/nodes/bibliography_item.d.ts +36 -0
- package/dist/types/schema/nodes/bibliography_section.d.ts +26 -0
- package/dist/types/schema/nodes/blockquote_element.d.ts +28 -0
- package/dist/types/schema/nodes/caption.d.ts +25 -0
- package/dist/types/schema/nodes/caption_title.d.ts +25 -0
- package/dist/types/schema/nodes/citation.d.ts +27 -0
- package/dist/types/schema/nodes/comment.d.ts +31 -0
- package/dist/types/schema/nodes/cross_reference.d.ts +26 -0
- package/dist/types/schema/nodes/doc.d.ts +17 -0
- package/dist/types/schema/nodes/equation.d.ts +28 -0
- package/dist/types/schema/nodes/equation_element.d.ts +29 -0
- package/dist/types/schema/nodes/figcaption.d.ts +21 -0
- package/dist/types/schema/nodes/figure.d.ts +25 -0
- package/dist/types/schema/nodes/figure_element.d.ts +44 -0
- package/dist/types/schema/nodes/footnote.d.ts +32 -0
- package/dist/types/schema/nodes/footnotes_element.d.ts +28 -0
- package/dist/types/schema/nodes/footnotes_section.d.ts +26 -0
- package/dist/types/schema/nodes/graphical_abstract_section.d.ts +26 -0
- package/dist/types/schema/nodes/hard_break.d.ts +21 -0
- package/dist/types/schema/nodes/highlight_marker.d.ts +29 -0
- package/dist/types/schema/nodes/inline_equation.d.ts +28 -0
- package/dist/types/schema/nodes/inline_footnote.d.ts +27 -0
- package/dist/types/schema/nodes/keywords_element.d.ts +27 -0
- package/dist/types/schema/nodes/keywords_section.d.ts +26 -0
- package/dist/types/schema/nodes/link.d.ts +26 -0
- package/dist/types/schema/nodes/list.d.ts +39 -0
- package/dist/types/schema/nodes/listing.d.ts +33 -0
- package/dist/types/schema/nodes/listing_element.d.ts +29 -0
- package/dist/types/schema/nodes/manuscript.d.ts +23 -0
- package/dist/types/schema/nodes/missing_figure.d.ts +23 -0
- package/dist/types/schema/nodes/paragraph.d.ts +30 -0
- package/dist/types/schema/nodes/placeholder.d.ts +26 -0
- package/dist/types/schema/nodes/placeholder_element.d.ts +25 -0
- package/dist/types/schema/nodes/pullquote_element.d.ts +28 -0
- package/dist/types/schema/nodes/section.d.ts +36 -0
- package/dist/types/schema/nodes/section_label.d.ts +22 -0
- package/dist/types/schema/nodes/section_title.d.ts +22 -0
- package/dist/types/schema/nodes/table.d.ts +27 -0
- package/dist/types/schema/nodes/table_col.d.ts +24 -0
- package/dist/types/schema/nodes/table_element.d.ts +35 -0
- package/dist/types/schema/nodes/table_row.d.ts +41 -0
- package/dist/types/schema/nodes/text.d.ts +17 -0
- package/dist/types/schema/nodes/toc_element.d.ts +27 -0
- package/dist/types/schema/nodes/toc_section.d.ts +26 -0
- package/dist/types/schema/types.d.ts +45 -0
- package/dist/types/tests.d.ts +16 -0
- package/dist/types/transformer/builders.d.ts +74 -0
- package/dist/types/transformer/bundles-data.d.ts +3 -0
- package/dist/types/transformer/bundles.d.ts +3 -0
- package/dist/types/transformer/decode.d.ts +38 -0
- package/dist/types/transformer/document-object-types.d.ts +17 -0
- package/dist/types/transformer/encode.d.ts +29 -0
- package/dist/types/transformer/filename.d.ts +16 -0
- package/dist/types/transformer/footnote-category.d.ts +17 -0
- package/dist/types/transformer/footnotes-order.d.ts +23 -0
- package/dist/types/transformer/highlight-markers.d.ts +26 -0
- package/dist/types/transformer/html.d.ts +36 -0
- package/dist/types/transformer/id.d.ts +20 -0
- package/dist/types/transformer/index.d.ts +38 -0
- package/dist/types/transformer/labels.d.ts +24 -0
- package/dist/types/transformer/manuscript-dependencies.d.ts +12 -0
- package/dist/types/transformer/model-map.d.ts +19 -0
- package/dist/types/transformer/models.d.ts +48 -0
- package/dist/types/transformer/node-names.d.ts +17 -0
- package/dist/types/transformer/node-title.d.ts +19 -0
- package/dist/types/transformer/node-types.d.ts +22 -0
- package/dist/types/transformer/object-types.d.ts +29 -0
- package/dist/types/transformer/project-bundle.d.ts +30 -0
- package/dist/types/transformer/section-category.d.ts +28 -0
- package/dist/types/transformer/serializer.d.ts +19 -0
- package/dist/types/transformer/shared-data.d.ts +2 -0
- package/dist/types/transformer/tei-grobid-importer.d.ts +20 -0
- package/dist/types/transformer/timestamp.d.ts +16 -0
- package/dist/types/transformer/update-identifiers.d.ts +23 -0
- package/dist/types/types.d.ts +2 -0
- package/package.json +89 -0
|
@@ -0,0 +1,52 @@
|
|
|
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
|
+
import { ObjectTypes } from '@manuscripts/manuscripts-json-schema';
|
|
17
|
+
export const equation = {
|
|
18
|
+
attrs: {
|
|
19
|
+
id: { default: '' },
|
|
20
|
+
MathMLStringRepresentation: { default: '' },
|
|
21
|
+
SVGStringRepresentation: { default: '' },
|
|
22
|
+
TeXRepresentation: { default: '' },
|
|
23
|
+
dataTracked: { default: null },
|
|
24
|
+
},
|
|
25
|
+
group: 'block',
|
|
26
|
+
parseDOM: [
|
|
27
|
+
{
|
|
28
|
+
tag: `div.${ObjectTypes.Equation}`,
|
|
29
|
+
getAttrs: (p) => {
|
|
30
|
+
const dom = p;
|
|
31
|
+
return {
|
|
32
|
+
id: dom.getAttribute('id'),
|
|
33
|
+
MathMLStringRepresentation: dom.getAttribute('data-mathml-string-representation'),
|
|
34
|
+
SVGStringRepresentation: dom.innerHTML,
|
|
35
|
+
TeXRepresentation: dom.getAttribute('data-tex-representation'),
|
|
36
|
+
};
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
],
|
|
40
|
+
toDOM: (node) => {
|
|
41
|
+
const equationNode = node;
|
|
42
|
+
const dom = document.createElement('div');
|
|
43
|
+
dom.setAttribute('id', equationNode.attrs.id);
|
|
44
|
+
dom.classList.add(ObjectTypes.Equation);
|
|
45
|
+
if (equationNode.attrs.MathMLStringRepresentation) {
|
|
46
|
+
dom.setAttribute('data-mathml-string-representation', equationNode.attrs.MathMLStringRepresentation);
|
|
47
|
+
}
|
|
48
|
+
dom.setAttribute('data-tex-representation', equationNode.attrs.TeXRepresentation);
|
|
49
|
+
dom.innerHTML = equationNode.attrs.SVGStringRepresentation;
|
|
50
|
+
return dom;
|
|
51
|
+
},
|
|
52
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
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
|
+
export const equationElement = {
|
|
17
|
+
content: '(equation | placeholder) figcaption',
|
|
18
|
+
attrs: {
|
|
19
|
+
id: { default: '' },
|
|
20
|
+
suppressCaption: { default: true },
|
|
21
|
+
suppressTitle: { default: undefined },
|
|
22
|
+
dataTracked: { default: null },
|
|
23
|
+
comments: { default: null },
|
|
24
|
+
},
|
|
25
|
+
selectable: false,
|
|
26
|
+
group: 'block element',
|
|
27
|
+
parseDOM: [
|
|
28
|
+
{
|
|
29
|
+
tag: 'figure.equation',
|
|
30
|
+
getAttrs: (p) => {
|
|
31
|
+
const dom = p;
|
|
32
|
+
return {
|
|
33
|
+
id: dom.getAttribute('id'),
|
|
34
|
+
};
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
toDOM: (node) => {
|
|
39
|
+
const equationElementNode = node;
|
|
40
|
+
return [
|
|
41
|
+
'figure',
|
|
42
|
+
{
|
|
43
|
+
class: 'equation',
|
|
44
|
+
id: equationElementNode.attrs.id,
|
|
45
|
+
},
|
|
46
|
+
0,
|
|
47
|
+
];
|
|
48
|
+
},
|
|
49
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
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
|
+
export const figcaption = {
|
|
17
|
+
content: 'caption_title? caption*',
|
|
18
|
+
group: 'block',
|
|
19
|
+
attrs: { dataTracked: { default: null } },
|
|
20
|
+
isolating: true,
|
|
21
|
+
selectable: false,
|
|
22
|
+
parseDOM: [
|
|
23
|
+
{
|
|
24
|
+
tag: 'figcaption',
|
|
25
|
+
},
|
|
26
|
+
],
|
|
27
|
+
toDOM: () => ['figcaption', 0],
|
|
28
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
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
|
+
export const figure = {
|
|
17
|
+
attrs: {
|
|
18
|
+
id: { default: '' },
|
|
19
|
+
src: { default: '' },
|
|
20
|
+
contentType: { default: '' },
|
|
21
|
+
position: { default: undefined },
|
|
22
|
+
dataTracked: { default: null },
|
|
23
|
+
},
|
|
24
|
+
selectable: false,
|
|
25
|
+
group: 'block',
|
|
26
|
+
parseDOM: [
|
|
27
|
+
{
|
|
28
|
+
tag: 'figure',
|
|
29
|
+
context: 'figure_element/',
|
|
30
|
+
getAttrs: (dom) => {
|
|
31
|
+
const element = dom;
|
|
32
|
+
return {
|
|
33
|
+
id: element.getAttribute('id'),
|
|
34
|
+
src: element.getAttribute('src'),
|
|
35
|
+
};
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
toDOM: (node) => {
|
|
40
|
+
const figureNode = node;
|
|
41
|
+
return [
|
|
42
|
+
'figure',
|
|
43
|
+
{
|
|
44
|
+
class: 'figure',
|
|
45
|
+
id: figureNode.attrs.id,
|
|
46
|
+
},
|
|
47
|
+
];
|
|
48
|
+
},
|
|
49
|
+
};
|
|
@@ -0,0 +1,74 @@
|
|
|
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
|
+
export const figureElement = {
|
|
17
|
+
content: '(paragraph | figure | missing_figure | placeholder)+ attribution* figcaption (listing | placeholder)',
|
|
18
|
+
attrs: {
|
|
19
|
+
figureLayout: { default: '' },
|
|
20
|
+
figureStyle: { default: '' },
|
|
21
|
+
id: { default: '' },
|
|
22
|
+
label: { default: '' },
|
|
23
|
+
sizeFraction: { default: 0 },
|
|
24
|
+
alignment: { default: undefined },
|
|
25
|
+
suppressCaption: { default: false },
|
|
26
|
+
suppressTitle: { default: undefined },
|
|
27
|
+
attribution: { default: undefined },
|
|
28
|
+
alternatives: { default: undefined },
|
|
29
|
+
dataTracked: { default: null },
|
|
30
|
+
comments: { default: null },
|
|
31
|
+
},
|
|
32
|
+
selectable: false,
|
|
33
|
+
group: 'block element executable',
|
|
34
|
+
parseDOM: [
|
|
35
|
+
{
|
|
36
|
+
tag: 'figure.figure-group',
|
|
37
|
+
getAttrs: (p) => {
|
|
38
|
+
const dom = p;
|
|
39
|
+
return {
|
|
40
|
+
id: dom.getAttribute('id'),
|
|
41
|
+
figureStyle: dom.getAttribute('data-figure-style'),
|
|
42
|
+
figureLayout: dom.getAttribute('data-figure-layout'),
|
|
43
|
+
sizeFraction: Number(dom.getAttribute('data-size-fraction')) || 0,
|
|
44
|
+
alignment: dom.getAttribute('data-alignment') || undefined,
|
|
45
|
+
};
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
toDOM: (node) => {
|
|
50
|
+
const figureElementNode = node;
|
|
51
|
+
const { id, figureStyle, figureLayout, alignment, sizeFraction } = figureElementNode.attrs;
|
|
52
|
+
const attrs = {};
|
|
53
|
+
const classes = ['figure-group'];
|
|
54
|
+
if (sizeFraction === 2) {
|
|
55
|
+
classes.push('figure-group--static');
|
|
56
|
+
}
|
|
57
|
+
attrs.class = classes.join(' ');
|
|
58
|
+
attrs.id = id;
|
|
59
|
+
if (figureStyle) {
|
|
60
|
+
attrs['data-figure-style'] = figureStyle;
|
|
61
|
+
}
|
|
62
|
+
if (figureLayout) {
|
|
63
|
+
attrs['data-figure-layout'] = figureLayout;
|
|
64
|
+
}
|
|
65
|
+
if (sizeFraction) {
|
|
66
|
+
attrs['data-size-fraction'] = String(sizeFraction);
|
|
67
|
+
}
|
|
68
|
+
if (alignment) {
|
|
69
|
+
attrs['data-alignment'] = alignment;
|
|
70
|
+
}
|
|
71
|
+
return ['figure', attrs, 0];
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
export const isFigureElementNode = (node) => node.type === node.type.schema.nodes.figure_element;
|
|
@@ -0,0 +1,63 @@
|
|
|
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
|
+
export const footnote = {
|
|
17
|
+
group: 'block',
|
|
18
|
+
content: 'paragraph+',
|
|
19
|
+
attrs: {
|
|
20
|
+
id: { default: '' },
|
|
21
|
+
kind: { default: 'footnote' },
|
|
22
|
+
paragraphStyle: { default: '' },
|
|
23
|
+
placeholder: { default: '' },
|
|
24
|
+
dataTracked: { default: null },
|
|
25
|
+
comments: { default: null },
|
|
26
|
+
},
|
|
27
|
+
parseDOM: [
|
|
28
|
+
{
|
|
29
|
+
tag: 'div.footnote-text',
|
|
30
|
+
getAttrs: (p) => {
|
|
31
|
+
const dom = p;
|
|
32
|
+
const attrs = {
|
|
33
|
+
id: dom.getAttribute('id') || undefined,
|
|
34
|
+
kind: (dom.getAttribute('data-kind') || 'footnote'),
|
|
35
|
+
};
|
|
36
|
+
const placeholder = dom.getAttribute('data-placeholder-text');
|
|
37
|
+
if (placeholder) {
|
|
38
|
+
attrs.placeholder = placeholder;
|
|
39
|
+
}
|
|
40
|
+
return attrs;
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
toDOM: (node) => {
|
|
45
|
+
const footnoteNode = node;
|
|
46
|
+
const { kind, paragraphStyle, placeholder, id } = footnoteNode.attrs;
|
|
47
|
+
const attrs = { class: 'footnote-text', id: '' };
|
|
48
|
+
if (kind) {
|
|
49
|
+
attrs['data-kind'] = kind;
|
|
50
|
+
}
|
|
51
|
+
if (id) {
|
|
52
|
+
attrs.id = id;
|
|
53
|
+
}
|
|
54
|
+
if (paragraphStyle) {
|
|
55
|
+
attrs.paragraphStyle = paragraphStyle;
|
|
56
|
+
}
|
|
57
|
+
if (placeholder) {
|
|
58
|
+
attrs['data-placeholder-text'] = placeholder;
|
|
59
|
+
}
|
|
60
|
+
return ['div', attrs, 0];
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
export const isFootnoteNode = (node) => node.type === node.type.schema.nodes.footnote;
|
|
@@ -0,0 +1,50 @@
|
|
|
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
|
+
export const footnotesElement = {
|
|
17
|
+
attrs: {
|
|
18
|
+
id: { default: '' },
|
|
19
|
+
kind: { default: 'footnote' },
|
|
20
|
+
paragraphStyle: { default: '' },
|
|
21
|
+
dataTracked: { default: null },
|
|
22
|
+
},
|
|
23
|
+
content: 'footnote*',
|
|
24
|
+
group: 'block element',
|
|
25
|
+
selectable: false,
|
|
26
|
+
parseDOM: [
|
|
27
|
+
{
|
|
28
|
+
tag: 'div.footnotes',
|
|
29
|
+
getAttrs: (p) => {
|
|
30
|
+
const dom = p;
|
|
31
|
+
return {
|
|
32
|
+
kind: dom.getAttribute('data-kind') || 'footnote',
|
|
33
|
+
};
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
toDOM: (node) => {
|
|
38
|
+
const footnotesElementNode = node;
|
|
39
|
+
const { id, kind, paragraphStyle } = footnotesElementNode.attrs;
|
|
40
|
+
const attrs = { class: 'footnotes', id };
|
|
41
|
+
if (kind) {
|
|
42
|
+
attrs['data-kind'] = kind;
|
|
43
|
+
}
|
|
44
|
+
if (paragraphStyle) {
|
|
45
|
+
attrs['paragraphStyle'] = paragraphStyle;
|
|
46
|
+
}
|
|
47
|
+
return ['div', attrs, 0];
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
export const isFootnotesElementNode = (node) => node.type === node.type.schema.nodes.footnotes_element;
|
|
@@ -0,0 +1,41 @@
|
|
|
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
|
+
export const footnotesSection = {
|
|
17
|
+
content: 'section_title (footnotes_element | placeholder_element)+',
|
|
18
|
+
attrs: {
|
|
19
|
+
id: { default: '' },
|
|
20
|
+
dataTracked: { default: null },
|
|
21
|
+
},
|
|
22
|
+
group: 'block sections',
|
|
23
|
+
selectable: false,
|
|
24
|
+
parseDOM: [
|
|
25
|
+
{
|
|
26
|
+
tag: 'section.footnotes',
|
|
27
|
+
},
|
|
28
|
+
],
|
|
29
|
+
toDOM: (node) => {
|
|
30
|
+
const footnotesSectionNode = node;
|
|
31
|
+
return [
|
|
32
|
+
'section',
|
|
33
|
+
{
|
|
34
|
+
id: footnotesSectionNode.attrs.id,
|
|
35
|
+
class: 'footnotes',
|
|
36
|
+
},
|
|
37
|
+
0,
|
|
38
|
+
];
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
export const isFootnotesSectionNode = (node) => node.type === node.type.schema.nodes.footnotes_section;
|
|
@@ -0,0 +1,42 @@
|
|
|
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
|
+
export const graphicalAbstractSection = {
|
|
17
|
+
content: 'section_title (figure_element | placeholder)',
|
|
18
|
+
attrs: {
|
|
19
|
+
id: { default: '' },
|
|
20
|
+
category: { default: '' },
|
|
21
|
+
},
|
|
22
|
+
group: 'block sections',
|
|
23
|
+
selectable: false,
|
|
24
|
+
parseDOM: [
|
|
25
|
+
{
|
|
26
|
+
tag: 'section.graphical-abstract',
|
|
27
|
+
},
|
|
28
|
+
],
|
|
29
|
+
toDOM: (node) => {
|
|
30
|
+
const graphicalAbstractSectionNode = node;
|
|
31
|
+
return [
|
|
32
|
+
'section',
|
|
33
|
+
{
|
|
34
|
+
id: graphicalAbstractSectionNode.attrs.id,
|
|
35
|
+
class: 'graphical-abstract',
|
|
36
|
+
spellcheck: 'false',
|
|
37
|
+
},
|
|
38
|
+
0,
|
|
39
|
+
];
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
export const isGraphicalAbstractSectionNode = (node) => node.type === node.type.schema.nodes.graphical_abstract_section;
|
|
@@ -0,0 +1,27 @@
|
|
|
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
|
+
export const hardBreak = {
|
|
17
|
+
inline: true,
|
|
18
|
+
group: 'inline',
|
|
19
|
+
selectable: false,
|
|
20
|
+
attrs: {
|
|
21
|
+
dataTracked: { default: null },
|
|
22
|
+
},
|
|
23
|
+
parseDOM: [{ tag: 'br' }],
|
|
24
|
+
toDOM() {
|
|
25
|
+
return ['br'];
|
|
26
|
+
},
|
|
27
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
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
|
+
export const highlightMarker = {
|
|
17
|
+
inline: true,
|
|
18
|
+
group: 'inline',
|
|
19
|
+
atom: true,
|
|
20
|
+
attrs: {
|
|
21
|
+
id: { default: '' },
|
|
22
|
+
tid: { default: '' },
|
|
23
|
+
position: { default: '' },
|
|
24
|
+
dataTracked: { default: null },
|
|
25
|
+
},
|
|
26
|
+
parseDOM: [
|
|
27
|
+
{
|
|
28
|
+
tag: 'span.highlight-marker',
|
|
29
|
+
getAttrs: (p) => {
|
|
30
|
+
const dom = p;
|
|
31
|
+
return {
|
|
32
|
+
id: dom.getAttribute('id'),
|
|
33
|
+
tid: dom.getAttribute('data-target-id'),
|
|
34
|
+
position: dom.getAttribute('data-position'),
|
|
35
|
+
};
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
toDOM: (node) => {
|
|
40
|
+
const highlightMarkerNode = node;
|
|
41
|
+
const dom = document.createElement('span');
|
|
42
|
+
dom.className = 'highlight-marker';
|
|
43
|
+
dom.setAttribute('id', highlightMarkerNode.attrs.id);
|
|
44
|
+
dom.setAttribute('data-target-id', highlightMarkerNode.attrs.tid);
|
|
45
|
+
dom.setAttribute('data-position', highlightMarkerNode.attrs.position);
|
|
46
|
+
return dom;
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
export const isHighlightMarkerNode = (node) => node.type === node.type.schema.nodes.highlight_marker;
|
|
@@ -0,0 +1,55 @@
|
|
|
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
|
+
import { ObjectTypes } from '@manuscripts/manuscripts-json-schema';
|
|
17
|
+
export const inlineEquation = {
|
|
18
|
+
attrs: {
|
|
19
|
+
id: { default: '' },
|
|
20
|
+
MathMLRepresentation: { default: '' },
|
|
21
|
+
SVGRepresentation: { default: '' },
|
|
22
|
+
TeXRepresentation: { default: '' },
|
|
23
|
+
dataTracked: { default: null },
|
|
24
|
+
},
|
|
25
|
+
atom: true,
|
|
26
|
+
inline: true,
|
|
27
|
+
draggable: true,
|
|
28
|
+
group: 'inline',
|
|
29
|
+
parseDOM: [
|
|
30
|
+
{
|
|
31
|
+
tag: `span.${ObjectTypes.InlineMathFragment}`,
|
|
32
|
+
getAttrs: (p) => {
|
|
33
|
+
const dom = p;
|
|
34
|
+
return {
|
|
35
|
+
id: dom.getAttribute('id'),
|
|
36
|
+
MathMLRepresentation: dom.getAttribute('data-mathml-representation') || '',
|
|
37
|
+
SVGRepresentation: dom.innerHTML || '',
|
|
38
|
+
TeXRepresentation: dom.getAttribute('data-tex-representation') || '',
|
|
39
|
+
};
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
toDOM: (node) => {
|
|
44
|
+
const inlineEquationNode = node;
|
|
45
|
+
const dom = document.createElement('span');
|
|
46
|
+
dom.classList.add(ObjectTypes.InlineMathFragment);
|
|
47
|
+
dom.setAttribute('id', inlineEquationNode.attrs.id);
|
|
48
|
+
dom.setAttribute('data-tex-representation', inlineEquationNode.attrs.TeXRepresentation);
|
|
49
|
+
if (inlineEquationNode.attrs.MathMLRepresentation) {
|
|
50
|
+
dom.setAttribute('data-mathml-representation', inlineEquationNode.attrs.MathMLRepresentation);
|
|
51
|
+
}
|
|
52
|
+
dom.innerHTML = inlineEquationNode.attrs.SVGRepresentation;
|
|
53
|
+
return dom;
|
|
54
|
+
},
|
|
55
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
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
|
+
export const inlineFootnote = {
|
|
17
|
+
attrs: {
|
|
18
|
+
rid: { default: '' },
|
|
19
|
+
contents: { default: '' },
|
|
20
|
+
dataTracked: { default: null },
|
|
21
|
+
},
|
|
22
|
+
atom: true,
|
|
23
|
+
inline: true,
|
|
24
|
+
draggable: true,
|
|
25
|
+
group: 'inline',
|
|
26
|
+
parseDOM: [
|
|
27
|
+
{
|
|
28
|
+
tag: 'span.footnote',
|
|
29
|
+
getAttrs: (p) => {
|
|
30
|
+
const dom = p;
|
|
31
|
+
return {
|
|
32
|
+
rid: dom.getAttribute('data-reference-id'),
|
|
33
|
+
contents: dom.textContent,
|
|
34
|
+
};
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
toDOM: (node) => {
|
|
39
|
+
const inlineFootnoteNode = node;
|
|
40
|
+
const dom = document.createElement('span');
|
|
41
|
+
dom.className = 'footnote';
|
|
42
|
+
dom.setAttribute('data-reference-id', inlineFootnoteNode.attrs.rid);
|
|
43
|
+
dom.textContent = inlineFootnoteNode.attrs.contents;
|
|
44
|
+
return dom;
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
export const isInlineFootnoteNode = (node) => node.type === node.type.schema.nodes.inline_footnote;
|
|
@@ -0,0 +1,49 @@
|
|
|
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
|
+
import { nodeFromHTML } from '../../lib/html';
|
|
17
|
+
const createBodyElement = (node) => {
|
|
18
|
+
const dom = document.createElement('div');
|
|
19
|
+
dom.className = 'manuscript-keywords';
|
|
20
|
+
dom.id = node.attrs.id;
|
|
21
|
+
return dom;
|
|
22
|
+
};
|
|
23
|
+
export const keywordsElement = {
|
|
24
|
+
atom: true,
|
|
25
|
+
attrs: {
|
|
26
|
+
id: { default: '' },
|
|
27
|
+
contents: { default: '' },
|
|
28
|
+
paragraphStyle: { default: '' },
|
|
29
|
+
dataTracked: { default: null },
|
|
30
|
+
},
|
|
31
|
+
group: 'block element',
|
|
32
|
+
selectable: false,
|
|
33
|
+
parseDOM: [
|
|
34
|
+
{
|
|
35
|
+
tag: 'div.manuscript-keywords',
|
|
36
|
+
getAttrs: (div) => {
|
|
37
|
+
const dom = div;
|
|
38
|
+
return {
|
|
39
|
+
contents: dom.innerHTML,
|
|
40
|
+
};
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
toDOM: (node) => {
|
|
45
|
+
const keywordsElementNode = node;
|
|
46
|
+
return (nodeFromHTML(keywordsElementNode.attrs.contents) ||
|
|
47
|
+
createBodyElement(keywordsElementNode));
|
|
48
|
+
},
|
|
49
|
+
};
|