about summary refs log tree commit diff stats
path: root/doc
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-01-26 00:37:13 +0100
committerbptato <nincsnevem662@gmail.com>2024-01-26 00:43:18 +0100
commitfe9ac5f7824f935d22a1935b1f6f3c51823d3d02 (patch)
tree217fe9bd3715801d2a698269006a3c6819cbb575 /doc
parentb4aab9abc237b97a64def0f4ddf2dd7793f30916 (diff)
downloadchawan-fe9ac5f7824f935d22a1935b1f6f3c51823d3d02.tar.gz
Add mancha man page viewer
derived from w3mman2html.cgi, there are only a few minor differences:

* different man page opener command
* use man:, man-k:, man-l: instead of query string to specify action
* no form input (C-lC-uman:pageC-m is faster anyway)

TODO rewrite in Nim so we don't have to depend on Perl...
Diffstat (limited to 'doc')
-rw-r--r--doc/cha.16
-rw-r--r--doc/mancha.151
-rw-r--r--doc/protocols.md10
3 files changed, 62 insertions, 5 deletions
diff --git a/doc/cha.1 b/doc/cha.1
index a657d963..3bb9fc60 100644
--- a/doc/cha.1
+++ b/doc/cha.1
@@ -101,7 +101,7 @@ Start in visual mode: the page specified in \fIstart.visual-home\fR is opened.
 Interpret all following arguments as files. (e.g. if you have a file named
 \fI\-o\fR, open it as \fIcha \fB--\fR \fI-o\fR.
 
-.SH ENVIRONMENT VARIABLES
+.SH ENVIRONMENT
 Certain environment variables are read and used by Chawan.
 
 .TP
@@ -127,6 +127,6 @@ configuration option is not set.
 Configuration options are described in \fBcha-config\fR(5).
 
 .SH SEE ALSO
-\fBcha-mailcap\fR(5), \fBcha-mime.types\fR(5), \fBcha-config\fR(5),
+\fBmancha\fR(1), \fBcha-mailcap\fR(5), \fBcha-mime.types\fR(5), \fBcha-config\fR(5),
 .br
-\fBcha-localcgi\fR(5) \fBcha-urimethodmap\fR(5) \fBcha-protocols\fR(5)
+\fBcha-localcgi\fR(5), \fBcha-urimethodmap\fR(5), \fBcha-protocols\fR(5)
diff --git a/doc/mancha.1 b/doc/mancha.1
new file mode 100644
index 00000000..5a5dae4f
--- /dev/null
+++ b/doc/mancha.1
@@ -0,0 +1,51 @@
+.TH MANCHA 1
+
+.SH NAME
+mancha - view manual pages via cha(1)
+
+.SH SYNOPSIS
+.B mancha
+[\fB\-M \fIpath\fR] [\fIsection\fR] \fIname\fR
+.br
+.B mancha
+[\fB\-M \fIpath\fR] [\fIsection\fR] \-k \fIkeyword\fR
+.br
+.B mancha
+-l \fIfile\fR
+
+.SH DESCRIPTION
+\fBmancha\fR enables viewing man pages using the Chawan browser. It is analogous
+to the \fBw3mman\fR(1) utility.
+
+\fBmancha\fR will call \fBcha\fR(1) with the appropriate \fIman:\fR,
+\fIman-k:\fR or \fIman-l:\fR URLs. The protocol adapter then opens the man page
+and injects markup into it, e.g. man page references are converted into
+\fIman:\fR links.
+
+.SH OPTIONS
+Command line options are:
+
+.TP
+\fB\-M \fIpath\fR
+Set \fIpath\fR as the MANPATH environment variable. See \fBman\fR(1) for
+details of how this is interpreted.
+.TP
+\fB\-k \fIkeyword\fR
+Use \fIkeyword\fR for keyword-based man page search.
+.TP
+\fB\-l \fIfile\fR
+Open the specified local \fIfile\fR as a man page.
+
+.SH ENVIRONMENT
+Following environment variables are used:
+
+.TP
+.B MANCHA_CHA
+If set, the contents of the variable are used instead of \fIcha\fR.
+
+.TP
+.B MANCHA_MAN
+If set, the contents of the variable are used instead of \fI/usr/bin/man\fR.
+
+.SH SEE ALSO
+\fBman\fR(1), \fBcha\fR(1), \fBcha-localcgi\fR(5), \fBw3mman\fR(1)
diff --git a/doc/protocols.md b/doc/protocols.md
index e4982944..8a1d642f 100644
--- a/doc/protocols.md
+++ b/doc/protocols.md
@@ -18,7 +18,7 @@ this document.
 * [Gemini](#gemini)
 * [Finger](#finger)
 * [Spartan](#spartan)
-* [Local schemes: file:, about:, data:, cgi-bin:](#local-schemes-file-about-data-cgi-bin)
+* [Local schemes: file:, about:, man:, data:, cgi-bin:](#local-schemes-file-about-man-data-cgi-bin)
 * [Custom protocols](#custom-protocols)
 
 <!-- MANON -->
@@ -112,7 +112,7 @@ protocol-specific line type. This is sort of supported through a sed filter
 for gemtext outputs in the CGI script (in other words, no modification to
 gmi2html was done to support this).
 
-## Local schemes: file:, about:, data:, cgi-bin:
+## Local schemes: file:, about:, man:, data:, cgi-bin:
 
 While these are not necessarily *protocols*, they are implemented similarly
 to the protocols listed above (and thus can also be replaced, if the user
@@ -125,6 +125,12 @@ shows the directory listing like the FTP protocol does.
 writing, the following pages are available: `about:chawan`, `about:blank`
 and `about:license`.
 
+`man:`, `man-k:` and `man-l:` are wrappers around the commands `man`, `man -k`
+and `man -l`. These look up man pages using `/usr/bin/man` and turn on-page
+references into links. A wrapper command `mancha` also exists; this has an
+interface similar to `man`. Note that Perl is required for these protocols
+to work.
+
 `data:` decodes a data URL as defined in RFC 2397.
 
 Finally, `cgi-bin:` executes a local CGI script. This scheme is used for