Render website to ebook to make it easier to read on devices
Project description
colusa
Render website to ebook to make it easier to read on devices.
Installation
python3 setup.py install
Usage
Start from scratch
First of all, we need to generate a configuration file for colusa to work on.
colusa has builtin command to generate a template configuration as starter.
Run following command to generate configuration file:
$ colusa init new_ebook.json
colusa will generate a configuration file as below:
{
"title": "__fill the title__",
"author": "__fill the author__",
"version": "v1.0",
"homepage": "__fill url to home page__",
"output_dir": "__fill output dir__",
"urls": []
}
We have to modify the configuration file to fill up valid information.
Add content to ebook
After generating the configuration file, all we need to do is adding (blog posts, articles, webs)' urls to urls field in the configuration file.
Example for final configuration:
{
"title": "The Great Mental Models",
"author": "Farnam Street Media Inc",
"version": "v1.0",
"homepage": "https://fs.blog",
"output_dir": "fsblog",
"urls": [
"https://fs.blog/2018/04/first-principles/",
"https://fs.blog/2016/04/second-order-thinking/",
"https://fs.blog/2017/06/thought-experiment/",
"https://fs.blog/2018/05/probabilistic-thinking/",
"https://fs.blog/2019/12/survivorship-bias/"
]
}
Update ebook content
We can update ebook content by modifying the urls, by adding or removing url in the urls, the result ebook will be changed.
Generate ebook content
After adding or removing url in urls, we need to invoke colusa to have it regenerate ebook content. Run following command at terminal:
$ colusa generate new_ebook.json
By invoking above command, colusa will download webpages (specified in urls), parse, transform them to asciidoc format, and save them to output_dir. colusa also create a neccessary information for ebook compilating at later steps.
Compile ebook for consuming purpose
Prerequisites
Before generating ebook, we need to install asciidoctor tools. Follow install guideline on following websites:
- for generating html: https://asciidoctor.org
- for generating epub: https://asciidoctor.org/docs/asciidoctor-epub3/
- for generating pdf: https://asciidoctor.org/docs/asciidoctor-pdf/
Generating ebooks
To help with generating ebook, colusa also create a Makefile in the root folder of the ebook. In the Makefile, there are three common targets that we can use to generate ebook in html, epub, pdf formats.
# to generate html
$ make html
# to generate epub
$ make epub
# to generate pdf
$ make pdf
Generated ebooks will be saved to ./output folder.
user:output/ $ ls [10:55:55]
total 3056
drwxr-xr-x 10 320B images
-rw-r--r-- 1 699K index.epub
-rw-r--r-- 1 131K index.html
-rw-r--r--@ 1 694K index.pdf
List of Supported Website
Currently colusa supports only limited number of websites. The following list all support websites:
- https://untools.co
- https://unintendedconsequenc.es
- https://blog.acolyer.org
- https://fs.blog
- https://increment.com
- https://slack.engineering
- https://medium.com
- https://www.cs.rutgers.edu/~pxk/
- https://www.preethikasireddy.com
- https://engineering.atspotify.com
- https://truyenfull.vn
- https://avikdas.com
- https://www.infoq.com
Contribution
Contribution is welcome. You can open issues to request for supporting more websites, open PR to help with those issues, or anything else like documentation, code contribution.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file colusa-0.15.0.tar.gz.
File metadata
- Download URL: colusa-0.15.0.tar.gz
- Upload date:
- Size: 30.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
be302850696fc89032861388587cdbf934147bc0a1f11cff2f077e73b28348c2
|
|
| MD5 |
b8f2aa2240e71145afa47b2a2a70b68f
|
|
| BLAKE2b-256 |
843e592f4087917f4e8ee9dc8b533bd6de9b7f5136d129b006e5da529dedc82d
|
File details
Details for the file colusa-0.15.0-py3-none-any.whl.
File metadata
- Download URL: colusa-0.15.0-py3-none-any.whl
- Upload date:
- Size: 40.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7eef05ea1b4587af87d9305ac7356720741224b84adcef3f0e60f352624efbda
|
|
| MD5 |
fc20c83ca2876d201b3ea5bb41024b7e
|
|
| BLAKE2b-256 |
f6b4a4a4aa7ea1d1c97bfa6436650e32dd3cb305f5fdbf181f9ab22811df37e0
|