jats-utils 1.0.7 → 1.0.9

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.
@@ -1 +1 @@
1
- {"version":3,"file":"serialize.d.ts","sourceRoot":"","sources":["../src/serialize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,OAAO,EAAE,MAAM,QAAQ,CAAC;AAG9C,MAAM,MAAM,oBAAoB,GAAG;IACjC;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,QAAQ,GAAG,IAAI,CAAC;CAC5C,CAAC;AA+EF,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,oBAAoB,UAgB7E"}
1
+ {"version":3,"file":"serialize.d.ts","sourceRoot":"","sources":["../src/serialize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,OAAO,EAAE,MAAM,QAAQ,CAAC;AAG9C,MAAM,MAAM,oBAAoB,GAAG;IACjC;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,QAAQ,GAAG,IAAI,CAAC;CAC5C,CAAC;AAmFF,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,oBAAoB,UAgB7E"}
package/dist/serialize.js CHANGED
@@ -32,7 +32,10 @@ const both = [
32
32
  'body',
33
33
  'sec',
34
34
  'fig',
35
+ 'statement',
36
+ 'list',
35
37
  'disp-formula',
38
+ 'disp-formula-group',
36
39
  'table-wrap',
37
40
  'caption',
38
41
  'table',
@@ -63,6 +66,7 @@ const first = [
63
66
  'meta-value',
64
67
  'title',
65
68
  'p',
69
+ 'license-p',
66
70
  'tr',
67
71
  'label',
68
72
  'graphic',
package/dist/utils.d.ts CHANGED
@@ -1,12 +1,8 @@
1
1
  import type { GenericNode, GenericParent } from 'myst-common';
2
2
  import type { Element } from 'xml-js';
3
- import type { Contributor } from 'myst-frontmatter';
4
3
  export declare function convertToUnist(node: Element): GenericNode | GenericParent | undefined;
5
4
  export declare function convertToXml(node: GenericNode): Element;
6
5
  export declare function escapeForXML(text: string): string;
7
6
  export declare function toDate(date?: GenericParent): Date | undefined;
8
7
  export declare function formatDate(date?: Date): string | undefined;
9
- export type PubIdTypes = 'doi' | 'pmc' | 'pmid' | 'publisher-id' | string;
10
- export declare function findArticleId(node: GenericParent | undefined, pubIdType?: PubIdTypes): string | undefined;
11
- export declare function authorAndAffiliation(node: GenericParent, article: GenericParent): Contributor;
12
8
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE9D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAKtC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD,wBAAgB,cAAc,CAAC,IAAI,EAAE,OAAO,GAAG,WAAW,GAAG,aAAa,GAAG,SAAS,CA2CrF;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAwBvD;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,UAExC;AA6BD,wBAAgB,MAAM,CAAC,IAAI,CAAC,EAAE,aAAa,GAAG,IAAI,GAAG,SAAS,CAa7D;AAED,wBAAgB,UAAU,CAAC,IAAI,CAAC,EAAE,IAAI,sBAGrC;AAED,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,GAAG,cAAc,GAAG,MAAM,CAAC;AAE1E,wBAAgB,aAAa,CAC3B,IAAI,EAAE,aAAa,GAAG,SAAS,EAC/B,SAAS,GAAE,UAAkB,GAC5B,MAAM,GAAG,SAAS,CAQpB;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,aAAa,EAAE,OAAO,EAAE,aAAa,GAAG,WAAW,CAyC7F"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE9D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAGtC,wBAAgB,cAAc,CAAC,IAAI,EAAE,OAAO,GAAG,WAAW,GAAG,aAAa,GAAG,SAAS,CA2CrF;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAwBvD;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,UAExC;AA6BD,wBAAgB,MAAM,CAAC,IAAI,CAAC,EAAE,aAAa,GAAG,IAAI,GAAG,SAAS,CAa7D;AAED,wBAAgB,UAAU,CAAC,IAAI,CAAC,EAAE,IAAI,sBAGrC"}
package/dist/utils.js CHANGED
@@ -1,7 +1,5 @@
1
1
  import { toText } from 'myst-common';
2
- import { doi } from 'doi-utils';
3
- import { select, selectAll } from 'unist-util-select';
4
- import { Tags } from 'jats-tags';
2
+ import { select } from 'unist-util-select';
5
3
  export function convertToUnist(node) {
6
4
  switch (node.type) {
7
5
  case 'element': {
@@ -128,52 +126,3 @@ export function formatDate(date) {
128
126
  return;
129
127
  return new Intl.DateTimeFormat('en-US', { dateStyle: 'long', timeZone: 'UTC' }).format(date);
130
128
  }
131
- export function findArticleId(node, pubIdType = 'doi') {
132
- if (!node)
133
- return undefined;
134
- const id = select(`[pub-id-type=${pubIdType}]`, node);
135
- if (id && toText(id))
136
- return toText(id);
137
- const doiTag = selectAll(`${Tags.articleId},${Tags.pubId}`, node).find((t) => doi.validate(toText(t)));
138
- return toText(doiTag) || undefined;
139
- }
140
- export function authorAndAffiliation(node, article) {
141
- const author = {
142
- name: `${toText(select(Tags.givenNames, node))} ${toText(select(Tags.surname, node))}`,
143
- };
144
- const orcid = select('[contrib-id-type=orcid]', node);
145
- if (orcid) {
146
- author.orcid = toText(orcid).replace(/(https?:\/\/)?orcid\.org\//, '');
147
- }
148
- //
149
- /**
150
- * For example:
151
- *
152
- * ```xml
153
- * <aff id="aff2">
154
- * <label>2</label>
155
- * <institution-wrap>
156
- * <institution-id institution-id-type="ror">https://ror.org/00t9vx427</institution-id>
157
- * <institution>Department of Biochemistry, University of Texas Southwestern Medical Center</institution>
158
- * </institution-wrap>
159
- * <addr-line>
160
- * <named-content content-type="city">Dallas</named-content>
161
- * </addr-line>
162
- * <country>United States</country>
163
- * </aff>
164
- * ```
165
- */
166
- const affiliationRefs = selectAll('xref[ref-type=aff]', node);
167
- const affiliations = affiliationRefs.map((xref) => select(`[id=${xref.rid}]`, article));
168
- const affiliationText = affiliations
169
- .map((aff) => {
170
- // TODO: handle rors!
171
- const ror = select(`[institution-id-type=ror]`, aff);
172
- return toText(select('institution', aff));
173
- })
174
- .filter((t) => !!t);
175
- if (affiliationText.length > 0) {
176
- author.affiliations = affiliationText;
177
- }
178
- return author;
179
- }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jats-utils",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
4
4
  "description": "Utility functions for working with JATS in Typescript",
5
5
  "author": "Rowan Cockett <rowan@curvenote.com>",
6
6
  "homepage": "https://github.com/curvenote/jats",
@@ -34,13 +34,15 @@
34
34
  "bugs": {
35
35
  "url": "https://github.com/curvenote/jats/issues"
36
36
  },
37
- "dependencies": {},
37
+ "dependencies": {
38
+ "unist-util-select": "^4.0.0"
39
+ },
38
40
  "peerDependencies": {
39
41
  "xml-js": "^1",
40
- "jats-tags": "^1"
42
+ "jats-tags": "^1.0.9"
41
43
  },
42
44
  "devDependencies": {
43
45
  "myst-common": "^1.0.0",
44
- "jats-tags": "^1"
46
+ "jats-tags": "^1.0.9"
45
47
  }
46
48
  }