# epubmaker ## Description A tool that assists in the creation of epub files from html marked source. ## Installation Requires Python 3.10 or later. ```bash git clone cd epubmaker pip install . ``` For development: ```bash pip install -e . pip install pytest ``` ## Usage ``` python -m epubmaker [-f] [-v] ``` | Argument | Description | |---|---| | `source_file` | Path to the HTML source file | | `-f`, `--force` | Overwrite an existing output directory | | `-v`, `--verbose` | Print progress as each step completes | **Examples:** ```bash # Basic usage python -m epubmaker mybook.html # Overwrite a previously generated output python -m epubmaker -f mybook.html # Verbose output python -m epubmaker -v mybook.html ``` The tool creates an output directory and a `.epub` file in the current working directory, both named after the value of the `Directory:` directive in the source file. ### Source file format The source file is an HTML file. Metadata and structure are declared using HTML comment directives. The file must be located in a directory that also contains an `Images/` subdirectory. **Required `Images/` contents:** - `cover.jpeg` — cover image - `Inconsolata-Regular.otf`, `invisible1.ttf`, `MgOpenModataRegular.ttf` — bundled fonts - Any additional images referenced in the file #### Metadata directives These appear before any section directives. All names in `Last, First` format. | Directive | Description | |---|---| | `` | Output directory name (required) | | `` | Book title (required) | | `` | Author; repeat for multiple authors | | `` | Editor | | `` | Cover artist | | `` | Publisher | | `` | Copyright statement | | `` | ISBN | | `` | UUID; leave blank to auto-generate | | `` | Source work | | `` | Comma-separated subjects | | `` | Series index and name | | `` | Cover image filename | #### Section directives Each section directive opens a new section. All HTML content that follows — until the next directive — becomes that section's body. The `id` field is used as the output filename (e.g., `ch1` → `ch1.xhtml`). ``` ``` | Directive | Section type | |---|---| | `` | Title page | | `` | Copyright page | | `` | Dedication | | `` | Table of contents | | `` | Foreword | | `` | Body chapter | | `` | Notes | | `` | Acknowledgements | | `` | License | #### Image directive Used within a section to embed an image. Supported formats: `jpg`, `jpeg`, `png`. ``` ``` The caption is optional. To omit it, leave it blank: ``` ``` #### Stylesheet Link a CSS file using a standard `` tag and the tool will extract and bundle it: ```html ``` #### Minimal example ```html

My Book

Jane Smith

Chapter One

Body text goes here.

``` ## Support Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc. ## Roadmap Modify this code to use pypub. ## Authors and acknowledgment Rory Hinnen ## License GPL 3.0