73 lines
1.7 KiB
Markdown
73 lines
1.7 KiB
Markdown
# g2e
|
|
|
|
an opinionated gempub to epub converter written in awk.
|
|
|
|
# usage
|
|
|
|
an example (uncompressed) gpub file is provided.
|
|
|
|
you can generate the corresponding epub file using:
|
|
|
|
```
|
|
make example
|
|
```
|
|
|
|
and then compress it as an epub with:
|
|
|
|
```
|
|
make epub
|
|
```
|
|
|
|
in order to convert another gpub, you can remix the following command, where `example-gpub/` would be the directory for your uncompressed gpub
|
|
|
|
```
|
|
awk -f g2e.awk example-gpub/
|
|
```
|
|
|
|
# notes
|
|
|
|
## file structure
|
|
|
|
the converter works with gempub archives that have a flat file structure: all the `.gmi` files, including `index.gmi`, have to be in the same directory.
|
|
|
|
furthermore, the image assets for the book have to be inside that directory, within a directory called `img/`.
|
|
|
|
for example, the structure for `example-gpub` is:
|
|
|
|
```
|
|
example-gpub/
|
|
metadata.txt
|
|
book/
|
|
index.gmi
|
|
toc.gmi
|
|
cover.gmi
|
|
chapter1.gmi
|
|
chapter2.gmi
|
|
chapter3.gmi
|
|
img/
|
|
screencap_uxn-pong.gif
|
|
screenshot_uxn-pong-paddle.png
|
|
screenshot_uxn-pong-paddles-and-ball.png
|
|
screenshot_uxn-pong-paddles.png
|
|
```
|
|
|
|
note that only `.gmi`, `.png`, `.jpg` and `.gif` files are handled.
|
|
|
|
## table of contents
|
|
|
|
there has to be a `toc.gmi` file that will be used as the `nav` element. this file has to have a single set of links pointed to internal `.gmi` files, not images.
|
|
|
|
## raw html
|
|
|
|
you can insert raw html using the corresponding `.gmo` syntax: the contents of a line that starts with `+` will be inserted as is.
|
|
|
|
# references
|
|
|
|
* [EPUB - Wikipedia](https://en.wikipedia.org/wiki/EPUB#Implementation)
|
|
* [EPUB 3.2](https://www.w3.org/publishing/epub3/)
|
|
* [Gempub](https://codeberg.org/oppenlab/gempub)
|
|
|
|
# license
|
|
|
|
> THIS IS CHAOTIC SOFTWARE BEWARE <//xj-ix.luxe/wiki/chaotic-software/>
|