meca 0.0.0 → 1.0.3

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 ADDED
@@ -0,0 +1,37 @@
1
+ # meca
2
+
3
+ [![meca on npm](https://img.shields.io/npm/v/meca.svg)](https://www.npmjs.com/package/meca)
4
+ [![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/curvenote/meca/blob/main/LICENSE)
5
+ [![CI](https://github.com/curvenote/meca/workflows/CI/badge.svg)](https://github.com/curvenote/meca/actions)
6
+
7
+ Types and utilities for working with MECA bundles documents in Node and Typescript.
8
+
9
+ Read and write MECA bundles from node or see summaries from the command line.
10
+
11
+ To use from the command line, use the `-g` to create a global install, which will provide a `meca` CLI:
12
+
13
+ ```
14
+ npm install -g meca
15
+ meca -v
16
+ ```
17
+
18
+ ## What is MECA?
19
+
20
+ ## Packages
21
+
22
+ See packages folder:
23
+
24
+ - meca
25
+
26
+ ---
27
+
28
+ This package is [ESM only](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c).
29
+
30
+ ---
31
+
32
+ <p style="text-align: center; color: #aaa; padding-top: 50px">
33
+ Made with love by
34
+ <a href="https://curvenote.com" target="_blank" style="color: #aaa">
35
+ <img src="https://curvenote.dev/images/icon.png" style="height: 1em" /> Curvenote
36
+ </a>
37
+ </p>
@@ -0,0 +1,43 @@
1
+ <!-- DOCTYPE manifest PUBLIC “-//MECA//DTD Manifest v1.0//en"
2
+ "https://www.manuscriptexchange.org/schema/manifest-1.0.dtd"
3
+ -->
4
+ <!-- ============================================================= -->
5
+ <!-- SPECIAL CHARACTER MODULES -->
6
+ <!-- ============================================================= -->
7
+ <!-- SPECIAL CHARACTERS DECLARATIONS -->
8
+ <!-- Declares any standard XML special character
9
+ entities used in this DTD -->
10
+ <!ENTITY % xmlspecchars.ent
11
+ PUBLIC
12
+ "-//NLM//DTD JATS (Z39.96) JATS DTD Suite XML Special Characters Module v1.2 20190208//EN"
13
+ "JATS-xmlspecchars1.ent" >
14
+ <!-- CUSTOM SPECIAL CHARACTERS DECLARATIONS -->
15
+ <!-- Declares any custom special character
16
+ entities created for this Suite -->
17
+ <!ENTITY % chars.ent PUBLIC
18
+ "-//NLM//DTD JATS (Z39.96) JATS DTD Suite Custom Special Characters Module v1.2
19
+ 20190208//EN"
20
+ "JATS-chars1.ent" >
21
+ <!ELEMENT manifest (item+)>
22
+ <!ATTLIST manifest xmlns CDATA #FIXED "https://manuscriptexchange.org/schema/manifest">
23
+ <!ATTLIST manifest xmlns:xlink CDATA #FIXED "http://www.w3.org/1999/xlink">
24
+ <!ATTLIST manifest manifest-version CDATA #REQUIRED>
25
+ <!ELEMENT item (item-title?, item-description?, file-order?, item-metadata?, instance+)>
26
+ <!ATTLIST item id ID #IMPLIED>
27
+ <!ATTLIST item item-type CDATA #IMPLIED>
28
+ <!ATTLIST item custom-metadata-id CDATA #IMPLIED>
29
+ <!ATTLIST item item-version CDATA #IMPLIED>
30
+ <!ELEMENT item-title (#PCDATA)>
31
+ <!ELEMENT item-description (#PCDATA)>
32
+ <!ELEMENT file-order (#PCDATA)>
33
+ <!ELEMENT item-metadata (metadata+)>
34
+ <!ELEMENT metadata (#PCDATA)>
35
+ <!ATTLIST metadata metadata-name CDATA #REQUIRED>
36
+ <!ELEMENT instance EMPTY>
37
+ <!ATTLIST instance xmlns:xlink CDATA #FIXED 'http://www.w3.org/1999/xlink'
38
+ xlink:type (locator) #FIXED 'locator'
39
+ xlink:href CDATA #REQUIRED>
40
+ <!ATTLIST instance media-type CDATA #IMPLIED>
41
+ <!ATTLIST instance origin CDATA #IMPLIED>
42
+ <!ATTLIST instance conversion CDATA #IMPLIED>
43
+ <!ATTLIST instance composition CDATA #IMPLIED>
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env node
2
+ import { Command } from 'commander';
3
+ import version from '../version.js';
4
+ import { addValidateCLI } from './validate.js';
5
+ const program = new Command();
6
+ addValidateCLI(program);
7
+ program.version(`v${version}`, '-v, --version', 'Print the current version of jats-xml');
8
+ program.option('-d, --debug', 'Log out any errors to the console.');
9
+ program.parse(process.argv);
@@ -0,0 +1,2 @@
1
+ import { Command } from 'commander';
2
+ export declare function addValidateCLI(program: Command): void;
@@ -0,0 +1,25 @@
1
+ import { Command, Option } from 'commander';
2
+ import { clirun } from 'myst-cli-utils';
3
+ import { getSession } from 'jats-xml';
4
+ import { validateMecaWrapper } from '../validate/index.js';
5
+ function makeValidateCLI(program) {
6
+ const command = new Command('validate')
7
+ .description(`
8
+ Validate MECA file against zip structure and DTD schemas.
9
+
10
+ The zip file must have a 'manifest.xml' file which must pass Manifest DTD validation.
11
+ All the files in the manifest must exist in the zip file, with no others present.
12
+ Any JATS files must validate against JATS DTD schema.
13
+ `)
14
+ .argument('<file>', 'MECA file to validate')
15
+ .addOption(new Option('--library <value>', 'JATS library - archiving, publishing, or authoring (default: archiving, if value cannot be inferred from file)'))
16
+ .addOption(new Option('--jats <version>', 'JATS version, must be 1.1 or later (default: 1.3, if value cannot be inferred from file)'))
17
+ .addOption(new Option('--mathml <version>', 'MathML version, 2 or 3 (default: 3, if value cannot be inferred from file)'))
18
+ .addOption(new Option('--oasis', 'Use OASIS table model (default: false, if value cannot be inferred from file)'))
19
+ .addOption(new Option('--directory <value>', 'Directory to save JATS DTD file'))
20
+ .action(clirun(validateMecaWrapper, { program, getSession }));
21
+ return command;
22
+ }
23
+ export function addValidateCLI(program) {
24
+ program.addCommand(makeValidateCLI(program));
25
+ }
@@ -0,0 +1,2 @@
1
+ export { default as version } from './version.js';
2
+ export * from './validate/index.js';
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export { default as version } from './version.js';
2
+ export * from './validate/index.js';