man page generation
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Wed, 15 Mar 2006 04:40:32 +0000 (04:40 +0000)
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Wed, 15 Mar 2006 04:40:32 +0000 (04:40 +0000)
Makefile.PL
debian/rules
doc/todo.mdwn
doc/usage.mdwn
mdwn2man [new file with mode: 0755]

index df26287faa3c04f040752bc59a36d7c1cd0b113a..d51334c1fce62e2f41af0ac40ea96d05732cbfe6 100755 (executable)
@@ -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
index 7a0f8868fee3ca56307098d0473563fa34992abe..b65fa72f9e9b4f281ace1cd02ae317291be4a685 100755 (executable)
@@ -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
index 7565c5b5934373f189068729c78cf1b0228c81a3..68b1ccff50c4de69e902274295ad9888380382e6 100644 (file)
@@ -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
index 0377014fd431d0344999775715569049b49a5173..75e3aa2461eb1173f48a923b763d3c14107f6e2e 100644 (file)
@@ -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 (executable)
index 0000000..13b1b84
--- /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 $_;
+}