]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blob - IkiWiki/Plugin/typography.pm
web commit by http://xtermin.us/: sitemaps plugin
[git.ikiwiki.info.git] / IkiWiki / Plugin / typography.pm
1 #!/usr/bin/perl
3 package IkiWiki::Plugin::typography;
5 use warnings;
6 use strict;
7 use IkiWiki 2.00;
9 sub import { #{{{
10         hook(type => "getopt", id => "typography", call => \&getopt);
11         IkiWiki::hook(type => "sanitize", id => "typography", call => \&sanitize);
12 } # }}}
14 sub getopt () { #{{{
15         eval q{use Getopt::Long};
16         error($@) if $@;
17         Getopt::Long::Configure('pass_through');
18         GetOptions("typographyattributes=s" => \$config{typographyattributes});
19 } #}}}
21 sub sanitize (@) { #{{{
22         my %params=@_;
24         eval q{use Text::Typography};
25         error($@) if $@;
27         my $attributes=defined $config{typographyattributes} ? $config{typographyattributes} : '3';
28         return Text::Typography::typography($params{content}, $attributes);
29 } # }}}
31 1