Skip to content

Commit

Permalink
allow unicode filename & added timestamp to img
Browse files Browse the repository at this point in the history
  • Loading branch information
maoserr committed Nov 8, 2024
1 parent 4d8a9f0 commit fae5272
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 15 deletions.
22 changes: 11 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"primeicons": "^7.0.0",
"primevue": "^3.53.0",
"prismjs": "^1.29.0",
"tsepub": "^1.1.23",
"tsepub": "^1.1.25",
"vue": "^3.5.12",
"vue-codemirror": "^6.1.1",
"vue-prism-editor": "^2.0.0-alpha.2",
Expand Down
2 changes: 1 addition & 1 deletion src/pages/proc_funcs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export async function run_epub(chaps: Ref<Chapter[]>,
let nov_data: NovelData = {
meta: meta.value,
chapters: epub_chaps,
filename: meta.value.title.toLowerCase().replace(/[\W_]+/g, "_") + ".epub"
filename: meta.value.title.toLowerCase().replace(/[/\\?%*:|"<>]/gi, "-") + ".epub"
}
if (meta.value.cover != null) {
let response = await fetch(meta.value.cover);
Expand Down
5 changes: 3 additions & 2 deletions src/services/novel/epub_generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@ export async function generate_epub(nov_data: NovelData, update_cb: CallableFunc
let img_resp = await fetch(img.src)
if (img_resp.ok) {
let img_dat = await img_resp.blob();
tsepub.image(img_dat, img_id.toString(), img.alt)
let curr_id = img_id.toString()+"-"+Date.now().toString()
tsepub.image(img_dat, curr_id, img.alt)
let sp = html_node.createElement("span")
sp.innerText = `{{{ image[${img_id.toString()}] }}}`
sp.innerText = `{{{ image[${curr_id}] }}}`
img.replaceWith(sp)
img_id++;
}
Expand Down

0 comments on commit fae5272

Please sign in to comment.