![]() |
#1 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 206
Karma: 304158
Join Date: Jan 2016
Location: France
Device: none
|
![]()
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. |
![]() |
![]() |
![]() |
#2 |
A Hairy Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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.). |
![]() |
![]() |
Advert | |
|
![]() |
#3 | |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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:
|
|
![]() |
![]() |
![]() |
#4 |
A Hairy Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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
|
|
![]() |
![]() |
![]() |
#5 |
Bibliophagist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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.
|
![]() |
![]() |
Advert | |
|
![]() |
#6 | |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 761
Karma: 10000000
Join Date: Oct 2016
Location: Somewhere in Time
Device: Forma, iPad Mini
|
Quote:
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. |
|
![]() |
![]() |
![]() |
#7 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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 |
![]() |
![]() |
![]() |
#8 | |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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:
|
|
![]() |
![]() |
![]() |
#9 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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 |
![]() |
![]() |
![]() |
#10 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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" -- Edit: Code:
pandoc.exe --metadata author="Samba" --metadata title="smb.conf" -f html -t epub -o "smb.conf.epub" "smb.conf.html" Last edited by Shohreh; 10-29-2024 at 09:30 AM. |
![]() |
![]() |
![]() |
#11 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 5,781
Karma: 103362673
Join Date: Apr 2011
Device: pb360
|
Quote:
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. |
|
![]() |
![]() |
![]() |
#12 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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 Last edited by Shohreh; 10-29-2024 at 05:13 PM. |
![]() |
![]() |
![]() |
#13 |
Junior Member
![]() 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.
|
![]() |
![]() |
![]() |
#14 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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 |
![]() |
![]() |
![]() |
#15 | ||
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 761
Karma: 10000000
Join Date: Oct 2016
Location: Somewhere in Time
Device: Forma, iPad Mini
|
Quote:
Quote:
|
||
![]() |
![]() |
![]() |
|
![]() |
||||
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 |