summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xMakefile.PL7
-rwxr-xr-xdebian/rules2
-rw-r--r--doc/todo.mdwn5
-rw-r--r--doc/usage.mdwn2
-rwxr-xr-xmdwn2man35
5 files changed, 42 insertions, 9 deletions
diff --git a/Makefile.PL b/Makefile.PL
index df26287fa..d51334c1f 100755
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -14,10 +14,11 @@ pure_install:: extra_install
extra_build:
./ikiwiki doc templates html --wikiname="ikiwiki" --verbose \
--nosvn --exclude=/discussion
-
+ ./mdwn2man doc/usage.mdwn > ikiwiki.man
+
extra_clean:
- rm -rf html
- rm -rf doc/.ikiwiki
+ rm -rf html doc/.ikiwiki
+ rm -f ikiwiki.man
extra_install:
install -d $(PREFIX)/share/ikiwiki/templates
diff --git a/debian/rules b/debian/rules
index 7a0f8868f..b65fa72f9 100755
--- a/debian/rules
+++ b/debian/rules
@@ -24,7 +24,7 @@ binary-indep: build
$(MAKE) pure_install INSTALLDIRS=vendor \
PREFIX=$(shell pwd)/debian/ikiwiki/$(shell perl -MConfig -e 'print $$Config{prefix}')
dh_installdocs html
- dh_installexamples
+ dh_installman ikiwiki.man
dh_installchangelogs
dh_compress
dh_fixperms
diff --git a/doc/todo.mdwn b/doc/todo.mdwn
index 7565c5b59..68b1ccff5 100644
--- a/doc/todo.mdwn
+++ b/doc/todo.mdwn
@@ -19,11 +19,6 @@ is built. (As long as all changes to all pages is ok.)
already, so just look at the userdb, svnlook at what's changed, and send
mails to people who have subscribed.
-## docs
-
-Need to turn [[usage]] into a man page.
-this wiki too. Can markdown generate a man page somehow?
-
## pluggable renderers
I'm considering a configurable rendering pipeline for each supported
diff --git a/doc/usage.mdwn b/doc/usage.mdwn
index 0377014fd..75e3aa246 100644
--- a/doc/usage.mdwn
+++ b/doc/usage.mdwn
@@ -100,3 +100,5 @@ flags such as --verbose can be negated with --no-verbose.
# AUTHOR
Joey Hess <joey@kitenet.net>
+
+Warning: this page is automatically made into ikiwiki's man page, edit with care
diff --git a/mdwn2man b/mdwn2man
new file mode 100755
index 000000000..13b1b84a8
--- /dev/null
+++ b/mdwn2man
@@ -0,0 +1,35 @@
+#!/usr/bin/perl
+# Warning: hack
+
+print ".TH ikiwiki 1\n";
+
+while (<>) {
+ s/^#\s/.SH /;
+ s/^\s+//;
+ s/^Warning:.*//g;
+ s/^$/.PP\n/;
+ s/\[\[//g;
+ s/\]\]//g;
+ s/\`//g;
+ s/^\*\s+(.*)/.IP "$1"/;
+ next if $_ eq ".PP\n" && $skippara;
+ if (/^.IP /) {
+ $inlist=1;
+ $spippara=0;
+ }
+ elsif (/.SH/) {
+ $skippara=0;
+ $inlist=0;
+ }
+ elsif (/^\./) {
+ $skippara=1;
+ }
+ else {
+ $skippara=0;
+ }
+ if ($inlist && $_ eq ".PP\n") {
+ $_=".IP\n";
+ }
+
+ print $_;
+}