-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
π Init 'add-iscn-qr-code-to-epub' (#44)
* π Init 'add-iscn-qr-code-to-epub' * π¨ Improve HTML items naming * β Add archiver * π¨ Use `archiver` to zip to epub * π Update ISCN QR code page style * π Add `<!DOCTYPE html>` --------- Co-authored-by: Ng Wing Tat, David <[email protected]>
- Loading branch information
1 parent
d7936a3
commit d24e946
Showing
12 changed files
with
2,842 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
output/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Add ISCN QR Code to EPUB | ||
|
||
Add an ISCN QR code page to the end of EPUB files. | ||
|
||
## Installation | ||
|
||
Run with `node.js >= 16`, `npm >= 8`. | ||
|
||
```bash | ||
npm install | ||
``` | ||
|
||
## Usage | ||
|
||
1. Create ISCN for your eBooks. You can use [iscn-batch-uploader](../iscn-batch-uploader) to create ISCN in batch. | ||
|
||
2. Put your .epub files in `./input` folder. | ||
|
||
3. Update `./list.csv` with your eBook filename and ISCN ID. | ||
|
||
4. Run the script with: | ||
```bash | ||
npm run start | ||
``` | ||
5. The output files will be in `./output` folder. | ||
|
||
## Configuration | ||
|
||
Change the config in `./config.js` | ||
|
||
You can set the text and `language` to show on the QR code page. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
body { | ||
display: flex; | ||
flex-direction: column; | ||
height: 100vh; | ||
font-family: sans-serif; | ||
} | ||
|
||
main { | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: flex-end; | ||
flex-grow: 1; | ||
padding: 0.5em 2vw 4em; | ||
} | ||
|
||
footer { | ||
border-top: 1px solid #ccc; | ||
padding: 0.5em; | ||
} | ||
|
||
#iscn-page-book-info { | ||
margin-top: 16px; | ||
font-size: 0.8em; | ||
} | ||
|
||
#iscn-page-book-info th, | ||
#iscn-page-book-info td { | ||
padding: 0.25em 2vw; | ||
vertical-align: top; | ||
} | ||
|
||
#iscn-page-book-info th { | ||
text-align: left; | ||
white-space: nowrap; | ||
} | ||
|
||
#iscn-qr-code { | ||
display: block; | ||
margin-top: 0.5em; | ||
} | ||
|
||
#iscn-prefix { | ||
font-family: monospace; | ||
word-break: break-all; | ||
} | ||
|
||
#depub-disclaimer { | ||
text-align: center; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!DOCTYPE html> | ||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> | ||
|
||
<head> | ||
<title>ISCN on LikeCoin Chain</title> | ||
<link href="iscn.css" type="text/css" rel="stylesheet" /> | ||
</head> | ||
|
||
<body> | ||
<main> | ||
<table id="iscn-page-book-info"> | ||
<tr> | ||
<th>ISCN: </th> | ||
<td> | ||
<a id="iscn-prefix" /> | ||
<img id="iscn-qr-code" width="250" height="250" src="iscn-qr-code.png" /> | ||
</td> | ||
</tr> | ||
</table> | ||
</main> | ||
<footer id="depub-disclaimer" /> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import dayjs from 'dayjs'; | ||
import LocalizedFormat from 'dayjs/plugin/localizedFormat.js'; | ||
import 'dayjs/locale/en.js'; | ||
import 'dayjs/locale/zh-hk.js'; | ||
import 'dayjs/locale/zh-tw.js'; | ||
|
||
dayjs.extend(LocalizedFormat); | ||
|
||
const language = 'en'; // en, zh-hk, zh-tw | ||
dayjs.locale(language); | ||
|
||
const config = { | ||
'en': { | ||
TITLE_LABEL: 'Title', | ||
AUTHOR_LABEL: 'Author', | ||
RELEASE_DATE_LABEL: 'Release date', | ||
DATE_FORMAT: 'LL', // equals to 'MMMM D, YYYY' (August 16, 2018) | ||
DEPUB_DISCLAIMER: 'This book is published on decentralized networks', | ||
}, | ||
'zh-hk': { | ||
TITLE_LABEL: 'ζΈε', | ||
AUTHOR_LABEL: 'δ½θ ', | ||
RELEASE_DATE_LABEL: 'ηΌθ‘ζ₯ζ', | ||
DATE_FORMAT: 'LL', // YYYYεΉ΄MζDζ₯ | ||
DEPUB_DISCLAIMER: 'ζ€ζΈζ‘η¨εζ£εΌεΊη', | ||
}, | ||
'zh-tw': { | ||
TITLE_LABEL: 'ζΈε', | ||
AUTHOR_LABEL: 'δ½θ ', | ||
RELEASE_DATE_LABEL: 'ηΌθ‘ζ₯ζ', | ||
DATE_FORMAT: 'LL', // YYYYεΉ΄MζDζ₯ | ||
DEPUB_DISCLAIMER: 'ζ€ζΈζ‘η¨εζ£εΌεΊη', | ||
}, | ||
}; | ||
|
||
export const { | ||
TITLE_LABEL, | ||
AUTHOR_LABEL, | ||
RELEASE_DATE_LABEL, | ||
DATE_FORMAT, | ||
DEPUB_DISCLAIMER, | ||
} = config[language] || config.en; |
Oops, something went wrong.