From 6849c8fab595e0b2c73daf3b691531cf9089de6c Mon Sep 17 00:00:00 2001 From: "https://www.google.com/accounts/o8/id?id=AItOawnxp2XU8gIribhhGhGuYtU6eMMwHv5gUGI" Date: Thu, 9 Jun 2011 08:06:24 +0000 Subject: [PATCH] code's in git --- doc/plugins/contrib/mandoc.mdwn | 53 +-------------------------------- 1 file changed, 1 insertion(+), 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: - ------ - - - #!/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 = ; - close MANDOCOUT; - waitpid $pid, 0; - - my $html = join('', @html_output); - my $link_prefix = $config{usedirs} ? '../' : ''; - my $link_suffix = $config{usedirs} ? '/' : ''; - $html =~ s|(.+?)\((.)\)|$1($2)|g; - - return $html; - } - - 1 -- 2.26.2