add paths to plugin files in copyright
[ikiwiki.git] / IkiWiki / Plugin / typography.pm
blob9389b24d428ba092915babf5f3cf7c98c3664058
1 #!/usr/bin/perl
3 package IkiWiki::Plugin::typography;
5 use warnings;
6 use strict;
7 use IkiWiki 3.00;
9 sub import {
10 hook(type => "getopt", id => "typography", call => \&getopt);
11 hook(type => "getsetup", id => "typography", call => \&getsetup);
12 hook(type => "sanitize", id => "typography", call => \&sanitize);
15 sub getopt () {
16 eval q{use Getopt::Long};
17 error($@) if $@;
18 Getopt::Long::Configure('pass_through');
19 GetOptions("typographyattributes=s" => \$config{typographyattributes});
22 sub getsetup () {
23 eval q{use Text::Typography};
24 error($@) if $@;
26 return
27 plugin => {
28 safe => 1,
29 rebuild => 1,
31 typographyattributes => {
32 type => "string",
33 example => "3",
34 description => "Text::Typography attributes value",
35 advanced => 1,
36 safe => 1,
37 rebuild => 1,
41 sub sanitize (@) {
42 my %params=@_;
44 eval q{use Text::Typography};
45 return $params{content} if $@;
47 my $attributes=defined $config{typographyattributes} ? $config{typographyattributes} : '3';
48 return Text::Typography::typography($params{content}, $attributes);