New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

biiif

Package Overview
Dependencies
Maintainers
1
Versions
73
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

biiif - npm Package Compare versions

Comparing version 0.0.7 to 0.0.8

24

Canvas.js

@@ -13,7 +13,10 @@ "use strict";

constructor(filePath, url) {
this.metadata = {};
this.infoYml = {};
this.filePath = filePath;
this.url = url;
}
getFiles(canvasJson) {
create(canvasJson) {
this.canvasJson = canvasJson;
this._getMetadata();
this._applyMetadata();
// for each jpg/pdf/mp4/obj in the canvas directory

@@ -32,3 +35,2 @@ // add a contentannotation

if (matchingExtension) {
this._getMetadata();
const annotationJson = Utils_1.cloneJson(contentAnnotationBoilerplate);

@@ -40,3 +42,3 @@ annotationJson.id = canvasJson.id + '/annotation/' + matchingFiles.length;

annotationJson.body.format = matchingExtension.format;
annotationJson.body.label = this.metadata.label;
annotationJson.body.label = this.infoYml.label;
canvasJson.content[0].items.push(annotationJson);

@@ -51,7 +53,7 @@ matchingFiles.push(file);

_getMetadata() {
this.metadata = {};
this.infoYml = {};
// if there's an info.yml
const ymlPath = join(this.filePath, 'info.yml');
if (existsSync(ymlPath)) {
this.metadata = yaml.safeLoad(readFileSync(ymlPath, 'utf8'));
this.infoYml = yaml.safeLoad(readFileSync(ymlPath, 'utf8'));
console.log(chalk.green('got metadata for: ') + this.filePath);

@@ -62,8 +64,14 @@ }

}
if (!this.metadata.label) {
if (!this.infoYml.label) {
// default to the directory name
this.metadata.label = posix.basename(this.filePath);
this.infoYml.label = posix.basename(this.filePath);
}
}
_applyMetadata() {
this.canvasJson.label = this.infoYml.label; // defaults to directory name
if (this.infoYml.metadata) {
this.canvasJson.metadata = this.infoYml.metadata;
}
}
}
exports.Canvas = Canvas;

@@ -65,7 +65,7 @@ "use strict";

_getMetadata() {
this.metadata = {};
this.infoYml = {};
// if there's an info.yml
const ymlPath = join(this.filePath, 'info.yml');
if (existsSync(ymlPath)) {
this.metadata = yaml.safeLoad(readFileSync(ymlPath, 'utf8'));
this.infoYml = yaml.safeLoad(readFileSync(ymlPath, 'utf8'));
console.log(chalk.green('got metadata for: ') + this.filePath);

@@ -76,5 +76,5 @@ }

}
if (!this.metadata.label) {
if (!this.infoYml.label) {
// default to the directory name
this.metadata.label = posix.basename(this.filePath);
this.infoYml.label = posix.basename(this.filePath);
}

@@ -95,3 +95,3 @@ }

memberJson.id = directory.url + '/index.json';
memberJson.label = directory.metadata.label;
memberJson.label = directory.infoYml.label;
this.indexJson.members.push(memberJson);

@@ -107,3 +107,3 @@ });

canvasJson.content[0].id = this.url + '/index.json/canvas/' + index + '/annotationpage/0';
canvas.getFiles(canvasJson);
canvas.create(canvasJson);
// add canvas to sequence

@@ -120,10 +120,13 @@ this.indexJson.sequences[0].canvases.push(canvasJson);

_applyMetadata() {
this.indexJson.label = this.metadata.label;
this.indexJson.label = this.infoYml.label; // defaults to directory name
if (this.infoYml.metadata) {
this.indexJson.metadata = this.infoYml.metadata;
}
// add manifest-specific properties
if (!this.isCollection) {
if (this.metadata.attribution) {
this.indexJson.attribution = this.metadata.attribution;
if (this.infoYml.attribution) {
this.indexJson.attribution = this.infoYml.attribution;
}
if (this.metadata.description) {
this.indexJson.description = this.metadata.description;
if (this.infoYml.description) {
this.indexJson.description = this.infoYml.description;
}

@@ -130,0 +133,0 @@ }

{
"name": "biiif",
"version": "0.0.7",
"version": "0.0.8",
"description": "A CLI to build IIIF collections",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -5,4 +5,6 @@ # BIIIF (Build IIIF)

BIIIF is a CLI that uses your file system to generate IIIF collections and manifests.
BIIIF is a CLI that uses your file system to generate static IIIF collections and manifests.
Note: This uses the [IIIF Presentation API v3](http://prezi3.iiif.io/api/presentation/3.0/) (currently in alpha), but is compatible with the [Universal Viewer](http://universalviewer.io) v3 (in development).
Example:

@@ -26,3 +28,3 @@

To add metadata to your collections/manifests, include an `info.yml` file in the folder e.g.
To add metadata to your collections/manifests/canvases, include an `info.yml` file in the folder e.g.

@@ -32,31 +34,40 @@ ```

description: The Lord of the Rings Trilogy
attribution: J. R. R. Tolkien
attribution: J. R. R. Tolkien
metadata:
license: Copyright Tolkien Estate
Author: J. R. R. Tolkien
```
You can also add metadata to your canvases by including an `info.yml` in the canvas folder, e.g.
## Examples
```
label: Illustration of Gollum
```
Here is an example of how to organise your files/folders for BIIIF.
## Examples
This example only has a single root collection, but BIIIF will happily build collections to any nested depth.
BIIIF will accept a manifest folder too, generating a single manifest `index.json`.
```
lord-of-the-rings // collection
├── info.yml // metadata
├── the-fellowship-of-the-ring // manifest
| ├── _page-1 // canvas
| ├── _page-2 // canvas
| ├── _page-n // canvas
| └── info.yml // metadata
├── the-two-towers // manifest
| ├── _page-1 // canvas
| ├── _page-2 // canvas
| ├── _page-n // canvas
| └── info.yml // metadata
└── the-return-of-the-king // manifest
├── _page-1 // canvas
├── _page-2 // canvas
├── _page-n // canvas
└── info.yml // metadata
lord-of-the-rings // collection
├── info.yml // collection metadata
├── the-fellowship-of-the-ring // manifest
| ├── _page-1 // canvas
| | ├── page-1.jpg // content annotation
| | └── info.yml // canvas metadata
| ├── _page-2 // canvas
| | ├── page-2.jpg // content annotation
| | └── info.yml // canvas metadata
| ├── _page-n // canvas
| | ├── page-n.jpg // content annotation
| | └── info.yml // canvas metadata
| └── info.yml // manifest metadata
├── the-two-towers // manifest
| ├── _page-1 // canvas
| ├── _page-2 // canvas
| ├── _page-n // canvas
| └── info.yml // manifest metadata
└── the-return-of-the-king // manifest
├── _page-1 // canvas
├── _page-2 // canvas
├── _page-n // canvas
└── info.yml // manifest metadata
```

@@ -63,0 +74,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc