zealdocs / zeal

Offline documentation browser inspired by Dash
https://zealdocs.org
GNU General Public License v3.0
11.36k stars 778 forks source link

Man pages docset? #115

Open thorstenkampe opened 10 years ago

thorstenkampe commented 10 years ago

Can Zeal use local man pages (from Cygwin) as a docset source (as described in http://blog.kapeli.com/linux-man-pages-in-dash/)?

jkozera commented 10 years ago

Unfortunately generating docsets from man pages is not implemented in Zeal.

If you have access to an OS X computer, perhaps you could generate the man pages docset in Dash and copy it over to your Zeal's docsets directory.

Kapeli commented 10 years ago

If you have access to an OS X computer, perhaps you could generate the man pages docset in Dash and copy it over to your Zeal's docsets directory.

That won't work. Dash works as a regular man page browser behind the scenes, it doesn't generate anything, it just shows man pages.

The current Man Pages docset is just an empty placeholder docset that lets Dash know it should search man pages as well, nothing else.

jkozera commented 10 years ago

That won't work. Dash works as a regular man page browser behind the scenes, it doesn't generate anything, it just shows man pages.

Ah, thanks for clarifying. I should've checked it better before posting. :)

Anyway, it would be cool to have man pages support implemented, so I'm keeping this issue open.

louy2 commented 9 years ago

Can I use that work around on Windows? Like copy the manpages from my Linux VM and put them into a directory that Zeal can search inside?

warmwaffles commented 8 years ago

This would be a nice feature to have

abhisekp commented 8 years ago

:+1: Since I can use many of the linux commandline tools w/o cygwin, by install util-linux-ng, so it would be a nice feature to have man page docs.

benklop commented 8 years ago

KDE's manpage kioslave might be a decent place to start with this: https://quickgit.kde.org/?p=kio-extras.git&a=tree&h=e57f85c7dd358d4141bf203c52640229aee15edc&hb=3d8409f93830cb9bf658bd0648b7b1db3dd5c684&f=man

Yanpas commented 8 years ago

There are a lot if sites like this http://linux.die.net/man/ which have all man pages online. It will be easier to use them.

ssokolow commented 8 years ago

@Yanpas Point. It probably would be easier to point HTTrack at one of those and then slap a docset definition on the result for when I don't have network connectivity.

vtronko commented 8 years ago

Actually, I've been waiting for this :smiling_imp:

Yanpas commented 8 years ago

@ssokolow I've acrually meant exporting man pages online to docset format :smile:

ssokolow commented 8 years ago

@Yanpas I have no problem doing that myself... I just consider it unacceptably hacky and restrictive for the official "mark as solved" solution.

louy2 commented 8 years ago

@Kapeli How is searching manpages implemented in Dash? Does it hardcode manpage location on OS X? Or does it delegate man page search to apropos and parse the result?

Kapeli commented 8 years ago

@louy2 both, and a few more.

I have hardcoded paths. I also check: /private/etc/man.conf, /etc/manpaths, /etc/manpaths.d, /bin/bash -l -c "/usr/bin/man -W", /bin/bash -l -c "/usr/bin/man -k ."

Yanpas commented 8 years ago

OS X docset also contains man pages. It would be fine to have them separately, cause OS X is very huge docset.

louy2 commented 8 years ago

@Yanpas Are you sure? @Kapeli said that on OS X manpage is not stored in docset but rendered on the fly.

Yanpas commented 8 years ago

Absolutely. OS x is posix compatible os, so there exist all posix C calls like unlink, read, write, fcntl. The problem that search results show a lot of unnecessary functions with same names from foundation framework, Swift and so on E. g.: https://developer.apple.com/legacy/library/documentation/Darwin/Reference/ManPages/man1/ls.1.html https://developer.apple.com/legacy/library/documentation/Darwin/Reference/ManPages/man2/unlink.2.html

Kapeli commented 8 years ago

The OS X docset contains some man pages, yes. This docset is deprecated as Apple switched to a different documentation format in Xcode 8. The new Apple docs can be found here: https://developer.apple.com/reference. It's unlikely they'll update the OS X docset in the future.

tarqd commented 7 years ago

Is there any way to have Dash specifically look in a Dash-specific folder for man pages without setting it globally? Does Dash take into account the MANPATH environment variable if it's set in a plist or something?

Kapeli commented 7 years ago

Dash takes into account the MANPATH if it was set for /bin/bash. The easiest way to add man paths to Dash is probably in /etc/manpaths.

Please contact me with support requests regarding Dash in the future. This issue tracker is for Zeal.

Yanpas commented 7 years ago

High everybody! I've created script to generate docsets from man, details here https://github.com/Yanpas/mandocset It uses man2html utility, avaiable on Ubuntu and Debian e.g. In etc folder there are two docsets (posix and linux) which are "compiled", you may use them

I wasn't able to find author of this utility. Beware of a bug: this util may go to endless loop with printf.1p file from posix

trollixx commented 7 years ago

@Yanpas nice work. You could also add XML feeds to simplify installation of prebuilt docsets.

Yanpas commented 7 years ago

may be closed via https://github.com/Kapeli/Dash-User-Contributions/pull/1278

amosbird commented 7 years ago

@Yanpas Hi, how can I install your docset into zeal?

Yanpas commented 7 years ago

@amosbird High!

  1. Download Linux.docset.zip from here https://github.com/Yanpas/mandocset/tree/master/etc
  2. Etract it to Linux.docset folder
  3. Move this folder to Zeal docsets (C:\Users\%username%\AppData\Local\Zeal\Zeal\docsets or ~/.local/share/Zeal/Zeal/docsets/
amosbird commented 7 years ago

Thanks!

laoshaw commented 5 years ago

I think it is still much more valuable to search manpages on linux on-the-fly, as manpages are installed incrementally over time, the script above only generates static linux and posix manpages which is sub-optimal.

I tried to use the script against /usr/share/man on linux and while zeal recognizes it, click on search result does not produce any output on the right-side pane in zeal, so it's broken.

is it possible to add dynamic-man-page on the fly to zeal?

ssokolow commented 5 years ago

Given that Zeal is built using Qt, I'd think the simplest solution would be:

  1. Add an option to use KIOSlaves for disk access.
  2. Generate an index which uses man: URLs.

(If you've got Konqueror installed, try typing man:ls in the address bar... assuming your distro doesn't split the man KIOSlave out into some not-installed-by-default extras package.)

There's also the info KIOSlave, which even generates redirects so you can ask for info:ls and wind up at info:coreutils/ls invocation.

laoshaw commented 5 years ago

that won't work in gnome though, I don't know how Dash does it, the manpages are all gzipped with many symlinks, the best is to locate them based on search terms in zeal, then gunzip and convert them to html on the fly for zeal to display. unfortunately I'm unfamiliar with Qt.

this issue with above static script(mandocset) is that it can not deal with gzipped format files with symlinks used, which are common under /usr/share/man/

ssokolow commented 5 years ago

that won't work in gnome though

KDE Frameworks 5 has been focused on being modular, so don't count KIOSlaves out immediately.

KIOSlaves are the closest Qt equivalent to GIO/GnomeVFS (with GIO now being part of GTK+ itself), and one could already argue that Zeal being based on Qt "won't work in gnome" on the same grounds.

Yanpas commented 5 years ago

Sounds complicated. Easier would be pipe gzip to pandoc/man2html to pipe in zeal.

ssokolow commented 5 years ago

That is an option. The info KIOSlave's page footer makes it clear that it's based on a customized version of info2html.

trollixx commented 5 years ago

Support for docset format plugins is one of the goals of the upcoming refactoring (or rather reimplementation) of the core logic as a separate backend service. Once we have that, plugin(s) should crawl through the locally available man/info/whatever pages, and populate Zeal's search index.

laoshaw commented 3 years ago

any progress on this, would be nice to access local manpages via zeal.

Quarkay commented 2 years ago

Maybe this will be helpful:

Use Linux man pages to make docset

This article was written in Chinese but google translater is really good [Doge]

ernstki commented 1 year ago

I'm happy to report that the instructions at @yanpas' repository still work fine for an Ubuntu 20.04-based system (elementary OS 6.1), using -p /usr/share/man for the system man pages.

You will need to have a python3 interpreter available in your search path and install man2html, both of which are probably in your distro's standard repositories.

If you'd prefer that the search prefix be man: (or something else), simply supply -o Man_pages instead of -o Linux_man_pages as in the example, since the first word when split on underscores is used as the search prefix for the generated docset. It appears you can also modify the DocSetPlatformFamily key in ~/.local/share/Zeal/Zeal/docsets/<WHATEVER_YOU_NAMED_THE>.docset/Contents/Info.plist after the fact.

Screenshot of Info.plist for Linux man pages docset, with the 'DocSetPlatformFamily' key highlighted

Just quit and re-open Zeal for the changes to take effect.

A minor downside of generating the docset from your own system's man pages is that you will have to periodically repeat the procedure to include those of newly-installed programs. I suggest creating a Makefile for yourself to cover that contingency:

# ~/place/where/you/cloned/Yanpas/mandocset/Makefile
MANPAGES = /usr/share/man
DOCSETSDIR = $(HOME)/.local/share/Zeal/Zeal/docsets
DOCSETNAME = Man_pages
# if not supplied, defaults to first word of DOCSETNAME, split on underscores
#SHORTCUT = man
ICON = etc/tux.png
ICON2X = $(ICON:.png=@2x.png)
MAYBEDO = $(if $(DRYRUN),echo)

docset: $(DOCSETNAME).docset/Contents/Info.plist

install: $(DOCSETSDIR)/$(DOCSETNAME).docset/Contents/Info.plist

clean:
    $(MAYBEDO) rm -rf $(DOCSETNAME).docset

reallyclean: clean
    $(MAYBEDO) rm -rf $(DOCSETSDIR)/$(DOCSETNAME).docset

$(DOCSETNAME).docset/Contents/Info.plist:
    $(MAYBEDO) python3 mandocset.py -o $(DOCSETNAME) -i $(ICON) -I $(ICON2X) -p $(MANPAGES)
ifneq ($(SHORTCUT),)
    $(MAYBEDO) sed -i "/DocSetPlatformFamily/{N;s^<string>.*</string>^<string>$(SHORTCUT)</string>^;}" $@
endif

# use 'cp -r' here if you don't have 'rsync' installed
$(DOCSETSDIR)/$(DOCSETNAME).docset/Contents/Info.plist: $(DOCSETNAME).docset/Contents/Info.plist
    $(MAYBEDO) rsync -av --delete $(DOCSETNAME).docset $(DOCSETSDIR)