Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Formats > ePub

Notices

Reply
 
Thread Tools Search this Thread
Old 10-20-2024, 02:13 PM   #1
Shohreh
Addict
Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.
 
Posts: 206
Karma: 304158
Join Date: Jan 2016
Location: France
Device: none
Question [SOLVED] [*nix] Convert man pages to EPUB?

Hello,

To read long man pages on an e-reader, what application would you recommend to convert those to an epub file?

I tried pandoc to convert an HTML page into EPUB. It's OK, but I was wondering if there's no better solution.

Thank you.

Last edited by Shohreh; 10-29-2024 at 05:16 PM.
Shohreh is offline   Reply With Quote
Old 10-20-2024, 05:14 PM   #2
Turtle91
A Hairy Wizard
Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.
 
Turtle91's Avatar
 
Posts: 3,346
Karma: 20171571
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 15/11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
I'm not sure exactly what your question is?? An ePub is made up of HTML files (plus any css stylesheets, image files, font files, etc.) so there shouldn't be any "conversion" required.

I would just use Sigil and "Add existing files" and select the files you want to include.

Sigil should take care of all the nitnoid details except making sure that you are using proper xhtml rules (closing all your tags, etc.).
Turtle91 is online now   Reply With Quote
Advert
Old 10-20-2024, 05:17 PM   #3
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 79,667
Karma: 145864619
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by Turtle91 View Post
I'm not sure exactly what your question is?? An ePub is made up of HTML files (plus any css stylesheets, image files, font files, etc.) so there shouldn't be any "conversion" required.

I would just use Sigil and "Add existing files" and select the files you want to include.

Sigil should take care of all the nitnoid details except making sure that you are using proper xhtml rules (closing all your tags, etc.).
epubcheck will make sure the code is valid.
JSWolf is offline   Reply With Quote
Old 10-20-2024, 05:31 PM   #4
Turtle91
A Hairy Wizard
Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.
 
Turtle91's Avatar
 
Posts: 3,346
Karma: 20171571
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 15/11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
Quote:
Originally Posted by JSWolf View Post
epubcheck will make sure the code is valid.
epubcheck tells you where the errors are, but I don't think it automatically fixes them, does it??
Turtle91 is online now   Reply With Quote
Old 10-20-2024, 06:09 PM   #5
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 45,928
Karma: 168959602
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
Not only that but quite a few web pages are so grunged up that Sigil will not import them. That's where I stuff the pages into calibre, convert to ePub and then edit the crap out of the ePub.
DNSB is offline   Reply With Quote
Advert
Old 10-20-2024, 06:36 PM   #6
ratinox
Guru
ratinox ought to be getting tired of karma fortunes by now.ratinox ought to be getting tired of karma fortunes by now.ratinox ought to be getting tired of karma fortunes by now.ratinox ought to be getting tired of karma fortunes by now.ratinox ought to be getting tired of karma fortunes by now.ratinox ought to be getting tired of karma fortunes by now.ratinox ought to be getting tired of karma fortunes by now.ratinox ought to be getting tired of karma fortunes by now.ratinox ought to be getting tired of karma fortunes by now.ratinox ought to be getting tired of karma fortunes by now.ratinox ought to be getting tired of karma fortunes by now.
 
Posts: 761
Karma: 10000000
Join Date: Oct 2016
Location: Somewhere in Time
Device: Forma, iPad Mini
Quote:
Originally Posted by Shohreh View Post
Hello,

To read long man pages on an e-reader, what application would you recommend to convert those to an epub file?
I wouldn't use an application per se. I also wouldn't use pandoc.

Unix man pages use a markup format called roff (runoff) inherited from Multics. I would use groff (or troff) to render the manpage source as HTML:

zcat /usr/share/man/man1/groff.1.gz | groff -mandoc -Thtml > groff.html

Then use ebook-convert to turn that HTML into an ePub. This should generate a nicely formatted ePub.
ratinox is offline   Reply With Quote
Old 10-20-2024, 11:42 PM   #7
PeterT
Grand Sorcerer
PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.
 
Posts: 13,471
Karma: 78880114
Join Date: Nov 2007
Location: Toronto
Device: Libra H2O, Libra Colour
I also found a perl script on GitHub (https://github.com/mle86/man-to-md) that converts to MarkDown format, which csan then be loaded into calibre.

Attach find a sample ePub
Attached Files
File Type: txt tar.txt (39.3 KB, 329 views)
File Type: epub tar - Unknown.epub (35.5 KB, 338 views)
PeterT is offline   Reply With Quote
Old 10-29-2024, 06:23 AM   #8
Shohreh
Addict
Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.
 
Posts: 206
Karma: 304158
Join Date: Jan 2016
Location: France
Device: none
Thanks for the infos.

What's the correct way to use that Perl script?

Code:
:~/man-to-md-master# ./man-to-md.pl < smb.conf > smb.conf.md
-bash: smb.conf: No such file or directory
Quote:
which csan then be loaded into calibre
Is csan an extension to Calibre?
Shohreh is offline   Reply With Quote
Old 10-29-2024, 07:54 AM   #9
PeterT
Grand Sorcerer
PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.
 
Posts: 13,471
Karma: 78880114
Join Date: Nov 2007
Location: Toronto
Device: Libra H2O, Libra Colour
csan was a typo... it's actually CAN.

I copied the man page from (on my system) /usr/share/man/man1/tar.1.gz to my working directory and gunzip'ed it to get tar.1

Then ran ./man-to-md.pl < tar.1 > tar.epub
PeterT is offline   Reply With Quote
Old 10-29-2024, 09:03 AM   #10
Shohreh
Addict
Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.
 
Posts: 206
Karma: 304158
Join Date: Jan 2016
Location: France
Device: none
I don't know how man manages documents.

Is there a list somewhere to know in which file a given man page is located?

Code:
:~# dpkg -L samba | grep man
/usr/share/man
/usr/share/man/man1
/usr/share/man/man1/log2pcap.1.gz
/usr/share/man/man1/mvxattr.1.gz
/usr/share/man/man1/oLschema2ldif.1.gz
/usr/share/man/man1/profiles.1.gz
/usr/share/man/man1/sharesec.1.gz
/usr/share/man/man1/smbcontrol.1.gz
/usr/share/man/man1/smbstatus.1.gz
/usr/share/man/man8
/usr/share/man/man8/eventlogadm.8.gz
/usr/share/man/man8/nmbd.8.gz
/usr/share/man/man8/pdbedit.8.gz
/usr/share/man/man8/samba-bgqd.8.gz
/usr/share/man/man8/samba-gpupdate.8.gz
/usr/share/man/man8/samba.8.gz
/usr/share/man/man8/samba_downgrade_db.8.gz
/usr/share/man/man8/smbd.8.gz
--
Edit: Almost there

Code:
"man smb.conf" says "SMB.CONF(5)"
ll /usr/share/man/man5
→ smb.conf.5.gz
 
cd ~/man-to-md-master
cp /usr/share/man/man5/smb.conf.5.gz .
gunzip smb.conf.5.gz
./man-to-md.pl < smb.conf.5 > smb.conf.epub
first line does not contain '.TH' macro at ./man-to-md.pl line 660, <> line 1.
--
Edit:

Code:
:~# apt-get install groff
(120MB worth of it)

:~# zcat /usr/share/man/man5/smb.conf.5.gz | groff -mandoc -Thtml > smb.conf.html
troff: stdin:5521: warning [p 64, 1.7i]: can't break line
troff: stdin:5639: warning [p 65, 1.5i]: can't break line
troff: stdin:5521: warning [p 1, 739.2i]: can't break line
troff: stdin:5639: warning [p 1, 750.5i]: can't break line

"c:\Program Files\Calibre2\ebook-convert.exe" smb.conf.html smb.conf.epub --authors "Samba" --title "smb.conf"
For some reason, Calibre increase the font size halfway through and it only increases till the end (see attachment).

--
Edit:

Code:
pandoc.exe --metadata author="Samba" --metadata title="smb.conf" -f html -t epub -o "smb.conf.epub" "smb.conf.html"
Perfect! Thanks all.
Attached Thumbnails
Click image for larger version

Name:	153B42B6-338E-4785-8C25-CFB31AB19522.png
Views:	285
Size:	75.6 KB
ID:	211732  

Last edited by Shohreh; 10-29-2024 at 09:30 AM.
Shohreh is offline   Reply With Quote
Old 10-29-2024, 12:41 PM   #11
j.p.s
Grand Sorcerer
j.p.s ought to be getting tired of karma fortunes by now.j.p.s ought to be getting tired of karma fortunes by now.j.p.s ought to be getting tired of karma fortunes by now.j.p.s ought to be getting tired of karma fortunes by now.j.p.s ought to be getting tired of karma fortunes by now.j.p.s ought to be getting tired of karma fortunes by now.j.p.s ought to be getting tired of karma fortunes by now.j.p.s ought to be getting tired of karma fortunes by now.j.p.s ought to be getting tired of karma fortunes by now.j.p.s ought to be getting tired of karma fortunes by now.j.p.s ought to be getting tired of karma fortunes by now.
 
Posts: 5,781
Karma: 103362673
Join Date: Apr 2011
Device: pb360
Quote:
Originally Posted by Shohreh View Post
Thanks for the infos.

What's the correct way to use that Perl script?

Code:
:~/man-to-md-master# ./man-to-md.pl < smb.conf > smb.conf.md
-bash: smb.conf: No such file or directory
The command is to read smb.conf and write to smb.conf.md

Presumably the former is the file to be converted and the latter is the conversion to markdown result. If "smb.conf" is not in the current working directory, the full or relative path must be supplied.
j.p.s is offline   Reply With Quote
Old 10-29-2024, 04:52 PM   #12
Shohreh
Addict
Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.
 
Posts: 206
Karma: 304158
Join Date: Jan 2016
Location: France
Device: none
Yes, but it doesn't explain the error in that Perl script:

Code:
:~/man-to-md-master# ./man-to-md.pl < smb.conf.5 > smb.conf.md
first line does not contain '.TH' macro at ./man-to-md.pl line 660, <> line 1.
--
Edit: Here's how to 1) grab a man page, 2) unzip it, 3) turn it into EPUB:

Code:
cp /usr/share/man/man5/smb.conf.5.gz .
gunzip smb.conf.5.gz
pandoc -f man -t epub -o smb.conf.epub  smb.conf.5
Thank you all.

Last edited by Shohreh; 10-29-2024 at 05:13 PM.
Shohreh is offline   Reply With Quote
Old 12-04-2024, 09:54 PM   #13
Kurler
Junior Member
Kurler began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Dec 2024
Device: none
I recommend using the program “mandoc” (https://mandoc.bsd.lv/) to convert a manpage from source to HTML. It was designed from the start specifically as a manpage-to-HTML converter, so it does a better job of realizing semantics from the manpage, resulting in better quality HTML than pandoc or groff. (Whereas if your target format is PDF, groff would be the best tool to use, even though mandoc has basic PDF support.) In fact mandoc is good enough that it’s installed on macOS out of the box. Once it’s been converted to HTML, you can convert that to EPUB with any of the tools that can handle that.
Kurler is offline   Reply With Quote
Old 12-04-2024, 11:13 PM   #14
PeterT
Grand Sorcerer
PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.
 
Posts: 13,471
Karma: 78880114
Join Date: Nov 2007
Location: Toronto
Device: Libra H2O, Libra Colour
Interesting. I tried and it seems to work quite well.

A simple
Code:
gunzip -c /usr/share/man/man1/tar.1.gz | mandoc -man -T html > /mnt/chromeos/MyFiles/Downloads/tar.html
followed by adding the resulting html file to calibre and converting to epub results in the attached file.
Attached Files
File Type: epub TAR(1) - Unknown.epub (60.1 KB, 308 views)
PeterT is offline   Reply With Quote
Old 12-05-2024, 09:37 AM   #15
ratinox
Guru
ratinox ought to be getting tired of karma fortunes by now.ratinox ought to be getting tired of karma fortunes by now.ratinox ought to be getting tired of karma fortunes by now.ratinox ought to be getting tired of karma fortunes by now.ratinox ought to be getting tired of karma fortunes by now.ratinox ought to be getting tired of karma fortunes by now.ratinox ought to be getting tired of karma fortunes by now.ratinox ought to be getting tired of karma fortunes by now.ratinox ought to be getting tired of karma fortunes by now.ratinox ought to be getting tired of karma fortunes by now.ratinox ought to be getting tired of karma fortunes by now.
 
Posts: 761
Karma: 10000000
Join Date: Oct 2016
Location: Somewhere in Time
Device: Forma, iPad Mini
Quote:
Originally Posted by Kurler View Post
I recommend using the program “mandoc” (https://mandoc.bsd.lv/) to convert a manpage from source to HTML.
groff uses mandoc underneath with the eponymous '-mandoc' switch. Previously:

Quote:
zcat /usr/share/man/man1/groff.1.gz | groff -mandoc -Thtml > groff.html
ratinox is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
convert .pages to epub peaceridge Conversion 13 08-20-2024 09:54 AM
Convert ePub to Landscape PDF with facing pages derekvan Conversion 6 08-04-2018 09:43 AM
Convert PDF to EPub or LRF puts pages out of order Timber Conversion 3 12-29-2011 06:57 AM
Script to convert all system installed Man Pages to HTML rogerx Conversion 1 08-26-2011 08:12 AM


All times are GMT -4. The time now is 12:25 PM.


MobileRead.com is a privately owned, operated and funded community.