jats-cli 0.0.0 → 1.0.10
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/README.md +16 -6
- package/dist/convert.d.ts.map +1 -1
- package/dist/convert.js +2 -0
- package/dist/download.d.ts +3 -0
- package/dist/download.d.ts.map +1 -0
- package/dist/download.js +17 -0
- package/dist/index.js +3 -1
- package/dist/jats.cjs +51013 -10824
- package/dist/parse.d.ts +1 -1
- package/dist/parse.d.ts.map +1 -1
- package/dist/parse.js +2 -33
- package/dist/version.d.ts +1 -1
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +1 -1
- package/package.json +8 -10
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# jats-cli
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/jats-cli)
|
|
4
|
-
[](https://github.com/curvenote/jats
|
|
5
|
-
[](https://github.com/curvenote/jats/blob/main/LICENSE)
|
|
5
|
+
[](https://github.com/curvenote/jats-cli/actions)
|
|
6
6
|
|
|
7
7
|
Node CLI for working with JATS XML documents.
|
|
8
8
|
|
|
@@ -11,7 +11,7 @@ Read, write, and convert JATS XML and log summaries from the command line.
|
|
|
11
11
|
To use from the command line, use the `-g` to create a global install, which will provide a `jats` CLI:
|
|
12
12
|
|
|
13
13
|
```
|
|
14
|
-
npm install -g jats-
|
|
14
|
+
npm install -g jats-cli
|
|
15
15
|
jats -v
|
|
16
16
|
```
|
|
17
17
|
|
|
@@ -30,10 +30,20 @@ Commands available:
|
|
|
30
30
|
`download`: attempt to find the JATS file and download it locally.
|
|
31
31
|
|
|
32
32
|
```bash
|
|
33
|
-
jats download https://elifesciences.org/articles/81952 article.jats
|
|
33
|
+
jats download https://elifesciences.org/articles/81952 -o article.jats
|
|
34
34
|
```
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
For some Open Access PMC articles, you may download associated files with the `--data` option.
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
jats download PMC11025918 --data
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
`convert`: convert a JATS file to MyST-compatible JSON. The `--frontmatter project` option will write frontmatter to a `myst.yml` file.
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
jats convert article.jats --frontmatter project
|
|
46
|
+
```
|
|
37
47
|
|
|
38
48
|
`summary`: summarize the contents of the JATS, given a URL, DOI, or local file
|
|
39
49
|
|
|
@@ -84,6 +94,6 @@ As of v1.0.0 this package is [ESM only](https://gist.github.com/sindresorhus/a39
|
|
|
84
94
|
<p style="text-align: center; color: #aaa; padding-top: 50px">
|
|
85
95
|
Made with love by
|
|
86
96
|
<a href="https://curvenote.com" target="_blank" style="color: #aaa">
|
|
87
|
-
<img src="https://curvenote.
|
|
97
|
+
<img src="https://cdn.curvenote.com/brand/logo-blue-icon.png" style="height: 1em" /> Curvenote
|
|
88
98
|
</a>
|
|
89
99
|
</p>
|
package/dist/convert.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convert.d.ts","sourceRoot":"","sources":["../src/convert.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAU,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"convert.d.ts","sourceRoot":"","sources":["../src/convert.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAU,MAAM,WAAW,CAAC;AA6B5C,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,QAE7C"}
|
package/dist/convert.js
CHANGED
|
@@ -5,6 +5,8 @@ function makeConvertCLI(program) {
|
|
|
5
5
|
.description('Convert JATS file to MyST mdast json')
|
|
6
6
|
.argument('<input>', 'The JATS file')
|
|
7
7
|
.addOption(new Option('--frontmatter <frontmatter>', 'Treat JATS frontmatter fields as page or project, or ignore if not specified').choices(['page', 'project']))
|
|
8
|
+
.addOption(new Option('--no-dois, --no-doi', 'By default, DOIs are used for references when available, to be later resolved against doi.org. This option disables that behavior and creates bibtex entries for citations with DOIs.'))
|
|
9
|
+
.addOption(new Option('--no-bibtex, --no-bib', 'By default, a bibtex file will be written with referenced citations. This option prevents writing that file'))
|
|
8
10
|
.action(jatsConvert);
|
|
9
11
|
return command;
|
|
10
12
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"download.d.ts","sourceRoot":"","sources":["../src/download.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAU,MAAM,WAAW,CAAC;AAqB5C,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,QAE9C"}
|
package/dist/download.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Command, Option } from 'commander';
|
|
2
|
+
import { jatsFetch } from 'jats-fetch';
|
|
3
|
+
import { clirun, getSession } from 'myst-cli-utils';
|
|
4
|
+
function makeDownloadCLI(program) {
|
|
5
|
+
const command = new Command('download')
|
|
6
|
+
.alias('fetch')
|
|
7
|
+
.description('Download JATS from URL or identifier')
|
|
8
|
+
.argument('<input>', 'URL or other article identifier')
|
|
9
|
+
.addOption(new Option('-o, --output <output>', 'Output filename or folder'))
|
|
10
|
+
.addOption(new Option('--data', 'Attempt to fetch all data associated with JATS XML'))
|
|
11
|
+
.addOption(new Option('--listing <listing>', 'Pointer to PMC listing file; if not provided, listing file will be downloaded and cached as needed'))
|
|
12
|
+
.action(clirun(jatsFetch, { program, getSession }));
|
|
13
|
+
return command;
|
|
14
|
+
}
|
|
15
|
+
export function addDownloadCLI(program) {
|
|
16
|
+
program.addCommand(makeDownloadCLI(program));
|
|
17
|
+
}
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { Command } from 'commander';
|
|
3
3
|
import version from './version.js';
|
|
4
|
-
import {
|
|
4
|
+
import { addParseCLI } from './parse.js';
|
|
5
5
|
import { addValidateCLI } from './validate.js';
|
|
6
6
|
import { addTestCLI } from './jats-test.js';
|
|
7
7
|
import { addConvertCLI } from './convert.js';
|
|
8
|
+
import { addDownloadCLI } from './download.js';
|
|
8
9
|
const program = new Command();
|
|
9
10
|
addDownloadCLI(program);
|
|
11
|
+
addParseCLI(program);
|
|
10
12
|
addValidateCLI(program);
|
|
11
13
|
addConvertCLI(program);
|
|
12
14
|
addTestCLI(program);
|