From 435e06bce1fb8efe209ca0a7edf2c9f4d40db478 Mon Sep 17 00:00:00 2001 From: joey Date: Tue, 5 Jun 2007 19:04:15 +0000 Subject: [PATCH] * Add typographyattributes configuration setting to typography plugin. --- IkiWiki/Plugin/typography.pm | 11 ++++++++++- debian/changelog | 3 ++- doc/plugins/typography.mdwn | 4 ++++ doc/todo/typography_plugin_configuration.mdwn | 2 ++ 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/IkiWiki/Plugin/typography.pm b/IkiWiki/Plugin/typography.pm index 3b66ab0d0..5073d51d3 100644 --- a/IkiWiki/Plugin/typography.pm +++ b/IkiWiki/Plugin/typography.pm @@ -7,16 +7,25 @@ use strict; use IkiWiki 2.00; sub import { #{{{ + hook(type => "getopt", id => "typography", call => \&getopt); IkiWiki::hook(type => "sanitize", id => "typography", call => \&sanitize); } # }}} +sub getopt () { #{{{ + eval q{use Getopt::Long}; + error($@) if $@; + Getopt::Long::Configure('pass_through'); + GetOptions("typographyattributes=s" => \$config{typographyattributes}); +} #}}} + sub sanitize (@) { #{{{ my %params=@_; eval q{use Text::Typography}; return $params{content} if $@; - return Text::Typography::typography($params{content}); + my $attributes=defined $config{typographyattributes} ? $config{typographyattributes} : '3'; + return Text::Typography::typography($params{content}, $attributes); } # }}} 1 diff --git a/debian/changelog b/debian/changelog index 9c558b33e..37b7edf79 100644 --- a/debian/changelog +++ b/debian/changelog @@ -35,8 +35,9 @@ ikiwiki (2.2) UNRELEASED; urgency=low * Fix wrapper generator and untaint code's handling of strings contining newlines. * Make the url absolution code for feeds significantly more robust. + * Add typographyattributes configuration setting to typography plugin. - -- Joey Hess Sun, 03 Jun 2007 13:10:08 -0400 + -- Joey Hess Tue, 05 Jun 2007 15:03:48 -0400 ikiwiki (2.1) unstable; urgency=low diff --git a/doc/plugins/typography.mdwn b/doc/plugins/typography.mdwn index 2e65393a7..b03c2a086 100644 --- a/doc/plugins/typography.mdwn +++ b/doc/plugins/typography.mdwn @@ -6,3 +6,7 @@ This plugin, also known as plain ASCII punctuation characters into ``smart'' typographic punctuation HTML entities. To use it, you need to have the [[cpan Text::Typography]] module installed. + +This plugin has a configuration option. To change the attributes, +set `--typographyattributes=whatever`. See the documentation for +[[cpan Text::Typography]] for available attributes. diff --git a/doc/todo/typography_plugin_configuration.mdwn b/doc/todo/typography_plugin_configuration.mdwn index d920676e2..91ac4ba85 100644 --- a/doc/todo/typography_plugin_configuration.mdwn +++ b/doc/todo/typography_plugin_configuration.mdwn @@ -2,3 +2,5 @@ The [[typography_plugin|plugins/typography]] could support configuration of which translations to make. [[cpan Text::Typography]] supports fine-grained control of which translations to make, so [[plugins/typography]] just needs to expose this somehow. --[[JoshTriplett]] + +[[done]] --[[Joey]] -- 2.45.2