An epub generation utility
Aerdan b8f63e26d4 README: More useful usage block. 10 months ago
contrib Unown is an AGPL-3.0 project. 10 months ago
unown Genericization in preparation for a single-file mode. 10 months ago
.gitignore gitignore: ignore temporary object files 11 months ago
LICENSE.txt Unown is an AGPL-3.0 project. 10 months ago
README.md README: More useful usage block. 10 months ago
setup.py setup.py: typo in keywords 10 months ago
unown.py Genericization in preparation for a single-file mode. 10 months ago

README.md

Unown

Unown is a script for generating an EPUB 3.0 Container from a set of files. It includes support for whitelists and blacklists.

Usage

unown.py config.toml

The script outputs EPUBs based on the title specified in the config file. For whitelist and blacklist generation, it incorporates the name of the list. For example, a whitelist named 'story' for a book with the title "An Example" would generate An Example story.epub.

Configuration

The following is a minimalistic configuration for Unown, with comments.

title="An Example"
#subtitle="..."
language="en-US"
# Not actually used, but should be the copyright year.
copyright=2018
creator="John Doe"
contributors=[ "Jane Doe" ]
# Where we should look for your files.
directory="example"
# This setting will cause Unown to generate a 'complete' package even
# if whitelists or blacklists are specified.
generate_all=true
# The uuid is generated by Unown and should be left intact if present,
# unless you're copying an old configuration, in which case it should
# be removed. 
#uuid = "..."

# Whitelists are presumed to consist only of viewable documents under
# the OEBPS subdirectory of the directory configured above. Other
# files (CSS, etc.) should be in the configured directory.
#
# Whitelist UUIDs are used in lieu of the primary UUID for whitelist-
# based EPUB generation.
#[whitelist]
#story=[ 'foo.html', 'bar.html' ]
#story_uuid = "..."

# Blacklists exclude only files in the OEBPS subdirectory of the
# directory configured above. Other files in the configured directory
# are included regardless.
#[blacklist]
#choice=[ 'baz.html' ]
#choice_uuid = "..."

Templates

Unown includes a set of Jinja2 templates in the templates/ directory. The following is a list of templates for Unown.

  • container.xml -- Not actually a template, but it's part of the EPUB 3.0 Container specification, and it points to the .opf file.
  • nav.html -- Used to generate the table of contents for navigation.
  • package.xml -- Used to generate the EPUB 3.0 Package Document for the ebook. This file is specified in container.xml.

Contributions

There are two scripts included with Unown which may be of interest. extract_4chan.py extracts all posts from a 4chan thread into the specified target directory. The second takes a directory of such posts and merges them in to a single file. It uses the id of the first post in the thread to name the resulting file.

These scripts include their own Jinja2 templates, which are documented below:

  • post.html -- Used by extract_4chan.py to render individual posts.
  • thread.html -- Used by merge_4chan.py to render the whole thread.
  • thread_post.html -- Used by merge_4chan.py to render posts in the thread.

Additional scripts may be incorporated for other purposes.