{"id":21616026,"url":"https://github.com/9beach/pubgen","last_synced_at":"2026-01-29T18:48:12.908Z","repository":{"id":2571799,"uuid":"3551885","full_name":"9beach/pubgen","owner":"9beach","description":"Pubgen is a command-line based epub generator. Make an epub with YAML.","archived":false,"fork":false,"pushed_at":"2013-11-04T11:48:21.000Z","size":156,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-01-22T03:38:20.141Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/9beach.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-02-26T12:37:35.000Z","updated_at":"2024-12-18T03:08:44.000Z","dependencies_parsed_at":"2022-08-20T14:30:06.999Z","dependency_job_id":null,"html_url":"https://github.com/9beach/pubgen","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/9beach%2Fpubgen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/9beach%2Fpubgen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/9beach%2Fpubgen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/9beach%2Fpubgen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/9beach","download_url":"https://codeload.github.com/9beach/pubgen/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240136986,"owners_count":19753644,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-24T22:13:24.625Z","updated_at":"2026-01-29T18:48:07.879Z","avatar_url":"https://github.com/9beach.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Pubgen\n\nPubgen is a command-line based epub generator. Make an epub with YAML.\n\n## Installation\n\n```bash\n$ # First, install Ruby and then\n$ gem install pubgen\n```\n\n## Usage\n\n```bash\n$ pubgen -h\npubgen 0.2.0, an epub generator. (http://github.com/9beach/pubgen)\n\nUsage:\n  pubgen \u003cyaml file\u003e [-o \u003cepub file\u003e] [-v]\n  pubgen \u003cyaml file\u003e -m\n  pubgen -t \u003ctoc file\u003e \u003cepub root path\u003e\n\n    -o, --output EPUB_FILE           Specify output epub file path\n    -m, --meta-file-only             Generate .opf, .ncx, mimetype, ...\n    -t, --toc TOC_FILE EPUB_ROOT     Print YAML using TOC file\n    -v, --verbose                    Verbose output\n```\n\n## Quick Start\n\n### Create an epub\n \nPrepare files (documents, images, style sheets, etc.) that make up the \npublication. Apple's iBooks requires strict xhtml. [`tidy -asxhtml`] \n(http://tidy.sourceforge.net/) will be helpful to you.\n\n```bash\n$ find .\n.\n./contents\n./contents/x.html\n./contents/y.html\n./images\n./images/1.jpg\n./images/2.jpg\n./images/3.jpg\n./images/cover.jpg\n./style.css\n```\nMake your files XHTML compatible.\n```\n$ cd contents\n$ tidy -asxhtml x.html \u003e a.html\n$ tidy -asxhtml y.html \u003e b.html\n```\nCreate the utf-8 encoded YAML file describing the publication. As an example, \n`will_oldham.yml`.\n\n```yaml\n# METADATA: Publication metadata (title, author, publisher, etc.).\n#\n# See http://idpf.org/epub/20/spec/OPF_2.0.1_draft.htm#Section2.2\nmetadata:\n  title: \"Will Oldham: Wikipedia, the free encyclopedia\"\n  creator: Wikipedia\n  date: 2012\n  language: en\n  subject: American alternative country singers\n  publisher:\n  contributor:\n  description:\n  source: \"http://en.wikipedia.org/wiki/Will_Oldham\"\n  rights:\n  relation:\n\n# GUIDE: A set of references to fundamental structural features of the \n# publication, such as table of contents, foreword, bibliography, etc.\n#\n# See http://idpf.org/epub/20/spec/OPF_2.0.1_draft.htm#Section2.6\n#\n# If you provide cover-image without cover-page, pubgen automatically \n# generates cover-page xhtml, and add it to manifest and spine.\nguide:\n  toc-page:\n  title-page: \n  cover-page:\n  cover-image: images/cover.jpg\n\n# MANIFEST: A list of files (documents, images, style sheets, etc.) that make \n# up the publication.\n#\n# See http://idpf.org/epub/20/spec/OPF_2.0.1_draft.htm#Section2.3\n#\n# All the file paths in manifest ought to be relative to yaml's path and in the\n# same or sub-directory of yaml file. Say yaml's path is /book/a.yaml.\n# - a/b/c.html                # good. in the sub-directory\n# - d.jpg                     # good. in the same directory\n# - ./e.jpg                   # good. in the same directory\n# - /a/b/c.html               # bad. in the different directory\n# - ../d.png                  # bad. in the parent directory\n# - /book/e.html              # bad. although in the same directory\n# - ../book/f.png             # bad. although in the same directory\nmanifest:\n  - contents/a.html\n  - contents/b.html\n  - images/cover.jpg\n  - images/1.jpg\n  - images/2.jpg\n  - images/3.jpg\n  - style.css\n\n# SPINE: An arrangement of documents providing a linear reading order.\n#\n# See http://idpf.org/epub/20/spec/OPF_2.0.1_draft.htm#Section2.4\nspine:\n  - contents/a.html\n  - contents/b.html\n\n# TOC: Table of contents\n#\n# See http://idpf.org/epub/20/spec/OPF_2.0.1_draft.htm#Section2.4.1\ntoc:\n# Add a colon suffix to indent\n  - 1 Music -- contents/a.html:\n    - 1.1 Discography -- contents/a.html#discography: \n      - 1.1.1 Studio albums -- contents/a.html#studio_albums\n    - 1.2 Response -- contents/a.html#response\n  - 2 Film -- contents/b.html:\n    - 2.1 Filmography -- contents/b.html#filmography\n  - 3 Photography -- contents/b.html#photography\n  - 4 References -- contents/b.html#references\n  - 5 External links -- contents/b.html#external_links\n```\n\nRun pubgen.\n\n```bash\n$ pubgen \u003cepub root\u003e/will_oldham.yml -o out.epub\nzip \u003e out.epub\n```\n\nDone!\n\n### Create meta files\n\nIf you understand [Open Packaging Format 2.0.1] \n(http://idpf.org/epub/20/spec/OPF_2.0.1_draft.htm) spec, and want to edit some \nproperties of the epub before packaging, you can try pubgen with \n`--meta-file-only` option.\n\n```bash\n$ cd \u003cepub root\u003e\n$ pubgen will_oldham.yml -m\ncat \u003e META-INF/container.xml\ncat \u003e mimetype\ncat \u003e cover-pubgen.xhtml\ncat \u003e content.opf\ncat \u003e toc.ncx\n# Edit content.opf/toc.ncx, and archive epub with zip command\n$ zip -r ../will_oldham.epub .\n```\n\n### Generate YAML using TOC file\n\nPubgen generates a YAML using TOC file. Pubgen-generated YAML is not complete, \nbut is probably quite useful.\n\n```bash\n$ pubgen -t \u003cepub root\u003e/contents/toc.html \u003cepub root\u003e \u003e out.yml\n$ vi out.yml # Open and complete YAML\n$ cp out.yml \u003cepub root\u003e\n$ pubgen \u003cepub root\u003e/out.yml -o out.epub\nzip \u003e out.epub\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F9beach%2Fpubgen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F9beach%2Fpubgen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F9beach%2Fpubgen/lists"}