aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorhttps://www.google.com/accounts/o8/id?id=AItOawnxp2XU8gIribhhGhGuYtU6eMMwHv5gUGI <Amitai@web>2011-06-09 08:06:24 +0000
committeradmin <admin@branchable.com>2011-06-09 08:06:24 +0000
commit6849c8fab595e0b2c73daf3b691531cf9089de6c (patch)
treea6f06f78fc39f3de3789049c7d98428bb7842614 /doc
parent1c07047e286cbf0d3d272fa55cb3fcb8416a0520 (diff)
downloadikiwiki-6849c8fab595e0b2c73daf3b691531cf9089de6c.tar
ikiwiki-6849c8fab595e0b2c73daf3b691531cf9089de6c.tar.gz
code's in git
Diffstat (limited to 'doc')
-rw-r--r--doc/plugins/contrib/mandoc.mdwn53
1 files changed, 1 insertions, 52 deletions
diff --git a/doc/plugins/contrib/mandoc.mdwn b/doc/plugins/contrib/mandoc.mdwn
index e4ff96d08..1db3e4da6 100644
--- a/doc/plugins/contrib/mandoc.mdwn
+++ b/doc/plugins/contrib/mandoc.mdwn
@@ -1,4 +1,5 @@
[[!template id=plugin name=mandoc author="[[schmonz]]"]]
+[[!template id=gitbranch branch=schmonz/master author="[[schmonz]]"]]
[[!tag type/format]]
This plugin lets ikiwiki convert Unix man pages to HTML. It uses
@@ -6,55 +7,3 @@ This plugin lets ikiwiki convert Unix man pages to HTML. It uses
xrefs into hyperlinks.
Sample output: <http://wiki.netbsd.org/users/schmonz/tunefs.8/>
-
------
-
-
- #!/usr/bin/perl
- package IkiWiki::Plugin::mandoc;
-
- use warnings;
- use strict;
- use IkiWiki 3.00;
- use Encode;
- use IPC::Open2;
-
- sub import {
- hook(type => "getsetup", id => "mandoc", call => \&getsetup);
- hook(type => "htmlize", id => $_, call => \&htmlize, keepextension => 1)
- foreach ('man', 1..9);
- }
-
- sub getsetup () {
- return
- plugin => {
- safe => 1,
- rebuild => 1, # format plugin
- section => "format",
- },
- }
-
- sub htmlize (@) {
- my %params=@_;
- my $content = decode_utf8(encode_utf8($params{content}));
-
- return $content if $@;
-
- my $pid = open2(*MANDOCOUT, *MANDOCIN, 'mandoc', '-Thtml');
- binmode($_, ':utf8') foreach (*MANDOCOUT, *MANDOCIN);
-
- print MANDOCIN $content;
- close MANDOCIN;
- my @html_output = <MANDOCOUT>;
- close MANDOCOUT;
- waitpid $pid, 0;
-
- my $html = join('', @html_output);
- my $link_prefix = $config{usedirs} ? '../' : '';
- my $link_suffix = $config{usedirs} ? '/' : '';
- $html =~ s|<a class="link-man">(.+?)\((.)\)</a>|<a class="link-man" href="$link_prefix$1.$2$link_suffix">$1($2)</a>|g;
-
- return $html;
- }
-
- 1