Initial version of ikiwiki plug-in. Start with simpler non-project publishing.
[muse-el.git] / examples / ikiwiki / muse
blob762800c2d0eab069cfc1b57d05bfaacc3b4690ef
1 #!/usr/bin/perl
2 # Ikiwiki plugin for Emacs Muse.
3 # Author: Michael Olson
4 # License: GPLv2 or later
5 package IkiWiki::Plugin::muse;
7 use warnings;
8 use strict;
9 use IkiWiki 2.00;
10 use Encode;
11 use File::Temp;
13 sub import {
14 hook(type => "htmlize", id => "muse", call => \&htmlize);
17 sub htmlize (@) {
18 my %params=@_;
19 my $content = decode_utf8(encode_utf8($params{content}));
21 my ($fh, $filename) = File::Temp::tempfile();
22 my $quoted = $filename;
23 $quoted =~ s/"/\\"/g;
24 system "emacsclient", "--eval", qq{(muse-ikiwiki-publish "$quoted")};
26 local $/;
27 $contents = <$fh>;
29 return $contents;