@manuscripts/transform 1.0.0 → 1.0.1
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/importer/jats-parser-utils.js +2 -2
- package/dist/cjs/jats/jats-exporter.js +16 -16
- package/dist/cjs/schema/nodes/blockquote_element.js +2 -2
- package/dist/cjs/schema/nodes/equation.js +3 -3
- package/dist/cjs/schema/nodes/inline_equation.js +3 -3
- package/dist/cjs/schema/nodes/list.js +3 -3
- package/dist/cjs/schema/nodes/listing.js +3 -3
- package/dist/cjs/schema/nodes/paragraph.js +2 -2
- package/dist/cjs/schema/nodes/pullquote_element.js +2 -2
- package/dist/cjs/transformer/builders.js +73 -73
- package/dist/cjs/transformer/decode.js +25 -25
- package/dist/cjs/transformer/document-object-types.js +11 -11
- package/dist/cjs/transformer/html.js +2 -2
- package/dist/cjs/transformer/index.js +0 -1
- package/dist/cjs/transformer/labels.js +1 -2
- package/dist/cjs/transformer/manuscript-dependencies.js +3 -3
- package/dist/cjs/transformer/node-types.js +33 -33
- package/dist/cjs/transformer/object-types.js +23 -23
- package/dist/cjs/transformer/project-bundle.js +4 -4
- package/dist/cjs/transformer/section-category.js +5 -5
- package/dist/es/jats/importer/jats-parser-utils.js +1 -1
- package/dist/es/jats/jats-exporter.js +1 -1
- package/dist/es/schema/nodes/blockquote_element.js +1 -1
- package/dist/es/schema/nodes/equation.js +1 -1
- package/dist/es/schema/nodes/inline_equation.js +1 -1
- package/dist/es/schema/nodes/list.js +1 -1
- package/dist/es/schema/nodes/listing.js +1 -1
- package/dist/es/schema/nodes/paragraph.js +1 -1
- package/dist/es/schema/nodes/pullquote_element.js +1 -1
- package/dist/es/transformer/builders.js +1 -1
- package/dist/es/transformer/decode.js +1 -1
- package/dist/es/transformer/document-object-types.js +1 -1
- package/dist/es/transformer/html.js +1 -1
- package/dist/es/transformer/index.js +0 -1
- package/dist/es/transformer/labels.js +1 -2
- package/dist/es/transformer/manuscript-dependencies.js +1 -1
- package/dist/es/transformer/node-types.js +1 -1
- package/dist/es/transformer/object-types.js +1 -1
- package/dist/es/transformer/project-bundle.js +1 -1
- package/dist/es/transformer/section-category.js +1 -1
- package/dist/types/jats/importer/jats-body-transformations.d.ts +1 -1
- package/dist/types/jats/importer/jats-comments.d.ts +1 -1
- package/dist/types/jats/importer/jats-front-parser.d.ts +6 -6
- package/dist/types/jats/importer/jats-parser-utils.d.ts +1 -1
- package/dist/types/jats/importer/jats-reference-parser.d.ts +2 -2
- package/dist/types/jats/importer/parse-jats-article.d.ts +2 -2
- package/dist/types/jats/jats-exporter.d.ts +1 -1
- package/dist/types/lib/styled-content.d.ts +1 -1
- package/dist/types/transformer/builders.d.ts +1 -1
- package/dist/types/transformer/bundles-data.d.ts +1 -1
- package/dist/types/transformer/bundles.d.ts +1 -1
- package/dist/types/transformer/decode.d.ts +1 -1
- package/dist/types/transformer/document-object-types.d.ts +1 -1
- package/dist/types/transformer/encode.d.ts +1 -1
- package/dist/types/transformer/footnotes-order.d.ts +1 -1
- package/dist/types/transformer/highlight-markers.d.ts +1 -1
- package/dist/types/transformer/html.d.ts +1 -1
- package/dist/types/transformer/id.d.ts +1 -1
- package/dist/types/transformer/index.d.ts +0 -1
- package/dist/types/transformer/labels.d.ts +1 -1
- package/dist/types/transformer/manuscript-dependencies.d.ts +1 -1
- package/dist/types/transformer/model-map.d.ts +1 -1
- package/dist/types/transformer/models.d.ts +1 -1
- package/dist/types/transformer/node-types.d.ts +1 -1
- package/dist/types/transformer/object-types.d.ts +1 -1
- package/dist/types/transformer/project-bundle.d.ts +1 -1
- package/dist/types/transformer/section-category.d.ts +1 -1
- package/dist/types/transformer/shared-data.d.ts +1 -1
- package/dist/types/transformer/update-identifiers.d.ts +1 -1
- package/package.json +2 -2
- package/dist/cjs/transformer/tei-grobid-importer.js +0 -121
- package/dist/es/transformer/tei-grobid-importer.js +0 -115
- package/dist/types/transformer/tei-grobid-importer.d.ts +0 -20
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { ObjectTypes, } from '@manuscripts/
|
|
16
|
+
import { ObjectTypes, } from '@manuscripts/json-schema';
|
|
17
17
|
import { DOMSerializer } from 'prosemirror-model';
|
|
18
18
|
import serializeToXML from 'w3c-xmlserializer';
|
|
19
19
|
import { createCounter } from '../jats/jats-exporter';
|
|
@@ -46,8 +46,7 @@ export const buildTargets = (fragment, manuscript) => {
|
|
|
46
46
|
};
|
|
47
47
|
}
|
|
48
48
|
const buildLabel = (type) => {
|
|
49
|
-
const
|
|
50
|
-
const counter = counters[viewLabel.name];
|
|
49
|
+
const counter = counters[type.name];
|
|
51
50
|
counter.index++;
|
|
52
51
|
return `${counter.label} ${counter.index}`;
|
|
53
52
|
};
|
|
@@ -9,7 +9,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
9
9
|
}
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
|
-
import { ObjectTypes, } from '@manuscripts/
|
|
12
|
+
import { ObjectTypes, } from '@manuscripts/json-schema';
|
|
13
13
|
import { generateID } from './id';
|
|
14
14
|
import { hasObjectType } from './object-types';
|
|
15
15
|
import { loadSharedData } from './shared-data';
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { ObjectTypes } from '@manuscripts/
|
|
16
|
+
import { ObjectTypes } from '@manuscripts/json-schema';
|
|
17
17
|
import { GROUP_ELEMENT, GROUP_EXECUTABLE, GROUP_SECTION, hasGroup, schema, } from '../schema';
|
|
18
18
|
export const nodeTypesMap = new Map([
|
|
19
19
|
[schema.nodes.comment, ObjectTypes.CommentAnnotation],
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { manuscriptIDTypes, ObjectTypes, } from '@manuscripts/
|
|
16
|
+
import { manuscriptIDTypes, ObjectTypes, } from '@manuscripts/json-schema';
|
|
17
17
|
export var ExtraObjectTypes;
|
|
18
18
|
(function (ExtraObjectTypes) {
|
|
19
19
|
ExtraObjectTypes["PlaceholderElement"] = "MPPlaceholderElement";
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { ObjectTypes, } from '@manuscripts/
|
|
16
|
+
import { ObjectTypes, } from '@manuscripts/json-schema';
|
|
17
17
|
import { Decoder } from './decode';
|
|
18
18
|
import { hasObjectType } from './object-types';
|
|
19
19
|
export const parseProjectBundle = (projectBundle, manuscriptID) => {
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { ObjectTypes } from '@manuscripts/
|
|
16
|
+
import { ObjectTypes } from '@manuscripts/json-schema';
|
|
17
17
|
import { schema } from '../schema';
|
|
18
18
|
const sectionNodeTypes = [
|
|
19
19
|
schema.nodes.bibliography_section,
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { BibliographyItem } from '@manuscripts/
|
|
16
|
+
import { BibliographyItem } from '@manuscripts/json-schema';
|
|
17
17
|
export declare const jatsBodyTransformations: {
|
|
18
18
|
ensureSection(body: Element, createElement: (tagName: string) => HTMLElement): void;
|
|
19
19
|
createAbstract(abstractNode: Element, createElement: (tagName: string) => HTMLElement): HTMLElement;
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { BibliographyItem, CommentAnnotation, Model } from '@manuscripts/
|
|
16
|
+
import { BibliographyItem, CommentAnnotation, Model } from '@manuscripts/json-schema';
|
|
17
17
|
import { Build } from '../../transformer';
|
|
18
18
|
type ProcessingInstruction = {
|
|
19
19
|
id: string;
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { Bundle, Journal, Keyword, KeywordGroup } from '@manuscripts/
|
|
16
|
+
import { Bundle, Journal, Keyword, KeywordGroup } from '@manuscripts/json-schema';
|
|
17
17
|
import { Build } from '../../transformer/builders';
|
|
18
18
|
import { ISSN } from './jats-journal-meta-parser';
|
|
19
19
|
export declare const jatsFrontParser: {
|
|
@@ -45,18 +45,18 @@ export declare const jatsFrontParser: {
|
|
|
45
45
|
revisionReceiveDate?: number | undefined;
|
|
46
46
|
receiveDate?: number | undefined;
|
|
47
47
|
} | undefined;
|
|
48
|
-
parseSupplements(supplementNodes: Element[] | null): Build<import("@manuscripts/
|
|
48
|
+
parseSupplements(supplementNodes: Element[] | null): Build<import("@manuscripts/json-schema").Supplement>[];
|
|
49
49
|
parseAffiliationNodes(affiliationNodes: Element[]): {
|
|
50
|
-
affiliations: Build<import("@manuscripts/
|
|
50
|
+
affiliations: Build<import("@manuscripts/json-schema").Affiliation>[];
|
|
51
51
|
affiliationIDs: Map<string, string>;
|
|
52
52
|
};
|
|
53
53
|
parseFootnoteNodes(footnoteNodes: Element[]): {
|
|
54
|
-
footnotes: Build<import("@manuscripts/
|
|
54
|
+
footnotes: Build<import("@manuscripts/json-schema").Footnote>[];
|
|
55
55
|
footnoteIDs: Map<string, string>;
|
|
56
56
|
};
|
|
57
57
|
parseCorrespNodes(correspNodes: Element[]): {
|
|
58
|
-
correspondingList: Build<import("@manuscripts/
|
|
58
|
+
correspondingList: Build<import("@manuscripts/json-schema").Corresponding>[];
|
|
59
59
|
correspondingIDs: Map<string, string>;
|
|
60
60
|
};
|
|
61
|
-
parseAuthorNodes(authorNodes: Element[], affiliationIDs: Map<string, string>, footnoteIDs: Map<string, string>, correspondingIDs: Map<string, string>): Build<import("@manuscripts/
|
|
61
|
+
parseAuthorNodes(authorNodes: Element[], affiliationIDs: Map<string, string>, footnoteIDs: Map<string, string>, correspondingIDs: Map<string, string>): Build<import("@manuscripts/json-schema").Contributor>[];
|
|
62
62
|
};
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { Model } from '@manuscripts/
|
|
16
|
+
import { Model } from '@manuscripts/json-schema';
|
|
17
17
|
import { ManuscriptNode } from '../../schema';
|
|
18
18
|
export declare function flatten<T>(arrays: T[][]): T[];
|
|
19
19
|
export declare const fixBodyPMNode: (output: ManuscriptNode, models: Model[], referenceIdsMap?: Map<string, string>) => {
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
*/
|
|
16
16
|
export declare const jatsReferenceParser: {
|
|
17
17
|
parseReferences(referenceNodes: Element[], createElement: (tagName: string) => HTMLElement): {
|
|
18
|
-
references: import("../../transformer/builders").Build<import("@manuscripts/
|
|
18
|
+
references: import("../../transformer/builders").Build<import("@manuscripts/json-schema").BibliographyItem>[];
|
|
19
19
|
referenceIDs: Map<string, string>;
|
|
20
20
|
referenceQueries: Map<string, string[]>;
|
|
21
21
|
};
|
|
22
|
-
parseCrossReferences(crossReferenceNodes: Element[], referenceIDs: Map<string, string>): (import("../../transformer/builders").Build<import("@manuscripts/
|
|
22
|
+
parseCrossReferences(crossReferenceNodes: Element[], referenceIDs: Map<string, string>): (import("../../transformer/builders").Build<import("@manuscripts/json-schema").AuxiliaryObjectReference> | import("../../transformer/builders").Build<import("@manuscripts/json-schema").Citation>)[];
|
|
23
23
|
};
|
|
@@ -13,11 +13,11 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { BibliographyItem, ElementsOrder, FootnotesOrder, Model } from '@manuscripts/
|
|
16
|
+
import { BibliographyItem, ElementsOrder, FootnotesOrder, Model } from '@manuscripts/json-schema';
|
|
17
17
|
import { ManuscriptNode } from '../../schema';
|
|
18
18
|
export declare const parseJATSFront: (front: Element) => Promise<{
|
|
19
19
|
models: Model[];
|
|
20
|
-
bundles: import("@manuscripts/
|
|
20
|
+
bundles: import("@manuscripts/json-schema").Bundle[];
|
|
21
21
|
}>;
|
|
22
22
|
export declare const parseJATSReferences: (back: Element | null, body: Element | null, createElement: (tagName: string) => HTMLElement) => {
|
|
23
23
|
references: Model[];
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { Model } from '@manuscripts/
|
|
16
|
+
import { Model } from '@manuscripts/json-schema';
|
|
17
17
|
import { DOMSerializer } from 'prosemirror-model';
|
|
18
18
|
import { ManuscriptFragment, ManuscriptNode } from '../schema';
|
|
19
19
|
import { Target } from '../transformer/labels';
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { InlineStyle } from '@manuscripts/
|
|
16
|
+
import { InlineStyle } from '@manuscripts/json-schema';
|
|
17
17
|
interface StyledContentAttrs {
|
|
18
18
|
rid?: string;
|
|
19
19
|
}
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { Affiliation, Attribution, AuxiliaryObjectReference, BibliographicDate, BibliographicName, BibliographyItem, Citation, CitationItem, Color, CommentAnnotation, Contribution, Contributor, ContributorRole, Corresponding, ElementsOrder, EmbeddedModel, Figure, Footnote, FootnotesOrder, Highlight, HighlightMarker, InlineMathFragment, InlineStyle, Journal, Keyword, KeywordGroup, LibraryCollection, Manuscript, ManuscriptKeyword, ManuscriptNote, ObjectTypes, ParagraphElement, Project, RequirementsValidation, RequirementsValidationData, Section, StatusLabel, Submission, Supplement, UserProfileAffiliation, UserProfileFootNote } from '@manuscripts/
|
|
16
|
+
import { Affiliation, Attribution, AuxiliaryObjectReference, BibliographicDate, BibliographicName, BibliographyItem, Citation, CitationItem, Color, CommentAnnotation, Contribution, Contributor, ContributorRole, Corresponding, ElementsOrder, EmbeddedModel, Figure, Footnote, FootnotesOrder, Highlight, HighlightMarker, InlineMathFragment, InlineStyle, Journal, Keyword, KeywordGroup, LibraryCollection, Manuscript, ManuscriptKeyword, ManuscriptNote, ObjectTypes, ParagraphElement, Project, RequirementsValidation, RequirementsValidationData, Section, StatusLabel, Submission, Supplement, UserProfileAffiliation, UserProfileFootNote } from '@manuscripts/json-schema';
|
|
17
17
|
import { FootnotesOrderIndexList } from './footnotes-order';
|
|
18
18
|
import { CommentSelector, ManuscriptModel, ModelAttachment } from './models';
|
|
19
19
|
export declare const DEFAULT_BUNDLE = "MPBundle:www-zotero-org-styles-nature";
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { Bundle } from '@manuscripts/
|
|
1
|
+
import { Bundle } from '@manuscripts/json-schema';
|
|
2
2
|
export declare const createParentBundle: (bundle: Bundle, bundles: Map<string, Bundle>) => Bundle | undefined;
|
|
3
3
|
export declare const createNewBundle: (bundleID: string, bundles: Map<string, Bundle>) => Bundle;
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { CommentAnnotation, Model, Section } from '@manuscripts/
|
|
16
|
+
import { CommentAnnotation, Model, Section } from '@manuscripts/json-schema';
|
|
17
17
|
import { ParseOptions } from 'prosemirror-model';
|
|
18
18
|
import { ManuscriptNode } from '../schema';
|
|
19
19
|
export declare const getModelData: <T extends Model>(model: Model) => T;
|
|
@@ -13,5 +13,5 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { ObjectTypes } from '@manuscripts/
|
|
16
|
+
import { ObjectTypes } from '@manuscripts/json-schema';
|
|
17
17
|
export declare const documentObjectTypes: ObjectTypes[];
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { CommentAnnotation, Model } from '@manuscripts/
|
|
16
|
+
import { CommentAnnotation, Model } from '@manuscripts/json-schema';
|
|
17
17
|
import { ManuscriptNode } from '../schema';
|
|
18
18
|
import { Build } from './builders';
|
|
19
19
|
export declare const inlineContents: (node: ManuscriptNode) => string;
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { FootnotesOrder } from '@manuscripts/
|
|
16
|
+
import { FootnotesOrder } from '@manuscripts/json-schema';
|
|
17
17
|
export type FootnotesOrderIndexList = {
|
|
18
18
|
id: string;
|
|
19
19
|
index: number;
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { CommentAnnotation, Model } from '@manuscripts/
|
|
16
|
+
import { CommentAnnotation, Model } from '@manuscripts/json-schema';
|
|
17
17
|
import { Build } from './builders';
|
|
18
18
|
export type HighlightableField = 'title' | 'caption' | 'contents';
|
|
19
19
|
export declare const isHighlightableModel: (model: Model) => model is HighlightableModel;
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { Model } from '@manuscripts/
|
|
16
|
+
import { Model } from '@manuscripts/json-schema';
|
|
17
17
|
import { ManuscriptFragment } from '../schema';
|
|
18
18
|
import { IDGenerator, MediaPathGenerator } from '../types';
|
|
19
19
|
export interface HTMLExporterOptions {
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { ObjectTypes } from '@manuscripts/
|
|
16
|
+
import { ObjectTypes } from '@manuscripts/json-schema';
|
|
17
17
|
import { ManuscriptNodeType } from '../schema';
|
|
18
18
|
import { ExtraObjectTypes } from './object-types';
|
|
19
19
|
export declare const generateNodeID: (type: ManuscriptNodeType) => string;
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { Manuscript } from '@manuscripts/
|
|
16
|
+
import { Manuscript } from '@manuscripts/json-schema';
|
|
17
17
|
import { ManuscriptFragment } from '../schema';
|
|
18
18
|
export interface Target {
|
|
19
19
|
type: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AuxiliaryObjectReferenceStyle, BorderStyle, CaptionStyle, Color, ColorScheme, ContributorRole, FigureLayout, FigureStyle, Model, PageLayout, ParagraphStyle, TableStyle } from '@manuscripts/
|
|
1
|
+
import { AuxiliaryObjectReferenceStyle, BorderStyle, CaptionStyle, Color, ColorScheme, ContributorRole, FigureLayout, FigureStyle, Model, PageLayout, ParagraphStyle, TableStyle } from '@manuscripts/json-schema';
|
|
2
2
|
import { ContainedModel } from './models';
|
|
3
3
|
export type StyleObject = AuxiliaryObjectReferenceStyle | BorderStyle | CaptionStyle | Color | ColorScheme | FigureLayout | FigureStyle | PageLayout | ParagraphStyle | TableStyle;
|
|
4
4
|
export declare const loadStyles: () => Promise<StyleObject[]>;
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { Model } from '@manuscripts/
|
|
16
|
+
import { Model } from '@manuscripts/json-schema';
|
|
17
17
|
import { Build } from './builders';
|
|
18
18
|
export type AddModel = <T extends Model>(data: Partial<T> | Build<T>) => void;
|
|
19
19
|
export declare const addModelToMap: (modelMap: Map<string, Model>) => AddModel;
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { Model, UserProfile } from '@manuscripts/
|
|
16
|
+
import { Model, UserProfile } from '@manuscripts/json-schema';
|
|
17
17
|
import { ManuscriptNode } from '../schema';
|
|
18
18
|
export interface Attachment {
|
|
19
19
|
id: string;
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { ObjectTypes } from '@manuscripts/
|
|
16
|
+
import { ObjectTypes } from '@manuscripts/json-schema';
|
|
17
17
|
import { ManuscriptNode, ManuscriptNodeType, Nodes } from '../schema';
|
|
18
18
|
export declare const nodeTypesMap: Map<ManuscriptNodeType, ObjectTypes>;
|
|
19
19
|
export declare const isExecutableNodeType: (type: ManuscriptNodeType) => boolean;
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { CommentAnnotation, Figure, Manuscript, Model, ObjectTypes, Table } from '@manuscripts/
|
|
16
|
+
import { CommentAnnotation, Figure, Manuscript, Model, ObjectTypes, Table } from '@manuscripts/json-schema';
|
|
17
17
|
import { ManuscriptModel, UserProfileWithAvatar } from './models';
|
|
18
18
|
export declare enum ExtraObjectTypes {
|
|
19
19
|
PlaceholderElement = "MPPlaceholderElement"
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { Journal, Manuscript, Model, ObjectTypes, Submission } from '@manuscripts/
|
|
16
|
+
import { Journal, Manuscript, Model, ObjectTypes, Submission } from '@manuscripts/json-schema';
|
|
17
17
|
import { ManuscriptModel } from './models';
|
|
18
18
|
export interface ProjectBundle {
|
|
19
19
|
version: string;
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { Element } from '@manuscripts/
|
|
16
|
+
import { Element } from '@manuscripts/json-schema';
|
|
17
17
|
import { ManuscriptNode, ManuscriptNodeType } from '../schema';
|
|
18
18
|
export declare const isAnySectionNode: (node: ManuscriptNode) => boolean;
|
|
19
19
|
export type SectionCategory = 'MPSectionCategory:abstract' | 'MPSectionCategory:abstract-teaser' | 'MPSectionCategory:abstract-graphical' | 'MPSectionCategory:acknowledgement' | 'MPSectionCategory:availability' | 'MPSectionCategory:bibliography' | 'MPSectionCategory:conclusions' | 'MPSectionCategory:discussion' | 'MPSectionCategory:endnotes' | 'MPSectionCategory:introduction' | 'MPSectionCategory:keywords' | 'MPSectionCategory:materials-method' | 'MPSectionCategory:results' | 'MPSectionCategory:toc' | 'MPSectionCategory:floating-element' | 'MPSectionCategory:appendices' | 'MPSectionCategory:competing-interests' | 'MPSectionCategory:financial-disclosure' | 'MPSectionCategory:con' | 'MPSectionCategory:deceased' | 'MPSectionCategory:equal' | 'MPSectionCategory:present-address' | 'MPSectionCategory:presented-at' | 'MPSectionCategory:previously-at' | 'MPSectionCategory:supplementary-material' | 'MPSectionCategory:supported-by' | 'MPSectionCategory:ethics-statement';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Model } from '@manuscripts/
|
|
1
|
+
import { Model } from '@manuscripts/json-schema';
|
|
2
2
|
export declare const loadSharedData: <T extends Model>(file: string) => Promise<T[]>;
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { Model } from '@manuscripts/
|
|
16
|
+
import { Model } from '@manuscripts/json-schema';
|
|
17
17
|
import JSZip from 'jszip';
|
|
18
18
|
export declare const updateIdentifiers: (data: Model[]) => Promise<{
|
|
19
19
|
data: Model[];
|
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": "1.0.
|
|
4
|
+
"version": "1.0.1",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-transform",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"@manuscripts/data": "^0.1.12",
|
|
44
44
|
"@manuscripts/eslint-config": "^0.5.1",
|
|
45
45
|
"@manuscripts/examples": "^0.1.0",
|
|
46
|
-
"@manuscripts/
|
|
46
|
+
"@manuscripts/json-schema": "^1.0.0",
|
|
47
47
|
"@types/debug": "^4.1.7",
|
|
48
48
|
"@types/jest": "^29.2.4",
|
|
49
49
|
"@types/lodash.pickby": "^4.6.7",
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*!
|
|
3
|
-
* © 2020 Atypon Systems LLC
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.parseTEIGROBIDArticle = exports.parseBack = exports.parseFront = void 0;
|
|
19
|
-
const builders_1 = require("./builders");
|
|
20
|
-
const model_map_1 = require("./model-map");
|
|
21
|
-
const iterateSnapshot = function* (snapshot) {
|
|
22
|
-
for (let i = 0; i < snapshot.snapshotLength; i++) {
|
|
23
|
-
yield snapshot.snapshotItem(i);
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
const namespaces = new Map([
|
|
27
|
-
[null, 'http://www.tei-c.org/ns/1.0'],
|
|
28
|
-
]);
|
|
29
|
-
const namespaceResolver = (prefix) => namespaces.get(prefix) || null;
|
|
30
|
-
const parseFront = (doc, addModel) => {
|
|
31
|
-
const headerNode = doc.evaluate('/TEI/teiHeader', doc, namespaceResolver, XPathResult.FIRST_ORDERED_NODE_TYPE).singleNodeValue;
|
|
32
|
-
if (!headerNode) {
|
|
33
|
-
throw new Error('No header element found!');
|
|
34
|
-
}
|
|
35
|
-
const title = doc.evaluate('fileDesc/titleStmt/title', headerNode, namespaceResolver, XPathResult.STRING_TYPE).stringValue;
|
|
36
|
-
const manuscript = (0, builders_1.buildManuscript)(title);
|
|
37
|
-
addModel(manuscript);
|
|
38
|
-
const affiliationsMap = new Map();
|
|
39
|
-
const authorNodes = doc.evaluate('fileDesc/sourceDesc/biblStruct/analytic/author', headerNode, namespaceResolver, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE);
|
|
40
|
-
for (const authorNode of iterateSnapshot(authorNodes)) {
|
|
41
|
-
const name = (0, builders_1.buildBibliographicName)({});
|
|
42
|
-
name.given = doc.evaluate('persName/forename', authorNode, namespaceResolver, XPathResult.STRING_TYPE).stringValue;
|
|
43
|
-
name.family = doc.evaluate('persName/surname', authorNode, namespaceResolver, XPathResult.STRING_TYPE).stringValue;
|
|
44
|
-
const contributor = (0, builders_1.buildContributor)(name, 'author', 1);
|
|
45
|
-
contributor.affiliations = [];
|
|
46
|
-
const affiliationNodes = doc.evaluate('affiliation', authorNode, namespaceResolver, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE);
|
|
47
|
-
for (const affiliationNode of iterateSnapshot(affiliationNodes)) {
|
|
48
|
-
const key = affiliationNode.getAttribute('key');
|
|
49
|
-
if (key) {
|
|
50
|
-
const affiliation = affiliationsMap.get(key);
|
|
51
|
-
if (affiliation) {
|
|
52
|
-
contributor.affiliations.push(affiliation._id);
|
|
53
|
-
}
|
|
54
|
-
else {
|
|
55
|
-
const affiliation = (0, builders_1.buildAffiliation)('', 1);
|
|
56
|
-
affiliation.institution = doc.evaluate('orgName[@type="institution"]', affiliationNode, namespaceResolver, XPathResult.STRING_TYPE).stringValue;
|
|
57
|
-
affiliation.department = doc.evaluate('orgName[@type="department"]', affiliationNode, namespaceResolver, XPathResult.STRING_TYPE).stringValue;
|
|
58
|
-
addModel(affiliation);
|
|
59
|
-
affiliationsMap.set(key, affiliation);
|
|
60
|
-
contributor.affiliations.push(affiliation._id);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
addModel(contributor);
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
exports.parseFront = parseFront;
|
|
68
|
-
const chooseBibliographyItemType = (publicationType) => {
|
|
69
|
-
switch (publicationType) {
|
|
70
|
-
case 'book':
|
|
71
|
-
case 'thesis':
|
|
72
|
-
return publicationType;
|
|
73
|
-
case 'journal':
|
|
74
|
-
default:
|
|
75
|
-
return 'article-journal';
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
const parseBack = (doc, addModel) => {
|
|
79
|
-
const backNode = doc.evaluate('/TEI/text/back', doc, namespaceResolver, XPathResult.FIRST_ORDERED_NODE_TYPE).singleNodeValue;
|
|
80
|
-
if (!backNode) {
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
const referenceNodes = doc.evaluate('div[@type="references"]/listBibl/biblStruct', backNode, namespaceResolver, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE);
|
|
84
|
-
for (const referenceNode of iterateSnapshot(referenceNodes)) {
|
|
85
|
-
const bibliographyItem = (0, builders_1.buildBibliographyItem)({
|
|
86
|
-
type: chooseBibliographyItemType(null),
|
|
87
|
-
});
|
|
88
|
-
bibliographyItem.title = doc.evaluate('analytic/title', referenceNode, namespaceResolver, XPathResult.STRING_TYPE).stringValue;
|
|
89
|
-
bibliographyItem.source = doc.evaluate('monogr/title', referenceNode, namespaceResolver, XPathResult.STRING_TYPE).stringValue;
|
|
90
|
-
bibliographyItem.volume = doc.evaluate('monogr/imprint/biblScope[unit="volume"]', referenceNode, namespaceResolver, XPathResult.STRING_TYPE).stringValue;
|
|
91
|
-
const fpage = doc.evaluate('monogr/imprint/biblScope[unit="page"]/@from', referenceNode, namespaceResolver, XPathResult.STRING_TYPE).stringValue;
|
|
92
|
-
const lpage = doc.evaluate('monogr/imprint/biblScope[unit="page"]/@to', referenceNode, namespaceResolver, XPathResult.STRING_TYPE).stringValue;
|
|
93
|
-
if (fpage) {
|
|
94
|
-
bibliographyItem.page = lpage ? `${fpage}-${lpage}` : fpage;
|
|
95
|
-
}
|
|
96
|
-
const date = doc.evaluate('monogr/imprint/date[type="published"]/@when', referenceNode, namespaceResolver, XPathResult.STRING_TYPE).stringValue;
|
|
97
|
-
if (date) {
|
|
98
|
-
bibliographyItem.issued = (0, builders_1.buildBibliographicDate)({
|
|
99
|
-
'date-parts': [date.split(/-/)],
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
const authorNodes = doc.evaluate('analytic/author', referenceNode, namespaceResolver, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE);
|
|
103
|
-
bibliographyItem.author = [];
|
|
104
|
-
for (const authorNode of iterateSnapshot(authorNodes)) {
|
|
105
|
-
const name = (0, builders_1.buildBibliographicName)({});
|
|
106
|
-
name.given = doc.evaluate('persName/forename', authorNode, namespaceResolver, XPathResult.STRING_TYPE).stringValue;
|
|
107
|
-
name.family = doc.evaluate('persName/surname', authorNode, namespaceResolver, XPathResult.STRING_TYPE).stringValue;
|
|
108
|
-
bibliographyItem.author.push(name);
|
|
109
|
-
}
|
|
110
|
-
addModel(bibliographyItem);
|
|
111
|
-
}
|
|
112
|
-
};
|
|
113
|
-
exports.parseBack = parseBack;
|
|
114
|
-
const parseTEIGROBIDArticle = (doc) => {
|
|
115
|
-
const modelMap = new Map();
|
|
116
|
-
const addModel = (0, model_map_1.addModelToMap)(modelMap);
|
|
117
|
-
(0, exports.parseFront)(doc, addModel);
|
|
118
|
-
(0, exports.parseBack)(doc, addModel);
|
|
119
|
-
return [...modelMap.values()];
|
|
120
|
-
};
|
|
121
|
-
exports.parseTEIGROBIDArticle = parseTEIGROBIDArticle;
|