about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2023-09-20 23:17:43 +0200
committerbptato <nincsnevem662@gmail.com>2023-09-20 23:22:08 +0200
commita2d276c7b837359771a6fa68a6da07364aa98a3c (patch)
tree6a620374e149a4e2a9e2ee5ffc874f0ea77cc4bd
parentbc85e40f424b3dc5e92989917fe06c7b6abb282f (diff)
downloadchawan-a2d276c7b837359771a6fa68a6da07364aa98a3c.tar.gz
improve manpages
-rw-r--r--Makefile21
-rw-r--r--doc/cha.113
-rw-r--r--doc/config.md15
-rw-r--r--doc/mailcap.md18
-rw-r--r--doc/mime.types.md20
5 files changed, 69 insertions, 18 deletions
diff --git a/Makefile b/Makefile
index 50d324f1..35787bfe 100644
--- a/Makefile
+++ b/Makefile
@@ -49,20 +49,27 @@ clean:
 	rm -rf $(OBJDIR)
 	rm -f lib/libquickjs.a
 
+$(OBJDIR)/cha-%.md: doc/%.md | $(OBJDIR)/
+	sed -e '/<!-- MANOFF -->/,/<!-- MANON -->/d' \
+		-e '/^<!-- MANON$$/d' \
+		-e '/^MANOFF -->$$/d' $< | \
+		./table_rewrite.sh > $@
+
+$(OBJDIR)/cha-%.5: $(OBJDIR)/cha-%.md
+	pandoc --standalone --to man $< -o $@
+
 .PHONY: manpage
-manpage:
-	sed '/<!-- TOCSTART -->/,/<!-- TOCEND -->/d' doc/config.md | \
-		sed '1s/<!-- \(.*\) -->/\1/' | \
-		./table_rewrite.sh > .obj/cha-config.md
-	pandoc --standalone --to man .obj/cha-config.md -o .obj/cha-config.5
+manpage: $(OBJDIR)/cha-config.5 $(OBJDIR)/cha-mailcap.5 $(OBJDIR)/cha-mime.types.5
 	cp doc/cha.1 "$(OBJDIR)/cha.1"
 
 .PHONY: install
 install:
 	mkdir -p "$(DESTDIR)$(prefix)/bin"
 	install -m755 cha "$(DESTDIR)$(prefix)/bin"
-	test -f "$(OBJDIR)/cha-config.5" && install -m755 "$(OBJDIR)/cha-config.5" "$(DESTDIR)$(manprefix5)"
-	test -f "$(OBJDIR)/cha.1" && install -m755 "$(OBJDIR)/cha.1" "$(DESTDIR)$(manprefix1)"
+	test -f "$(OBJDIR)/cha-config.5" && install -m755 "$(OBJDIR)/cha-config.5" "$(DESTDIR)$(manprefix5)" || true
+	test -f "$(OBJDIR)/cha-mailcap.5" && install -m755 "$(OBJDIR)/cha-mailcap.5" "$(DESTDIR)$(manprefix5)" || true
+	test -f "$(OBJDIR)/cha-mime.types.5" && install -m755 "$(OBJDIR)/cha-mime.types.5" "$(DESTDIR)$(manprefix5)" || true
+	test -f "$(OBJDIR)/cha.1" && install -m755 "$(OBJDIR)/cha.1" "$(DESTDIR)$(manprefix1)" || true
 
 .PHONY: uninstall
 uninstall:
diff --git a/doc/cha.1 b/doc/cha.1
index dcb32baf..e2b7d35d 100644
--- a/doc/cha.1
+++ b/doc/cha.1
@@ -16,20 +16,20 @@ can freely open, duplicate, delete, and navigate between these.
 
 .SH ARGUMENTS
 On invocation, Chawan looks through all arguments provided, and attempts
-to open each file supplied. An error message is provided if opening a file
-fails. If no files could successfully be opened, Chawan exits automatically.
+to open each file supplied. If no files could successfully be opened, Chawan
+exits automatically.
 
 Chawan may also be started without specifying a file, if a file is provided
 through a pipe. In this case, it may be useful to set the content type using
 e.g. \fB\-T \fItext/html\fR. (The \fB-\fR pseudo-file argument, commonly accepted
-by other commands, is simply ignored.)
+by other commands to mean "pipe input", is simply ignored.)
 
 .SH OPTIONS
 Command line options generally have both short forms (e.g. \fB\-d\fR) and long
 forms (e.g. \fB\-\-dump\fR).
 
-Long forms must be introduced with two dashes; when
-only a single dash is provided, each letter is parsed as a separate short form.
+Long forms must be introduced with two dashes; when only a single dash is
+provided, each letter is parsed as a separate short form.
 .br
 (e.g. \fB\-abcd\fR is equivalent to \fB\-a \-b \-c \-d\fR, \fInot\fR
 \fB\-\-abcd\fR.)
@@ -121,3 +121,6 @@ configuration option is not set.
 
 .SH CONFIGURATION
 Configuration options are described in \fBcha-config\fR(5).
+
+.SH SEE ALSO
+\fBcha-mailcap\fR(5), \fBcha-mime.types\fR(5)
diff --git a/doc/config.md b/doc/config.md
index 888e184f..ca7924b9 100644
--- a/doc/config.md
+++ b/doc/config.md
@@ -1,4 +1,6 @@
-<!-- % cha-config(5) | Configuration of Chawan -->
+<!-- MANON
+% cha-config(5) | Configuration of Chawan
+MANOFF -->
 
 # Configuration of Chawan
 
@@ -23,7 +25,7 @@ environment variable is not set.) See the default configuration file in the
 res/ folder, and bonus configuration files in the bonus/ folder for further
 examples.
 
-<!-- TOCSTART -->
+<!-- MANOFF -->
 **Table of contents**
 
 * [Start](#start)
@@ -41,7 +43,8 @@ examples.
 * [Appendix](#appendix)
    * [Regex handling](#regex-handling)
 
-<!-- TOCEND -->
+<!-- MANON -->
+
 ## Start
 
 Start-up options are to be placed in the `[start]` section.
@@ -1030,3 +1033,9 @@ efgh$ -> efgh$
 ^ijkl$ -> ^ijkl$
 mnop -> ^mnop$
 ```
+<!-- MANON
+
+## See also
+
+**cha**(1)
+MANOFF -->
diff --git a/doc/mailcap.md b/doc/mailcap.md
index 185e1db6..179da91b 100644
--- a/doc/mailcap.md
+++ b/doc/mailcap.md
@@ -1,3 +1,7 @@
+<!-- MANON
+% cha-mailcap(5) | Mailcap support in Chawan
+MANOFF -->
+
 # Mailcap
 
 Chawan's buffers can only handle HTML and plain text. To make Chawan recognize
@@ -5,7 +9,14 @@ other file formats, the mailcap file format can be used.
 
 Note that Chawan's default mime.types file only recognizes a few file
 extensions, which may result in your entries not being executed.
-Please consult the [mime.types](mime.types.md) documentation for details.
+Please consult the
+<!-- MANOFF -->
+[mime.types](mime.types.md)
+<!-- MANON -->
+<!-- MANON
+**cha-mime.types**(5)
+MANOFF -->
+documentation for details.
 
 For an exact description of the mailcap format, see
 [RFC 1524](https://www.rfc-editor.org/rfc/rfc1524).
@@ -88,3 +99,8 @@ application/vnd.openxmlformats-officedocument.wordprocessingml.document;lowriter
 # Following entry will be ignored, as text/html is supported natively by Chawan.
 text/html; cha -T text/html -I %{charset}; copiousoutput
 ```
+<!-- MANON
+## See also
+
+**cha**(1)
+MANOFF -->
diff --git a/doc/mime.types.md b/doc/mime.types.md
index 710c01dc..296e4c4d 100644
--- a/doc/mime.types.md
+++ b/doc/mime.types.md
@@ -1,8 +1,18 @@
+<!-- MANON
+% cha-config(5) | MIME type detection in Chawan
+MANOFF -->
+
 # mime.types
 
 Chawan uses the mime.types file to recognize certain file extensions for
-matching mailcap entries. See the [mailcap](mailcap.md) documentation for
-a description of mailcap.
+matching mailcap entries. See the
+<!-- MANOFF -->
+[mailcap](mailcap.md)
+<!-- MANON -->
+<!-- MANON
+**cha-mailcap**(5)
+MANOFF -->
+documentation for a description of mailcap.
 
 ## Search path
 
@@ -42,3 +52,9 @@ The default mime.types file only includes file formats that buffers can handle,
 which is rather limited (at the time of writing, 5 file formats). Therefore it
 is highly recommended to configure at least one external mime.types file if you
 use mailcap.
+<!-- MANON
+
+## See also
+
+**cha**(1)
+MANOFF -->