Diferencias
Muestra las diferencias entre dos versiones de la página.
— |
es:howtos:software:man2html [2019/02/28 01:48 (UTC)] (actual) slackwarespanol creado |
||
---|---|---|---|
Línea 1: | Línea 1: | ||
+ | ====== man2html ====== | ||
+ | ===== Introduction ===== | ||
+ | |||
+ | //man2html// can generate //on the fly// HTML pages from //man// documentation. This makes it a useful addition to [[howtos:software:asciidoc_mini_howto|asciidoc]] based notes. | ||
+ | ((The HTML from //man2html// is formatted differently from that of //asciidoc//, and a possible, but heavy-handed, solution might be the use of [[http://slackbuilds.org/office/pandoc/|pandoc]], available from Slackbuilds.org.)) | ||
+ | One of the advantages it offers is that when //man// pages are converted to HTML they become navigable through hyperlinks. A similar script exists for //info//, [[http://www.w3.org/Tools/info2www.html|info2www]]. | ||
+ | |||
+ | //man2html// can be used from the command line, for example, to read in //lynx// the html-formatted //man// page of //grep//: | ||
+ | |||
+ | $ zcat $(man --path 1 grep) | man2html -l | lynx -stdin | ||
+ | |||
+ | It is more useful, however, to setup a //cgi-bin// infrastructure which will allow the //on the fly// operation, see man2html(1). | ||
+ | |||
+ | ===== http ===== | ||
+ | |||
+ | This is the most versatile mode, as it works from any browser. | ||
+ | |||
+ | **''# mkdir /var/www/cgi-bin/man''** | ||
+ | |||
+ | **''# $EDITOR /etc/lynx.cfg''** | ||
+ | <file> | ||
+ | # NB: <TAB> must be a real tab. | ||
+ | TRUSTED_LYNXCGI:<TAB>/var/www/cgi-bin/man/ | ||
+ | </file> | ||
+ | |||
+ | **''# $EDITOR /var/www/cgi-bin/man/man2html''** | ||
+ | <code bash> | ||
+ | #!/bin/bash | ||
+ | # $1 is the man section | ||
+ | # $2 is the command name | ||
+ | zcat "$(man --path $1 $2)" | /usr/bin/man2html | ||
+ | </code> | ||
+ | |||
+ | **''# chmod 0755 /var/www/cgi-bin/man/man2html''** | ||
+ | |||
+ | **''# /etc/rc.d/rc.httpd start''** | ||
+ | |||
+ | See [[[[howtos:software:asciidoc_mini_howto#man|asciidoc Mini HOWTO]] for how to use in an //asciidoc// file. | ||
+ | |||
+ | <note warning>The steps are intended for //localhost//, or at most a LAN. //cgi-bin// may need some hardening for a public web server.</note> | ||
+ | |||
+ | ===== lynxcgi ===== | ||
+ | |||
+ | This works only from //lynx//. Make sure //lynx// is compiled with enabled ''cgi-bin'', the default for Slackware. | ||
+ | |||
+ | **''$ mkdir -p /home/httpd/cgi-bin/man''** | ||
+ | |||
+ | **''$ $EDITOR /etc/lynx.cfg''** | ||
+ | |||
+ | <file> | ||
+ | # NB: <TAB> must be a real tab. | ||
+ | TRUSTED_LYNXCGI:<TAB>/home/httpd/cgi-bin/man/ | ||
+ | </file> | ||
+ | |||
+ | **''$ $EDITOR /home/httpd/cgi-bin/man/man2html''** | ||
+ | <code bash> | ||
+ | #!/bin/bash | ||
+ | # $1 is the man section | ||
+ | # $2 is the command name | ||
+ | zcat "$(man --path $1 $2)" | /usr/bin/man2html -l | ||
+ | </code> | ||
+ | |||
+ | **''$ chmod 0755 /home/httpd/cgi-bin/man/man2html''** | ||
+ | |||
+ | A link in an //asciidoc// file for //grep// will be: | ||
+ | <file> | ||
+ | lynxcgi:/home/httpd/cgi-bin/man/man2html?1+grep[grep(1)] | ||
+ | </file> | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | ====== Sources ====== | ||
+ | <!-- If you are copying information from another source, then specify that source --> | ||
+ | <!-- * Original source: [[http://some.website.org/some/page.html]] --> | ||
+ | <!-- Authors are allowed to give credit to themselves! --> | ||
+ | * Originally written by [[wiki:user:pdi | pdi]] | ||
+ | * Contributions by [[wiki:user:markand | markand]] | ||
+ | |||
+ | <!-- Please do not modify anything below, except adding new tags.--> | ||
+ | <!-- You must remove the tag-word "template" below before saving your new page --> | ||
+ | {{tag>howtos man2html}} |