@mtillmann/chapters 0.1.8 → 0.2.0
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/dist/index.d.ts +6 -1
- package/dist/index.js +22 -1
- package/package.json +1 -1
- package/readme.md +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -8,9 +8,14 @@ interface Chapter {
|
|
|
8
8
|
duration?: number;
|
|
9
9
|
title?: string;
|
|
10
10
|
url?: string;
|
|
11
|
-
location?:
|
|
11
|
+
location?: ChapterLocation;
|
|
12
12
|
toc?: boolean;
|
|
13
13
|
}
|
|
14
|
+
interface ChapterLocation {
|
|
15
|
+
name: string;
|
|
16
|
+
geo: string;
|
|
17
|
+
osm?: string;
|
|
18
|
+
}
|
|
14
19
|
|
|
15
20
|
interface MediaItemMeta {
|
|
16
21
|
author?: string;
|
package/dist/index.js
CHANGED
|
@@ -243,6 +243,14 @@ var Base = class {
|
|
|
243
243
|
const endTime = this.endTime(index);
|
|
244
244
|
const duration = endTime - this.chapters[index].startTime;
|
|
245
245
|
const timestampOptions = { hours: false };
|
|
246
|
+
const location = {
|
|
247
|
+
...{
|
|
248
|
+
name: "",
|
|
249
|
+
geo: "",
|
|
250
|
+
osm: ""
|
|
251
|
+
},
|
|
252
|
+
..."location" in chapter ? chapter.location : {}
|
|
253
|
+
};
|
|
246
254
|
return {
|
|
247
255
|
...{
|
|
248
256
|
id: hash(),
|
|
@@ -250,6 +258,7 @@ var Base = class {
|
|
|
250
258
|
},
|
|
251
259
|
...chapter,
|
|
252
260
|
...{
|
|
261
|
+
location,
|
|
253
262
|
endTime,
|
|
254
263
|
duration,
|
|
255
264
|
startTime_hr: secondsToTimestamp(chapter.startTime, timestampOptions),
|
|
@@ -332,12 +341,24 @@ var Base = class {
|
|
|
332
341
|
if (!("toc" in filtered) && options.writeRedundantToc) {
|
|
333
342
|
filtered.toc = true;
|
|
334
343
|
}
|
|
335
|
-
["
|
|
344
|
+
["img", "url", "title"].forEach((property) => {
|
|
336
345
|
const key = property;
|
|
337
346
|
if (key in chapter && String(chapter[key]).trim().length > 0) {
|
|
338
347
|
filtered[key] = chapter[key];
|
|
339
348
|
}
|
|
340
349
|
});
|
|
350
|
+
if ("location" in chapter) {
|
|
351
|
+
const name = chapter.location?.name?.trim();
|
|
352
|
+
const geo = chapter.location?.geo?.trim();
|
|
353
|
+
const osm = chapter.location?.osm?.trim();
|
|
354
|
+
if (name || geo || osm) {
|
|
355
|
+
filtered.location = {
|
|
356
|
+
name,
|
|
357
|
+
geo,
|
|
358
|
+
osm
|
|
359
|
+
};
|
|
360
|
+
}
|
|
361
|
+
}
|
|
341
362
|
if ("img_filename" in chapter && "img" in filtered && chapter.img_type === "relative") {
|
|
342
363
|
filtered.img = filenamify(chapter.img_filename);
|
|
343
364
|
}
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
This is the core library of [chaptertool](https://github.com/Mtillmann/chaptertool) and [chapconv](https://github.com/Mtillmann/chapconv/) and provides the functionality to handle the formats below.
|
|
8
8
|
|
|
9
|
-
[Click here to open the web GUI](https://mtillmann.github.io/chaptertool)
|
|
9
|
+
[Click here to open the chaptertool web GUI](https://mtillmann.github.io/chaptertool).
|
|
10
10
|
|
|
11
11
|
## Supported formats
|
|
12
12
|
|