jats-cli 1.0.18 → 1.1.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/README.md +1 -1
- package/dist/convert.js +4 -1
- package/dist/download.d.ts.map +1 -1
- package/dist/download.js +1 -1
- package/dist/jats-test.js +3 -5
- package/dist/jats.cjs +34725 -34542
- package/dist/version.d.ts +1 -1
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +1 -1
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -94,6 +94,6 @@ As of v1.0.0 this package is [ESM only](https://gist.github.com/sindresorhus/a39
|
|
|
94
94
|
<p style="text-align: center; color: #aaa; padding-top: 50px">
|
|
95
95
|
Made with love by
|
|
96
96
|
<a href="https://continuous.foundation" target="_blank" style="color: #aaa">
|
|
97
|
-
Continuous Science Foundation <img src="https://
|
|
97
|
+
Continuous Science Foundation <img src="https://cdn.curvenote.com/static/site/csf/icon.svg" style="height: 1em" />
|
|
98
98
|
</a>
|
|
99
99
|
</p>
|
package/dist/convert.js
CHANGED
|
@@ -5,7 +5,10 @@ function makeConvertCLI(program) {
|
|
|
5
5
|
const command = new Command('convert')
|
|
6
6
|
.description('Convert JATS file to MyST mdast json')
|
|
7
7
|
.argument('[input]', 'The JATS file')
|
|
8
|
-
.addOption(new Option('--frontmatter <frontmatter>', 'Treat JATS frontmatter fields as page or project
|
|
8
|
+
.addOption(new Option('--frontmatter <frontmatter>', 'Treat JATS frontmatter fields as page or project')
|
|
9
|
+
.choices(['page', 'project'])
|
|
10
|
+
.default('project'))
|
|
11
|
+
.addOption(new Option('--no-frontmatter', 'Ignore JATS frontmatter'))
|
|
9
12
|
.addOption(new Option('--no-doi, --no-dois', '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.'))
|
|
10
13
|
.addOption(new Option('--no-bib, --no-bibtex', 'By default, a bibtex file will be written with referenced citations. This option prevents writing that file'))
|
|
11
14
|
.action(clirun(jatsConvert, { program, getSession }));
|
package/dist/download.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"download.d.ts","sourceRoot":"","sources":["../src/download.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAU,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"download.d.ts","sourceRoot":"","sources":["../src/download.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAU,MAAM,WAAW,CAAC;AA0B5C,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,QAE9C"}
|
package/dist/download.js
CHANGED
|
@@ -7,7 +7,7 @@ function makeDownloadCLI(program) {
|
|
|
7
7
|
.description('Download JATS from URL or identifier')
|
|
8
8
|
.argument('<input>', 'URL or other article identifier')
|
|
9
9
|
.addOption(new Option('-o, --output <output>', 'Output filename or folder'))
|
|
10
|
-
.addOption(new Option('--data', '
|
|
10
|
+
.addOption(new Option('--no-data', 'Only attempt to fetch JATS XML, not full data associated with article.'))
|
|
11
11
|
.addOption(new Option('--listing <listing>', 'Pointer to PMC listing file; if not provided, listing file will be downloaded and cached as needed'))
|
|
12
12
|
.action(clirun(jatsFetch, { program, getSession }));
|
|
13
13
|
return command;
|
package/dist/jats-test.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Command, Option } from 'commander';
|
|
2
2
|
import { clirun, tic } from 'myst-cli-utils';
|
|
3
|
-
import
|
|
3
|
+
import { load, dump } from 'js-yaml';
|
|
4
4
|
import fs from 'fs';
|
|
5
5
|
import { select, selectAll } from 'unist-util-select';
|
|
6
6
|
import { is } from 'unist-util-is';
|
|
@@ -9,14 +9,12 @@ import { getSession } from 'jats-xml';
|
|
|
9
9
|
import { parseJats } from './parse.js';
|
|
10
10
|
const INDENT = ' ';
|
|
11
11
|
function printNodes(expected, received) {
|
|
12
|
-
return chalk.reset(`\n${INDENT}${chalk.greenBright('Expected node containing')}:\n${INDENT} ${
|
|
13
|
-
.dump(expected)
|
|
14
|
-
.replace(/\n/g, `\n${INDENT} `)}\n${INDENT}${chalk.redBright('Received node')}:\n${INDENT} ${yaml.dump(received).replace(/\n/g, `\n${INDENT} `)}`);
|
|
12
|
+
return chalk.reset(`\n${INDENT}${chalk.greenBright('Expected node containing')}:\n${INDENT} ${dump(expected).replace(/\n/g, `\n${INDENT} `)}\n${INDENT}${chalk.redBright('Received node')}:\n${INDENT} ${dump(received).replace(/\n/g, `\n${INDENT} `)}`);
|
|
15
13
|
}
|
|
16
14
|
export async function testJatsFile(session, file, opts) {
|
|
17
15
|
const toc = tic();
|
|
18
16
|
const jats = await parseJats(session, file);
|
|
19
|
-
const tests =
|
|
17
|
+
const tests = load(fs.readFileSync(opts.cases).toString());
|
|
20
18
|
const results = tests.cases.map((testCase, index) => {
|
|
21
19
|
if (!testCase.title) {
|
|
22
20
|
return [`Test Case ${index}`, null, 'Test must include a title'];
|