{"id":13508583,"url":"https://github.com/milmazz/bupe","last_synced_at":"2025-04-07T12:10:53.272Z","repository":{"id":10162383,"uuid":"64178673","full_name":"milmazz/bupe","owner":"milmazz","description":"BUPE is a Elixir ePub generator and parser (supports EPUB v3)","archived":false,"fork":false,"pushed_at":"2024-09-27T16:49:10.000Z","size":248,"stargazers_count":84,"open_issues_count":1,"forks_count":8,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-01T17:24:34.226Z","etag":null,"topics":["elixir-epub-generator","elixir-lang","epub"],"latest_commit_sha":null,"homepage":null,"language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/milmazz.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-07-26T01:07:13.000Z","updated_at":"2025-03-24T20:35:05.000Z","dependencies_parsed_at":"2024-10-25T18:34:29.781Z","dependency_job_id":"0fe29251-bb05-488c-8d43-421d3243e111","html_url":"https://github.com/milmazz/bupe","commit_stats":{"total_commits":153,"total_committers":6,"mean_commits":25.5,"dds":0.196078431372549,"last_synced_commit":"5bf9742a2867be13532cc4ec0afa4e4c3d36480d"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/milmazz%2Fbupe","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/milmazz%2Fbupe/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/milmazz%2Fbupe/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/milmazz%2Fbupe/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/milmazz","download_url":"https://codeload.github.com/milmazz/bupe/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247648977,"owners_count":20972945,"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":["elixir-epub-generator","elixir-lang","epub"],"created_at":"2024-08-01T02:00:55.172Z","updated_at":"2025-04-07T12:10:53.252Z","avatar_url":"https://github.com/milmazz.png","language":"Elixir","funding_links":[],"categories":["Miscellaneous"],"sub_categories":[],"readme":"# BUPE\n\n[![Module Version](https://img.shields.io/hexpm/v/bupe.svg)](https://hex.pm/packages/bupe)\n[![Hex Docs](https://img.shields.io/badge/hex-docs-lightgreen.svg)](https://hexdocs.pm/bupe/)\n[![Total Download](https://img.shields.io/hexpm/dt/bupe.svg)](https://hex.pm/packages/bupe)\n[![License](https://img.shields.io/hexpm/l/bupe.svg)](https://github.com/milmazz/bupe/blob/master/LICENSE)\n[![Last Updated](https://img.shields.io/github/last-commit/milmazz/bupe.svg)](https://github.com/milmazz/bupe/commits/master)\n\nBUPE is an Elixir ePub generator and parser, it supports EPUB v2 and v3.\n\n## Installation\n\nFirst, add `:bupe` to your list of dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:bupe, \"~\u003e 0.6\"}\n  ]\nend\n```\n\nTo find out the latest release available on Hex, you can run `mix hex.info bupe` in your shell, or by going to the\n[`bupe` page on Hex.pm](https://hex.pm/packages/bupe)\n\nThen, update your dependencies:\n\n```sh-session\n$ mix deps.get\n```\n\n## Usage\n\n### Builder\n\nIf you want to create an EPUB file you can do the following:\n\n```elixir\niex(1)\u003e pages = \"~/book/*.xhtml\" |\u003e Path.expand() |\u003e Path.wildcard()\n[\"/Users/dev/book/bacon.xhtml\", \"/Users/dev/book/egg.xhtml\", \"/Users/dev/book/ham.xhtml\"]\niex(2)\u003e config = %BUPE.Config{\n...(2)\u003e  title: \"Sample\",\n...(2)\u003e  language: \"en\",\n...(2)\u003e  creator: \"John Doe\",\n...(2)\u003e  publisher: \"Sample\",\n...(2)\u003e  pages: pages\n...(2)\u003e }\n%BUPE.Config{\n  audio: [],\n  contributor: nil,\n  cover: true,\n  coverage: nil,\n  creator: \"John Doe\",\n  date: nil,\n  description: nil,\n  fonts: [],\n  format: nil,\n  identifier: nil,\n  images: [],\n  language: \"en\",\n  logo: nil,\n  modified: nil,\n  nav: [],\n  pages: [\"/Users/dev/book/bacon.xhtml\",\n   \"/Users/dev/book/egg.xhtml\",\n   \"/Users/dev/book/ham.xhtml\"],\n  publisher: \"Sample\",\n  relation: nil,\n  rights: nil,\n  scripts: [],\n  source: nil,\n  styles: [],\n  subject: nil,\n  title: \"Sample\",\n  type: nil,\n  unique_identifier: nil,\n  version: \"3.0\"\n}\niex(3)\u003e BUPE.build(config, \"sample.epub\")\n{:ok, '/Users/dev/sample.epub'}\n```\n\nIf you prefer, you can build the EPUB document in memory doing the following:\n\n```elixir\niex(4)\u003e BUPE.build(config, \"sample.epub\", [:memory])\n{:ok,\n {'/Users/dev/sample.epub',\n  \u003c\u003c80, 75, 3, 4, 20, 0, 0, 0, 0, 0, 61, 123, 119, 78, 111, 97, 171, 44, 20, 0,\n    0, 0, 20, 0, 0, 0, 8, 0, 0, 0, 109, 105, 109, 101, 116, 121, 112, 101, 97,\n    112, 112, 108, 105, 99, 97, 116, ...\u003e\u003e}}\n```\n\nIf you want to have more control over the `pages` configuration, instead of\npassing a list of string, you can provide a list of `%BUPE.Item{}` like this:\n\n```elixir\niex(1)\u003e pages = [%BUPE.Item{href: \"/Users/dev/book/bacon.xhtml\", description: \"Ode to Bacon\"}]\n[\n  %BUPE.Item{\n    description: \"Ode to Bacon\",\n    duration: nil,\n    fallback: nil,\n    href: \"/Users/dev/book/bacon.xhtml\",\n    id: nil,\n    media_overlay: nil,\n    media_type: nil,\n    properties: \"\"\n  }\n]\n```\n\nThe given `description` will be used in the _Table of Contents_ of EPUB\ndocument, otherwise `BUPE` will provide a default description based on the file\nname.\n\nIf your page include JavaScript, is recommended that you use the `properties`\nfield from `%BUPE.Item{}` like this:\n\n```elixir\niex(2)\u003e pages = [%BUPE.Item{href: \"/Users/dev/book/bacon.xhtml\", description: \"Ode to Bacon\", properties: \"scripted\"}]\n[\n  %BUPE.Item{\n    description: \"Ode to Bacon\",\n    duration: nil,\n    fallback: nil,\n    href: \"/Users/dev/book/bacon.xhtml\",\n    id: nil,\n    media_overlay: nil,\n    media_type: nil,\n    properties: \"scripted\"\n  }\n]\n```\n\nKeep in mind that if you put the `scripted` property on a page that does not\nhave any JavaScript, you will get warnings from validation tools such as\n[EPUBCheck][epubcheck].\n\nSee `BUPE.Builder`, `BUPE.Config`, and `BUPE.Item` for more details.\n\n### Using the builder via command line\n\nYou can build EPUB documents using the command line as follows:\n\n1. Install `BUPE` as an escript:\n\n```console\nmix escript.install hex bupe\n```\n\n2. Then you are ready to use it in your projects:\n\n```console\nbupe \"EPUB_TITLE\" -p egg.xhtml -p bacon.xhtml -l path/to/logo.png\n```\n\nFor more details about using the command line tool, review the usage guide:\n\n```console\nbupe --help\n```\n\n### Parser\n\nIf you want to parse an EPUB file you can do the following:\n\n```elixir\niex\u003e BUPE.parse(\"sample.epub\")\n%BUPE.Config{\n  audio: nil,\n  contributor: nil,\n  cover: true,\n  coverage: nil,\n  creator: \"John Doe\",\n  date: nil,\n  description: nil,\n  fonts: nil,\n  format: nil,\n  identifier: \"urn:uuid:bc864bda-1a0b-4014-a72f-30f6dc60e120\",\n  images: nil,\n  language: \"en\",\n  logo: nil,\n  modified: \"2019-03-23T20:22:20Z\",\n  nav: [\n    %{idref: 'cover', linear: 'no'},\n    %{idref: 'nav'},\n    %{idref: 'pages-ecbedca7-f77e-46b6-8fe2-99718d00c903'},\n    %{idref: 'pages-59ad8356-e46d-4328-b7cc-e81af2880c3a'},\n    %{idref: 'pages-1d3ee5e3-cf45-4e45-bd79-8a931e293584'}\n  ],\n  pages: [\n    %{\n      href: 'nav.xhtml',\n      id: 'nav',\n      \"media-type\": 'application/xhtml+xml',\n      properties: 'nav'\n    },\n    %{href: 'title.xhtml', id: 'cover', \"media-type\": 'application/xhtml+xml'},\n    %{\n      href: 'content/bacon.xhtml',\n      id: 'pages-ecbedca7-f77e-46b6-8fe2-99718d00c903',\n      \"media-type\": 'application/xhtml+xml',\n      properties: 'scripted'\n    },\n    %{\n      href: 'content/egg.xhtml',\n      id: 'pages-59ad8356-e46d-4328-b7cc-e81af2880c3a',\n      \"media-type\": 'application/xhtml+xml',\n      properties: 'scripted'\n    },\n    %{\n      href: 'content/ham.xhtml',\n      id: 'pages-1d3ee5e3-cf45-4e45-bd79-8a931e293584',\n      \"media-type\": 'application/xhtml+xml',\n      properties: 'scripted'\n    }\n  ],\n  publisher: \"Sample\",\n  relation: nil,\n  rights: nil,\n  scripts: nil,\n  source: nil,\n  styles: [%{href: 'css/stylesheet.css', id: 'css', \"media-type\": 'text/css'}],\n  subject: nil,\n  title: \"Sample\",\n  type: nil,\n  unique_identifier: \"BUPE\",\n  version: \"3.0\"\n}\n```\n\nSee `BUPE.Parser` for more details.\n\n## Copyright and License\n\nCopyright 2024 Milton Mazzarri\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at [https://www.apache.org/licenses/LICENSE-2.0](https://www.apache.org/licenses/LICENSE-2.0)\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n\n[epubcheck]: https://github.com/w3c/epubcheck\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmilmazz%2Fbupe","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmilmazz%2Fbupe","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmilmazz%2Fbupe/lists"}