Skip to content

Commit

Permalink
Merge pull request #49 from cu-mkp/dev
Browse files Browse the repository at this point in the history
EditionCrafter CLI 1.1
  • Loading branch information
camdendotlol authored Dec 5, 2024
2 parents bf42f93 + c56c39e commit 43e66a6
Show file tree
Hide file tree
Showing 53 changed files with 8,866 additions and 2,886 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publish_to_npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
# Setup .npmrc file to publish to npm
- uses: actions/setup-node@v3
with:
node-version: '20.x'
node-version: 20.x
registry-url: 'https://registry.npmjs.org'
scope: '@cu-mkp'
- run: npm ci
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ node_modules/
public/
*.log
.DS_Store
data/config.json
data/config.json
out/*
out.xml
114 changes: 57 additions & 57 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,58 +1,58 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Test Locally",
"skipFiles": [
"<node_internals>/**"
],
"program": "${workspaceFolder}/editioncrafter",
"args": ["process", "data/fr640_3r-3v-example.xml", "public"]
},
{
"type": "node",
"request": "launch",
"name": "Test NBU Locally",
"skipFiles": [
"<node_internals>/**"
],
"program": "${workspaceFolder}/editioncrafter",
"args": ["process", "data/FHL_007548705_ISLETA_BAPTISMS_1.xml", "public"]
},
{
"type": "node",
"request": "launch",
"name": "Generate for EC Testing",
"skipFiles": [
"<node_internals>/**"
],
"program": "${workspaceFolder}/editioncrafter",
"args": ["process", "data/fr640_3r-3v-example.xml", "public", "http://localhost:5000"]
},
{
"type": "node",
"request": "launch",
"name": "EditionCrafter Test Website",
"skipFiles": [
"<node_internals>/**"
],
"program": "${workspaceFolder}/editioncrafter",
"args": ["process", "data/fr640_3r-3v-example.xml", "public", "https://cu-mkp.github.io/editioncrafter-data"]
},
{
"type": "node",
"request": "launch",
"name": "EditionCrafter Server Mode",
"skipFiles": [
"<node_internals>/**"
],
"program": "${workspaceFolder}/editioncrafter",
"args": ["server","-c","data/config.json"]
}
]
}
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Test Locally",
"skipFiles": [
"<node_internals>/**"
],
"program": "${workspaceFolder}/editioncrafter",
"args": ["process", "data/fr640_3r-3v-example.xml", "public"]
},
{
"type": "node",
"request": "launch",
"name": "Test NBU Locally",
"skipFiles": [
"<node_internals>/**"
],
"program": "${workspaceFolder}/editioncrafter",
"args": ["process", "data/FHL_007548705_ISLETA_BAPTISMS_1.xml", "public"]
},
{
"type": "node",
"request": "launch",
"name": "Generate for EC Testing",
"skipFiles": [
"<node_internals>/**"
],
"program": "${workspaceFolder}/editioncrafter",
"args": ["process", "data/fr640_3r-3v-example.xml", "public", "http://localhost:5000"]
},
{
"type": "node",
"request": "launch",
"name": "EditionCrafter Test Website",
"skipFiles": [
"<node_internals>/**"
],
"program": "${workspaceFolder}/editioncrafter",
"args": ["process", "data/fr640_3r-3v-example.xml", "public", "https://cu-mkp.github.io/editioncrafter-data"]
},
{
"type": "node",
"request": "launch",
"name": "EditionCrafter Server Mode",
"skipFiles": [
"<node_internals>/**"
],
"program": "${workspaceFolder}/editioncrafter",
"args": ["server", "-c", "data/config.json"]
}
]
}
50 changes: 50 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
// Disable the default formatter, use eslint instead
"prettier.enable": false,
"editor.formatOnSave": false,

// Auto fix
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit",
"source.organizeImports": "never"
},

// Silent the stylistic rules in you IDE, but still auto fix them
"eslint.rules.customizations": [
{ "rule": "style/*", "severity": "off", "fixable": true },
{ "rule": "format/*", "severity": "off", "fixable": true },
{ "rule": "*-indent", "severity": "off", "fixable": true },
{ "rule": "*-spacing", "severity": "off", "fixable": true },
{ "rule": "*-spaces", "severity": "off", "fixable": true },
{ "rule": "*-order", "severity": "off", "fixable": true },
{ "rule": "*-dangle", "severity": "off", "fixable": true },
{ "rule": "*-newline", "severity": "off", "fixable": true },
{ "rule": "*quotes", "severity": "off", "fixable": true },
{ "rule": "*semi", "severity": "off", "fixable": true }
],

// Enable eslint for all supported languages
"eslint.validate": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact",
"vue",
"html",
"markdown",
"json",
"jsonc",
"yaml",
"toml",
"xml",
"gql",
"graphql",
"astro",
"svelte",
"css",
"less",
"scss",
"pcss",
"postcss"
]
}
57 changes: 43 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,7 @@ The `editioncrafter` command will now be available. If it doesn't work right awa

## Usage

The following commands are available to the EditionCrafter CLI. Note that you may optionally pass the path of a configuration file as `-c config_path` rather than passing individual parameters. The optional configuration file is a JSON file with the following options:

```
{
"targetPath": "myfile.xml",
"outputPath": ".",
"baseURL": "http://localhost:8080",
"thumbnailWidth": 124,
"thumbnailHeight": 192
}
```
The following commands are available to the EditionCrafter CLI.

### help

Expand All @@ -48,22 +38,61 @@ editioncrafter help
```
This will display information on the syntax for passing commands to the CLI as well as a list of available commands.

### iiif
### iiif

Usage:
```
editioncrafter iiif <iiif_url> <output_path>
editioncrafter iiif -i <iiif_url> -o <output_path>
```
This will create an XML file at the location of the provided `<output_path>` based on the information in the IIIF manifest supplied. Note that in this case the `<output_path>` should be a single XML File, e.g. `/MyFiles/TEI/index.xml`.

### images

Usage:
```
editioncrafter images -i <csv path> -o <output file>
```
This will create an XML file at the location of the provided `<output_path>` based on the image data in the CSV file supplied. Note that in this case the `<output_path>` should be a single XML File, e.g. `/MyFiles/TEI/index.xml`.

The CSV file should be in the following format:

```csv
url,label,xml_id
"https://mywebsite/foo.jpg","My first page","f000"
"https://mywebsite/foo2.jpg","My second page","f001"
```

### process

Usage:
```
editioncrafter process <tei_file> <output_path> <base_url>
editioncrafter process -i <tei_file> -o <output_path> -u <base_url>
```
This will create all of the artifacts that EditionCrafter needs in order to display your document on the web, and place them in the specified `<output_path>` folder. The `<base_url>` parameter should be the URL at which you intend to host these artifacts.

## Command line options

### `-c` or `--config`

Example usage: `editioncrafter process -c ./myconfig.json`

You may optionally pass the path of a configuration file as `-c config_path` rather than passing individual parameters. The optional configuration file is a JSON file with the following options:

```
{
"inputPath": "myfile.xml",
"outputPath": ".",
"baseUrl": "http://localhost:8080",
}
```

### `-t` or `--text`

Example usage: `editioncrafter iiif -i https://example.com/manifest.json -o ./example.xml -t ./my-text-files`

The `-t` parameter allows you to pass a folder of plain text files to the `images` or `iiif` scripts. The text files will be inserted into the XML file generated by the script.

This option generates `facs` IDs based on each file's name. For example, a file named `f000.txt` will be transformed into a `<pb facs="#f000">` element followed by the text content of the file. Each block of text will be wrapped in an `<ab>` element. Line breaks are preserved with `<lb />` tags.

## Generates the following files:

Expand Down
8 changes: 3 additions & 5 deletions data/config.json.example
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
"projectID": "",
"username": "",
"password": "",
"targetPath": "",
"inputPath": "",
"outputPath": "",
"baseURL": "http://localhost:8080",
"thumbnailWidth": 124,
"thumbnailHeight": 192
}
"baseUrl": "http://localhost:8080",
}
9 changes: 9 additions & 0 deletions data/images-example.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
url,label,xml_id
https://raw.githubusercontent.com/cu-mkp/editioncrafter/refs/heads/dev/editioncrafter/static/images-example/img/f004.jpg,"1r",f004
https://raw.githubusercontent.com/cu-mkp/editioncrafter/refs/heads/dev/editioncrafter/static/images-example/img/f005.jpg,"1v",f005
https://raw.githubusercontent.com/cu-mkp/editioncrafter/refs/heads/dev/editioncrafter/static/images-example/img/f006.jpg,"2r",f006
https://raw.githubusercontent.com/cu-mkp/editioncrafter/refs/heads/dev/editioncrafter/static/images-example/img/f007.jpg,"2v",f007
https://raw.githubusercontent.com/cu-mkp/editioncrafter/refs/heads/dev/editioncrafter/static/images-example/img/f008.jpg,"3r",f008
https://raw.githubusercontent.com/cu-mkp/editioncrafter/refs/heads/dev/editioncrafter/static/images-example/img/f009.jpg,"3v",f009
https://raw.githubusercontent.com/cu-mkp/editioncrafter/refs/heads/dev/editioncrafter/static/images-example/img/f010.jpg,"4r",f010
https://raw.githubusercontent.com/cu-mkp/editioncrafter/refs/heads/dev/editioncrafter/static/images-example/img/f011.jpg,"4v",f011
Loading

0 comments on commit 43e66a6

Please sign in to comment.