~theorytoe/mman

26e474c2f5b288f4f3ab5f9fff2fa6372733ed3c — theorytoe 6 months ago 0697607
add: patches
3 files changed, 259 insertions(+), 1 deletions(-)

M README.md
A no-scdoc.patch
A no-troff.patch
M README.md => README.md +1 -1
@@ 17,11 17,11 @@ There are also a couple of patches:

- `./no-scdoc.patch` -- remove scdoc support
- `./no-troff.patch` -- remove troff "support"
- `./no-txt.patch`   -- remove plaintext "support"

patches can be applied/removed withe the following commands

```bash
# see patch(1) for more information
patch < [patch-name].patch    # apply patch
patch -R < [patch-name].patch # restore patch
```

A no-scdoc.patch => no-scdoc.patch +145 -0
@@ 0,0 1,145 @@
--- mman	2022-11-21 15:58:28.190517795 -0700
+++ mman.in	2022-11-21 16:01:34.063839751 -0700
@@ -1,10 +1,9 @@
 #!/bin/sh
 
-# mman 0.0-a3
+# mman 0.0-a3:p
 # script for editing custom manual pages
 
 MMANDIR=${MMANDIR:-~/.mman}
-SRCDIR=${MMANDIR}/scd
 EDITOR=${EDITOR:-nano}
 PAGER=${PAGER:-less}
 
@@ -13,7 +12,6 @@
 ACTION=view
 
 [ -d "$MMANDIR" ] || mkdir -p "$MMANDIR"
-[ -d "$SRCDIR" ] || mkdir -p "$SRCDIR"
 
 # add coloring to manpages
 export LESS_TERMCAP_md=$(tput bold; tput setaf 4)
@@ -63,29 +61,6 @@
 	done
 }
 
-editscdoc() {
-	for i in $SECTION; do
-		file=${SRCDIR}/$1.$i.scd
-		if [ -f "$file" ]; then
-			"$EDITOR" "$file"
-			return $?
-		fi
-	done
-	for i in $SECTION; do
-		"$EDITOR" "${MMANDIR}/$1.$i.man"
-		compileman # compile manpages after edit
-		return $?
-	done
-}
-
-# TODO: rework this to use -exec
-compileman() {
-	for i in $(find $SRCDIR -type f); do
-		dest=${MMANDIR}/$(basename -s .scd $i).man
-		scdoc < $i > ${MMANDIR}/$(basename -s .scd $i).man
-	done
-}
-
 viewman() {
 	for i in $SECTION; do
 		file=${MMANDIR}/$1.$i.man
@@ -112,8 +87,6 @@
-usage: $(basename $0) [-e|-t|-s|-c|-l] [section] name
+usage: $(basename $0) [-e|-s|-c|-l] [section] name
     -e Edit a txt man page
     -t Edit a troff -man manpage
-    -s Edit an scdoc manpage
-    -c Compile scdoc manpages
     -l List available pages
 What mmanual do you want?
 EOF
@@ -129,13 +102,6 @@
 		-t)
 			ACTION=edittroff
 			shift;;
-		-s)
-			ACTION=editscdoc
-			shift;;
-		-c)
-			# love hacks
-			compileman
-			exit $?;;
 		-l)
 			# XXX: should I keep this here? no
 			find $MMANDIR -not -type d \
@@ -168,13 +134,6 @@
 					fi
 					edittroff "$1"
 					exit $?;;
-				editscdoc)
-					if ! istty; then
-						echo "Not running in a tty!"
-						exit 1
-					fi
-					editscdoc "$1"
-					exit $?;;
 				*)
 					usage
 					exit 0;;
--- mman.1	2022-11-21 15:58:34.733850727 -0700
+++ mman.1.in	2022-11-21 16:01:26.007173576 -0700
@@ -1,18 +1,18 @@
 .\" 
-.TH mman 1 2022-11-20 "mman 0.0-a3"
+.TH mman 1 2022-11-20 "mman 0.0-a3:p"
 .SH NAME
 mman \- write personal mmanpages
 
 .SH SYNPOSYS
 .B mman
-.RI [ \-e | \-t | \-s | \-c | \-l ]
+.RI [ \-e | \-t | \-l ]
 .RI [ section ]
 .I name
 
 .SH DESCRIPTION
-Create man pages for personal documentation using plaintext, \fBtroff\fR(1), and \fBscdoc\fR(1)
-syntax. Pages are organized by section, similar to traditional manpages, but without the strict
-requirement to conform to those standards. If a 
+Create man pages for personal documentation using plaintext and \fBtroff\fR(1)
+syntax. Pages are organized by section, similar to traditional manpages, but
+without the strict requirement to conform to those standards. If a 
 .I secion
 Is not specified, new pages will default to secion 0, a non-standard section.
 
@@ -25,22 +25,10 @@
 Edit a troff man page.
 
 .TP
-\fB \-s \fR
-Edit an scdoc man page. Compiles pages after edit.
-
-.TP
-\fB \-c \fR
-Compile scdoc manpages.
-
-.TP
 \fB \-l \fR
 List available pages.
 
 .SH NOTES
-Be wary of pages written with scdoc. If a troff and scdoc page are named the same, compiling
-an scdoc page will overwrite the existsing troff page. This is intended behavior.
-
-.PP
 Man pages are shown with colors using \fBless\fR(1) termcap environment vars.
 
 .SH AUTHOR
@@ -62,4 +50,4 @@
 the extent permitted by law.
 
 .SH SEE ALSO
-\fBman\fR(7) \fBman-pages\fR(7) \fBnroff\fR(1) \fBtroff\fR(1) \fBscdoc\fR(5) \fBless\fR(1)
+\fBman\fR(7) \fBman-pages\fR(7) \fBnroff\fR(1) \fBtroff\fR(1) \fBless\fR(1)

A no-troff.patch => no-troff.patch +113 -0
@@ 0,0 1,113 @@
--- mman	2022-11-21 15:58:28.190517795 -0700
+++ mman.in	2022-11-21 16:03:38.213832151 -0700
@@ -48,21 +48,6 @@
 	done
 }
 
-# TODO: add support for adding templates
-edittroff() {
-	for i in $SECTION; do
-		file="${MMANDIR}/$1.$i.man"
-		if [ -f "$file" ]; then
-			"$EDITOR" "$file"
-			return $?
-		fi
-	done
-	for i in $SECTION; do
-		"$EDITOR" "${MMANDIR}/$1.$i.man"
-		return $?
-	done
-}
-
 editscdoc() {
 	for i in $SECTION; do
 		file=${SRCDIR}/$1.$i.scd
@@ -109,9 +94,8 @@
 
 usage() {
 	cat << EOF
-usage: $(basename $0) [-e|-t|-s|-c|-l] [section] name
+usage: $(basename $0) [-e|-s|-c|-l] [section] name
     -e Edit a txt man page
-    -t Edit a troff -man manpage
     -s Edit an scdoc manpage
     -c Compile scdoc manpages
     -l List available pages
@@ -126,9 +110,6 @@
 		-e)
 			ACTION=edit
 			shift;;
-		-t)
-			ACTION=edittroff
-			shift;;
 		-s)
 			ACTION=editscdoc
 			shift;;
@@ -161,13 +142,6 @@
 					fi
 					editman "$1"
 					exit $?;;
-				edittroff)
-					if ! istty; then
-						echo "Not running in a tty!"
-						exit 1
-					fi
-					edittroff "$1"
-					exit $?;;
 				editscdoc)
 					if ! istty; then
 						echo "Not running in a tty!"
--- mman.1	2022-11-21 15:58:34.733850727 -0700
+++ mman.1.in	2022-11-21 16:05:18.607159344 -0700
@@ -1,18 +1,18 @@
 .\" 
-.TH mman 1 2022-11-20 "mman 0.0-a3"
+.TH mman 1 2022-11-20 "mman 0.0-a3:p"
 .SH NAME
 mman \- write personal mmanpages
 
 .SH SYNPOSYS
 .B mman
-.RI [ \-e | \-t | \-s | \-c | \-l ]
+.RI [ \-e | \-s | \-c | \-l ]
 .RI [ section ]
 .I name
 
 .SH DESCRIPTION
-Create man pages for personal documentation using plaintext, \fBtroff\fR(1), and \fBscdoc\fR(1)
-syntax. Pages are organized by section, similar to traditional manpages, but without the strict
-requirement to conform to those standards. If a 
+Create man pages for personal documentation using plaintext, and \fBscdoc\fR(1)
+syntax. Pages are organized by section, similar to traditional manpages, but
+without the strict requirement to conform to those standards. If a 
 .I secion
 Is not specified, new pages will default to secion 0, a non-standard section.
 
@@ -21,10 +21,6 @@
 Edit a txt man page.
 
 .TP
-\fB \-t \fR
-Edit a troff man page.
-
-.TP
 \fB \-s \fR
 Edit an scdoc man page. Compiles pages after edit.
 
@@ -37,10 +33,6 @@
 List available pages.
 
 .SH NOTES
-Be wary of pages written with scdoc. If a troff and scdoc page are named the same, compiling
-an scdoc page will overwrite the existsing troff page. This is intended behavior.
-
-.PP
 Man pages are shown with colors using \fBless\fR(1) termcap environment vars.
 
 .SH AUTHOR
@@ -62,4 +54,4 @@
 the extent permitted by law.
 
 .SH SEE ALSO
-\fBman\fR(7) \fBman-pages\fR(7) \fBnroff\fR(1) \fBtroff\fR(1) \fBscdoc\fR(5) \fBless\fR(1)
+\fBman\fR(7) \fBman-pages\fR(7) \fBscdoc\fR(5) \fBless\fR(1)