@manuscripts/transform 3.0.69 → 3.1.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/index.js +2 -3
- package/dist/cjs/jats/exporter/citeproc.js +164 -0
- package/dist/cjs/jats/exporter/jats-exporter.js +70 -196
- package/dist/cjs/jats/importer/jats-dom-parser.js +48 -62
- package/dist/cjs/lib/citeproc.js +13 -0
- package/dist/cjs/schema/index.js +1 -0
- package/dist/cjs/schema/nodes/bibliography_element.js +3 -1
- package/dist/cjs/schema/nodes/bibliography_item.js +3 -7
- package/dist/cjs/schema/nodes/comment.js +3 -1
- package/dist/cjs/schema/nodes/list.js +3 -45
- package/dist/cjs/version.js +1 -1
- package/dist/es/index.js +1 -1
- package/dist/es/jats/exporter/citeproc.js +156 -0
- package/dist/es/jats/exporter/jats-exporter.js +48 -196
- package/dist/es/jats/importer/jats-dom-parser.js +49 -63
- package/dist/es/lib/citeproc.js +9 -0
- package/dist/es/schema/index.js +1 -0
- package/dist/es/schema/nodes/bibliography_element.js +1 -0
- package/dist/es/schema/nodes/bibliography_item.js +1 -6
- package/dist/es/schema/nodes/comment.js +1 -0
- package/dist/es/schema/nodes/list.js +2 -42
- package/dist/es/version.js +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/jats/exporter/citeproc.d.ts +18 -0
- package/dist/types/jats/exporter/jats-exporter.d.ts +5 -29
- package/dist/types/jats/importer/jats-dom-parser.d.ts +2 -2
- package/dist/types/lib/citeproc.d.ts +3 -0
- package/dist/types/schema/index.d.ts +1 -0
- package/dist/types/schema/nodes/bibliography_element.d.ts +1 -0
- package/dist/types/schema/nodes/bibliography_item.d.ts +9 -9
- package/dist/types/schema/nodes/citation.d.ts +3 -4
- package/dist/types/schema/nodes/comment.d.ts +3 -3
- package/dist/types/schema/nodes/list.d.ts +5 -11
- package/dist/types/version.d.ts +1 -1
- package/package.json +4 -6
|
@@ -13,10 +13,9 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import {
|
|
17
|
-
import { CitationProvider } from '@manuscripts/library';
|
|
16
|
+
import { Journal } from '@manuscripts/json-schema';
|
|
18
17
|
import { type NodeType, DOMSerializer } from 'prosemirror-model';
|
|
19
|
-
import {
|
|
18
|
+
import { ManuscriptNode } from '../../schema';
|
|
20
19
|
import { IDGenerator } from '../types';
|
|
21
20
|
import { Version } from './jats-versions';
|
|
22
21
|
import { Target } from './labels';
|
|
@@ -32,39 +31,20 @@ export type ExportOptions = {
|
|
|
32
31
|
journal?: Journal;
|
|
33
32
|
csl: CSLOptions;
|
|
34
33
|
};
|
|
35
|
-
export declare const buildCitations: (citations: CitationNode[]) => {
|
|
36
|
-
citationID: string;
|
|
37
|
-
citationItems: {
|
|
38
|
-
id: string;
|
|
39
|
-
}[];
|
|
40
|
-
properties: {
|
|
41
|
-
noteIndex: number;
|
|
42
|
-
};
|
|
43
|
-
}[];
|
|
44
34
|
export declare class JATSExporter {
|
|
45
35
|
protected document: Document;
|
|
46
36
|
protected serializer: DOMSerializer;
|
|
47
37
|
protected labelTargets: Map<string, Target>;
|
|
48
38
|
protected footnoteLabels: Map<string, string>;
|
|
49
|
-
protected citationTexts: Map<string, string>;
|
|
50
|
-
protected citationProvider: CitationProvider;
|
|
51
39
|
protected manuscriptNode: ManuscriptNode;
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
citationItems: {
|
|
55
|
-
id: string;
|
|
56
|
-
}[];
|
|
57
|
-
properties: {
|
|
58
|
-
noteIndex: number;
|
|
59
|
-
};
|
|
60
|
-
}[];
|
|
61
|
-
protected getLibraryItem: (manuscriptID: string) => (id: string) => BibliographyItem | undefined;
|
|
62
|
-
protected generateCitationTexts(csl: CSLOptions, manuscriptID: string): void;
|
|
40
|
+
private engine;
|
|
41
|
+
private renderedCitations;
|
|
63
42
|
private nodesMap;
|
|
64
43
|
private populateNodesMap;
|
|
65
44
|
protected getFirstChildOfType<T extends ManuscriptNode>(type: NodeType, node?: ManuscriptNode): T | undefined;
|
|
66
45
|
protected getChildrenOfType<T extends ManuscriptNode>(type: NodeType, node?: ManuscriptNode): T[];
|
|
67
46
|
serializeToJATS: (manuscriptNode: ManuscriptNode, options: ExportOptions) => Promise<string>;
|
|
47
|
+
private initCiteprocEngine;
|
|
68
48
|
private nodeFromJATS;
|
|
69
49
|
protected rewriteIDs: (generator?: IDGenerator) => Promise<void>;
|
|
70
50
|
protected setTitleContent: (element: HTMLElement, title: string) => void;
|
|
@@ -73,10 +53,6 @@ export declare class JATSExporter {
|
|
|
73
53
|
protected buildCountingElement: (tagName: string, count: number | undefined) => HTMLElement | undefined;
|
|
74
54
|
protected buildBody: () => HTMLElement;
|
|
75
55
|
protected buildBack: (body: HTMLElement) => HTMLElement;
|
|
76
|
-
private processDateParts;
|
|
77
|
-
private processPageString;
|
|
78
|
-
private processDate;
|
|
79
|
-
private processRefPersonGroup;
|
|
80
56
|
private createElement;
|
|
81
57
|
private appendElement;
|
|
82
58
|
protected createSerializer: () => void;
|
|
@@ -31,11 +31,11 @@ export declare class JATSDOMParser {
|
|
|
31
31
|
private getFigureAttrs;
|
|
32
32
|
private getInstitutionDetails;
|
|
33
33
|
private getAddressLine;
|
|
34
|
-
private
|
|
34
|
+
private getRefType;
|
|
35
35
|
private getNameContent;
|
|
36
36
|
private getDateContent;
|
|
37
|
+
private getIssuedDateContent;
|
|
37
38
|
private getFigContent;
|
|
38
|
-
private parseRefLiteral;
|
|
39
39
|
private parseRefPages;
|
|
40
40
|
private parseRef;
|
|
41
41
|
private nodes;
|
|
@@ -69,6 +69,7 @@ export * from './nodes/placeholder_element';
|
|
|
69
69
|
export * from './nodes/pullquote_element';
|
|
70
70
|
export * from './nodes/section';
|
|
71
71
|
export * from './nodes/section_title';
|
|
72
|
+
export * from './nodes/section_label';
|
|
72
73
|
export * from './nodes/supplement';
|
|
73
74
|
export * from './nodes/supplements';
|
|
74
75
|
export * from './nodes/table';
|
|
@@ -13,14 +13,15 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
|
|
16
|
+
/// <reference types="csl" />
|
|
17
17
|
import { NodeSpec } from 'prosemirror-model';
|
|
18
18
|
import { ManuscriptNode } from '../types';
|
|
19
|
+
export type BibliographyItemType = 'article-journal' | 'book' | 'chapter' | 'confproc' | 'thesis' | 'webpage' | 'other' | 'standard' | 'dataset' | 'preprint';
|
|
19
20
|
export interface BibliographyItemAttrs {
|
|
20
21
|
id: string;
|
|
21
|
-
type:
|
|
22
|
-
author?:
|
|
23
|
-
issued?:
|
|
22
|
+
type: BibliographyItemType;
|
|
23
|
+
author?: CSL.Person[];
|
|
24
|
+
issued?: CSL.Date;
|
|
24
25
|
'container-title'?: string;
|
|
25
26
|
volume?: string;
|
|
26
27
|
issue?: string;
|
|
@@ -35,19 +36,18 @@ export interface BibliographyItemAttrs {
|
|
|
35
36
|
publisher?: string;
|
|
36
37
|
event?: string;
|
|
37
38
|
'event-place'?: string;
|
|
38
|
-
'event-date'?:
|
|
39
|
+
'event-date'?: CSL.Date;
|
|
39
40
|
institution?: string;
|
|
40
|
-
editor?:
|
|
41
|
+
editor?: CSL.Person[];
|
|
41
42
|
locator?: string;
|
|
42
43
|
URL?: string;
|
|
43
44
|
'number-of-pages'?: string;
|
|
44
|
-
accessed?:
|
|
45
|
+
accessed?: CSL.Date;
|
|
45
46
|
DOI?: string;
|
|
46
47
|
comment?: string;
|
|
47
48
|
}
|
|
48
|
-
export type BibliographyItemType = 'article-journal' | 'book' | 'chapter' | 'confproc' | 'thesis' | 'webpage' | 'other' | 'standard' | 'dataset' | 'preprint';
|
|
49
|
-
export declare const publicationTypeToPM: Record<string, string>;
|
|
50
49
|
export interface BibliographyItemNode extends ManuscriptNode {
|
|
51
50
|
attrs: BibliographyItemAttrs;
|
|
52
51
|
}
|
|
53
52
|
export declare const bibliographyItem: NodeSpec;
|
|
53
|
+
export declare const isBibliographyItemNode: (node: ManuscriptNode) => node is BibliographyItemNode;
|
|
@@ -15,14 +15,13 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import { NodeSpec } from 'prosemirror-model';
|
|
17
17
|
import { ManuscriptNode } from '../types';
|
|
18
|
-
interface
|
|
18
|
+
export interface CitationAttrs {
|
|
19
19
|
id: string;
|
|
20
20
|
rids: string[];
|
|
21
|
-
selectedText
|
|
21
|
+
selectedText?: string;
|
|
22
22
|
}
|
|
23
23
|
export interface CitationNode extends ManuscriptNode {
|
|
24
|
-
attrs:
|
|
24
|
+
attrs: CitationAttrs;
|
|
25
25
|
}
|
|
26
26
|
export declare const citation: NodeSpec;
|
|
27
27
|
export declare const isCitationNode: (node: ManuscriptNode) => node is CitationNode;
|
|
28
|
-
export {};
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
import { Contribution } from '@manuscripts/json-schema';
|
|
17
17
|
import { NodeSpec } from 'prosemirror-model';
|
|
18
18
|
import { ManuscriptNode } from '../types';
|
|
19
|
-
interface
|
|
19
|
+
export interface CommentAttrs {
|
|
20
20
|
id: string;
|
|
21
21
|
contents: string;
|
|
22
22
|
target: string;
|
|
@@ -29,7 +29,7 @@ interface Attrs {
|
|
|
29
29
|
originalText?: string;
|
|
30
30
|
}
|
|
31
31
|
export interface CommentNode extends ManuscriptNode {
|
|
32
|
-
attrs:
|
|
32
|
+
attrs: CommentAttrs;
|
|
33
33
|
}
|
|
34
34
|
export declare const comment: NodeSpec;
|
|
35
|
-
export
|
|
35
|
+
export declare const isCommentNode: (node: ManuscriptNode) => node is CommentNode;
|
|
@@ -1,17 +1,12 @@
|
|
|
1
1
|
import { NodeSpec } from 'prosemirror-model';
|
|
2
2
|
import { ManuscriptNode } from '../types';
|
|
3
|
-
export type
|
|
4
|
-
interface
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
export type ListStyleType = 'simple' | 'bullet' | 'order' | 'alpha-lower' | 'alpha-upper' | 'roman-lower' | 'roman-upper';
|
|
4
|
+
export interface ListAttrs {
|
|
5
|
+
id: string;
|
|
6
|
+
listStyleType: ListStyleType;
|
|
7
7
|
}
|
|
8
|
-
export declare const getJatsListType: (cssStyle: string | null) => "bullet" | "order" | "alpha-lower" | "alpha-upper" | "roman-lower" | "roman-upper" | "none";
|
|
9
|
-
export declare const getListType: (style: JatsStyleType) => ListTypeInfo;
|
|
10
8
|
export interface ListNode extends ManuscriptNode {
|
|
11
|
-
attrs:
|
|
12
|
-
id: string;
|
|
13
|
-
listStyleType: string;
|
|
14
|
-
};
|
|
9
|
+
attrs: ListAttrs;
|
|
15
10
|
}
|
|
16
11
|
export declare const list: NodeSpec;
|
|
17
12
|
export interface ListItemNode extends ManuscriptNode {
|
|
@@ -21,4 +16,3 @@ export interface ListItemNode extends ManuscriptNode {
|
|
|
21
16
|
}
|
|
22
17
|
export declare const listItem: NodeSpec;
|
|
23
18
|
export declare const isListNode: (node: ManuscriptNode) => node is ListNode;
|
|
24
|
-
export {};
|
package/dist/types/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "3.0
|
|
1
|
+
export declare const VERSION = "3.1.0";
|
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": "3.0
|
|
4
|
+
"version": "3.1.0",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-transform",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|
|
@@ -24,8 +24,7 @@
|
|
|
24
24
|
"prebuild": "rimraf dist && yarn version-file",
|
|
25
25
|
"prettier": "prettier --write \"src/**/*.{ts,tsx}\" \"*.{js,json}\"",
|
|
26
26
|
"preversion": "npm-run-all --parallel typecheck lint build test",
|
|
27
|
-
"test": "jest --runInBand",
|
|
28
|
-
"test:debug": "DEBUG=manuscripts-transform yarn test",
|
|
27
|
+
"test": "TZ=UTC jest --runInBand",
|
|
29
28
|
"typecheck": "tsc --noEmit",
|
|
30
29
|
"version": "yarn build"
|
|
31
30
|
},
|
|
@@ -35,7 +34,6 @@
|
|
|
35
34
|
"debug": "^4.3.4",
|
|
36
35
|
"jszip": "^3.10.1",
|
|
37
36
|
"lodash": "^4.17.21",
|
|
38
|
-
"mime": "^3.0.0",
|
|
39
37
|
"prosemirror-model": "^1.18.3",
|
|
40
38
|
"prosemirror-tables": "^1.3.5",
|
|
41
39
|
"prosemirror-utils": "^1.2.2",
|
|
@@ -51,14 +49,14 @@
|
|
|
51
49
|
"@manuscripts/eslint-config": "^0.5.1",
|
|
52
50
|
"@types/debug": "^4.1.7",
|
|
53
51
|
"@types/jest": "^29.5.12",
|
|
54
|
-
"@types/lodash
|
|
55
|
-
"@types/mime": "^3.0.1",
|
|
52
|
+
"@types/lodash": "4.17.16",
|
|
56
53
|
"@types/node": "^18.11.18",
|
|
57
54
|
"@types/uuid": "^9.0.0",
|
|
58
55
|
"@types/w3c-xmlserializer": "^2.0.2",
|
|
59
56
|
"@typescript-eslint/eslint-plugin": "^5.47.0",
|
|
60
57
|
"@typescript-eslint/parser": "^5.47.0",
|
|
61
58
|
"babel-jest": "^29.3.1",
|
|
59
|
+
"@types/csl": "npm:csl-json@0.1.0",
|
|
62
60
|
"eslint": "^8.30.0",
|
|
63
61
|
"eslint-config-prettier": "^8.5.0",
|
|
64
62
|
"eslint-plugin-header": "^3.1.1",
|