wp-epub-gen 0.1.1 → 0.1.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.
@@ -15,6 +15,7 @@ function parseContent(content, index, epubConfigs) {
15
15
  let chapter = Object.assign({}, content);
16
16
  if (!chapter.filename) {
17
17
  let titleSlug = uslug((0, diacritics_1.remove)(chapter.title || 'no title'));
18
+ titleSlug = titleSlug.replace(/[\/\\]/g, '_');
18
19
  chapter.href = `${index}_${titleSlug}.xhtml`;
19
20
  chapter.filePath = path.join(epubConfigs.dir, 'OEBPS', chapter.href);
20
21
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wp-epub-gen",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "Epub generator.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -27,40 +27,40 @@
27
27
  "@types/diacritics": "^1.3.1",
28
28
  "@types/uslug": "^1.0.1",
29
29
  "@types/uuid": "^8.3.4",
30
- "archiver": "^5.3.0",
30
+ "archiver": "^5.3.1",
31
31
  "cheerio": "^0.22.0",
32
32
  "diacritics": "^1.3.0",
33
- "ejs": "^3.1.6",
34
- "entities": "^3.0.1",
35
- "fs-extra": "^10.0.1",
33
+ "ejs": "^3.1.8",
34
+ "entities": "^4.4.0",
35
+ "fs-extra": "^10.1.0",
36
36
  "mime": "^3.0.0",
37
- "superagent": "^7.1.1",
37
+ "superagent": "^8.0.3",
38
38
  "uslug": "^1.0.4",
39
- "uuid": "^8.3.2"
39
+ "uuid": "^9.0.0"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@types/archiver": "^5.3.1",
43
43
  "@types/cheerio": "^0.22.31",
44
- "@types/ejs": "^3.1.0",
44
+ "@types/ejs": "^3.1.1",
45
45
  "@types/fs-extra": "^9.0.13",
46
- "@types/mime": "^2.0.3",
46
+ "@types/mime": "^3.0.1",
47
47
  "@types/superagent": "^4.1.15",
48
- "@typescript-eslint/eslint-plugin": "^5.16.0",
49
- "@typescript-eslint/parser": "^5.16.0",
50
- "chai": "^4.3.6",
48
+ "@typescript-eslint/eslint-plugin": "^5.43.0",
49
+ "@typescript-eslint/parser": "^5.43.0",
50
+ "chai": "^4.3.7",
51
51
  "cross-env": "^7.0.3",
52
- "eslint": "^8.11.0",
52
+ "eslint": "^8.28.0",
53
53
  "eslint-config-prettier": "^8.5.0",
54
- "eslint-plugin-import": "^2.25.4",
55
- "espower-typescript": "^10.0.0",
56
- "mocha": "^9.2.2",
57
- "prettier": "^2.6.1",
58
- "terser-webpack-plugin": "^5.3.1",
59
- "ts-loader": "^9.2.8",
60
- "tsconfig-paths": "^3.14.1",
61
- "typescript": "^4.6.3",
62
- "webpack": "^5.70.0",
63
- "webpack-cli": "^4.9.2",
54
+ "eslint-plugin-import": "^2.26.0",
55
+ "espower-typescript": "^10.0.1",
56
+ "mocha": "^10.1.0",
57
+ "prettier": "^2.7.1",
58
+ "terser-webpack-plugin": "^5.3.6",
59
+ "ts-loader": "^9.4.1",
60
+ "tsconfig-paths": "^4.1.0",
61
+ "typescript": "^4.9.3",
62
+ "webpack": "^5.75.0",
63
+ "webpack-cli": "^5.0.0",
64
64
  "webpack-notifier": "^1.15.0"
65
65
  }
66
66
  }
@@ -21,6 +21,7 @@ export default function parseContent(
21
21
 
22
22
  if (!chapter.filename) {
23
23
  let titleSlug = uslug(removeDiacritics(chapter.title || 'no title'))
24
+ titleSlug = titleSlug.replace(/[\/\\]/g, '_')
24
25
  chapter.href = `${index}_${titleSlug}.xhtml`
25
26
  chapter.filePath = path.join(epubConfigs.dir, 'OEBPS', chapter.href)
26
27
  } else {
@@ -8,14 +8,11 @@
8
8
  xmlns:media="http://www.idpf.org/epub/vocab/overlays/#"
9
9
  prefix="ibooks: http://vocabulary.itunes.apple.com/rdf/ibooks/vocabulary-extensions-1.0/">
10
10
 
11
- <metadata xmlns:dc="http://purl.org/dc/elements/1.1/"
12
- xmlns:opf="http://www.idpf.org/2007/opf">
11
+ <metadata xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:opf="http://www.idpf.org/2007/opf">
13
12
 
14
13
  <dc:identifier id="BookId"><%= id %></dc:identifier>
15
- <meta refines="#BookId" property="identifier-type" scheme="onix:codelist5">
16
- 22</meta>
17
- <meta property="dcterms:identifier" id="meta-identifier">
18
- BookId</meta>
14
+ <meta refines="#BookId" property="identifier-type" scheme="onix:codelist5">22</meta>
15
+ <meta property="dcterms:identifier" id="meta-identifier">BookId</meta>
19
16
  <dc:title><%= title %></dc:title>
20
17
  <meta property="dcterms:title" id="meta-title"><%= title %></meta>
21
18
  <dc:language><%= lang || "en" %></dc:language>
@@ -28,31 +25,31 @@
28
25
  <% var date = new Date(); var year = date.getFullYear(); var month = date.getMonth() + 1; var day = date.getDate(); var stringDate = "" + year + "-" + month + "-" + day; %>
29
26
  <meta property="dcterms:date"><%= stringDate %></meta>
30
27
  <dc:date><%= stringDate %></dc:date>
31
- <meta property="dcterms:rights">
32
- All rights reserved</meta>
28
+ <meta property="dcterms:rights">All rights reserved</meta>
33
29
  <dc:rights>Copyright &#x00A9; <%= (new Date()).getFullYear() %> by <%= publisher || "anonymous" %></dc:rights>
34
- <meta name="cover" content="image_cover"/>
35
- <meta name="generator" content="epub-gen"/>
36
- <meta property="ibooks:specified-fonts">
37
- true</meta>
30
+ <% if(locals.cover) { %>
31
+ <meta name="cover" content="image_cover" />
32
+ <% } %>
33
+ <meta name="generator" content="epub-gen" />
34
+ <meta property="ibooks:specified-fonts">true</meta>
38
35
  </metadata>
39
36
 
40
37
  <manifest>
41
- <item id="ncx" href="toc.ncx" media-type="application/x-dtbncx+xml"/>
42
- <item id="toc" href="toc.xhtml" media-type="application/xhtml+xml" properties="nav"/>
43
- <item id="css" href="style.css" media-type="text/css"/>
38
+ <item id="ncx" href="toc.ncx" media-type="application/x-dtbncx+xml" />
39
+ <item id="toc" href="toc.xhtml" media-type="application/xhtml+xml" properties="nav" />
40
+ <item id="css" href="style.css" media-type="text/css" />
44
41
 
45
42
  <% if(locals.cover) { %>
46
- <item id="image_cover" href="cover.<%= _coverExtension %>" media-type="<%= _coverMediaType %>"/>
43
+ <item id="image_cover" href="cover.<%= _coverExtension %>" media-type="<%= _coverMediaType %>" />
47
44
  <% } %>
48
45
 
49
46
  <% images.forEach(function(image, index){ %>
50
- <item id="image_<%= index %>" href="images/<%= image.id %>.<%= image.extension %>" media-type="<%= image.mediaType %>"/>
47
+ <item id="image_<%= index %>" href="images/<%= image.id %>.<%= image.extension %>" media-type="<%= image.mediaType %>" />
51
48
  <% }) %>
52
49
 
53
50
  <% function renderContentItem(content) { %>
54
51
  <% content.forEach(function(content){ %>
55
- <item id="content_<%= content.id %>" href="<%= content.href %>" media-type="application/xhtml+xml"/>
52
+ <item id="content_<%= content.id %>" href="<%= content.href %>" media-type="application/xhtml+xml" />
56
53
  <% if (Array.isArray(content.children)) { %>
57
54
  <% renderContentItem(content.children) %>
58
55
  <% } %>
@@ -61,7 +58,7 @@
61
58
  <% renderContentItem(content) %>
62
59
 
63
60
  <% fonts.forEach(function(font, index){ %>
64
- <item id="font_<%= index %>" href="fonts/<%= font %>" media-type="application/x-font-ttf"/>
61
+ <item id="font_<%= index %>" href="fonts/<%= font %>" media-type="application/x-font-ttf" />
65
62
  <% }) %>
66
63
  </manifest>
67
64
 
@@ -70,17 +67,17 @@
70
67
  <% var nodes_2 = content.filter(item => !item.excludeFromToc && !item.beforeToc) %>
71
68
  <% function renderToc(nodes) { %>
72
69
  <% nodes.forEach(function(content){ %>
73
- <itemref idref="content_<%= content.id %>"/>
70
+ <itemref idref="content_<%= content.id %>" />
74
71
  <% if (Array.isArray(content.children)) { %>
75
72
  <% renderToc(content.children) %>
76
73
  <% } %>
77
74
  <% }) %>
78
75
  <% } %>
79
76
  <% renderToc(nodes_1) %>
80
- <itemref idref="toc"/>
77
+ <itemref idref="toc" />
81
78
  <% renderToc(nodes_2) %>
82
79
  </spine>
83
80
  <guide>
84
- <reference type="text" title="Table of Content" href="toc.xhtml"/>
81
+ <reference type="text" title="Table of Content" href="toc.xhtml" />
85
82
  </guide>
86
83
  </package>