man2book is a tool to create a custom book of installed man pages or a selection of manpage sections and pages.
- Python 95%
- HTML 4.7%
- Makefile 0.3%
| output | ||
| .gitignore | ||
| LICENSE | ||
| Makefile | ||
| man2book | ||
| README.md | ||
| requirements.txt | ||
| workflow.txt | ||
man2book
A tool to convert all installed man pages to a simple ebook or other formats with contents in the head.
Maybe this could be only a small shell script but if not I will use Python.
Why man pages as ebook?
Because I want to read them comfortable on my ebook reader when traveling but all man pages in one book. Not more... ;)
Helpful libraries and tools
- https://pandoc.org/ - Haskell - Then maybe make use of https://pypi.org/project/pandocfilters/, https://pypi.org/project/pypandoc/ or https://pypi.org/project/pandoc/. (very mature features for document conversion like direct manpage input and epub output, but I don't know much about pandoc, so I need to discover this.)
- https://www.gnu.org/software/groff/ (man -Thtml df > df.html)
- https://linux.die.net/man/1/man2html (is nice because it must not generate html, head and body)
- https://pypi.org/project/epubmaker/ - Python (maybe nice but unmaintained)
- https://docutils.sourceforge.io/ - Python (as I can see now it only converts from .rst files.)
- https://github.com/hanez/aov-html2epub - Bash
Workflow
- Read manpage sections
- Create HTML file for each manpage in each section
- Read and store title(metadata) for in each file
- Remove all unneeded stuff like html, head and body in each file
- Create TOC for the entire ebook
- Create a header HTML file for the ebook containing the head tag
- Merge toc and content of all files for preparing the ebook
- Merge the header file with the prepared ebook while inserting html and body tags which should result in a valid HTML file
- Create ebook from the resulting HTML file using Pandoc