From: Joey Hess <joey@gnu.kitenet.net>
Date: Tue, 19 May 2009 17:06:35 +0000 (-0400)
Subject: Merge commit 'intrigeri/po' into po
X-Git-Tag: 3.15~189
X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/commitdiff_plain/53b1c6f559c1d09fbdbc28c8e4d5090dd455cd26?ds=inline;hp=-c

Merge commit 'intrigeri/po' into po
---

53b1c6f559c1d09fbdbc28c8e4d5090dd455cd26
diff --combined IkiWiki/Plugin/po.pm
index 3ac182c2d,3503fabc4..d26c4ab4e
--- a/IkiWiki/Plugin/po.pm
+++ b/IkiWiki/Plugin/po.pm
@@@ -32,7 -32,7 +32,7 @@@ sub import 
  	hook(type => "getsetup", id => "po", call => \&getsetup);
  	hook(type => "checkconfig", id => "po", call => \&checkconfig);
  	hook(type => "needsbuild", id => "po", call => \&needsbuild);
 -	hook(type => "scan", id => "po", call => \&scan, last =>1);
 +	hook(type => "scan", id => "po", call => \&scan, last => 1);
  	hook(type => "filter", id => "po", call => \&filter);
  	hook(type => "htmlize", id => "po", call => \&htmlize);
  	hook(type => "pagetemplate", id => "po", call => \&pagetemplate, last => 1);
@@@ -141,7 -141,9 +141,7 @@@ sub checkconfig () 
  	    ! defined $config{po_link_to}) {
  		$config{po_link_to}='default';
  	}
 -	elsif (! grep {
 -			$config{po_link_to} eq $_
 -		} ('default', 'current', 'negotiated')) {
 +	elsif ($config{po_link_to} !~ /^(default|current|negotiated)$/) {
  		warn(sprintf(gettext('%s is not a valid value for po_link_to, falling back to po_link_to=default'),
  			     $config{po_link_to}));
  		$config{po_link_to}='default';
@@@ -178,8 -180,6 +178,6 @@@ sub scan (@) 
  	my $page=$params{page};
  	my $content=$params{content};
  
- 	return unless UNIVERSAL::can("IkiWiki::Plugin::link", "import");
- 
  	if (istranslation($page)) {
  		foreach my $destpage (@{$links{$page}}) {
  			if (istranslatable($destpage)) {
@@@ -290,7 -290,7 +288,7 @@@ sub pagetemplate (@) 
  } # }}}
  
  # Add the renamed page translations to the list of to-be-renamed pages.
 -sub renamepages(@) {
 +sub renamepages (@) {
  	my %params = @_;
  
  	my %torename = %{$params{torename}};
@@@ -326,13 -326,13 +324,13 @@@
  	return @ret;
  }
  
 -sub mydelete(@) {
 +sub mydelete (@) {
  	my @deleted=@_;
  
  	map { deletetranslations($_) } grep istranslatablefile($_), @deleted;
  }
  
 -sub change(@) {
 +sub change (@) {
  	my @rendered=@_;
  
  	# All meta titles are first extracted at scan time, i.e. before we turn
@@@ -340,14 -340,14 +338,14 @@@
  	# PO files breaks the meta plugin's parsing enough to save ugly titles
  	# to %pagestate at this time.
  	#
 -	# Then, at render time, every page's passes on row through the Great
 +	# Then, at render time, every page passes in turn through the Great
  	# Rendering Chain (filter->preprocess->linkify->htmlize), and the meta
  	# plugin's preprocess hook is this time in a position to correctly
  	# extract the titles from slave pages.
  	#
 -	# This is, unfortunately, too late: if the page A, linking to the page B,
 -	# is rendered before B, it will display the wrongly-extracted meta title
 -	# as the link text to B.
 +	# This is, unfortunately, too late: if the page A, linking to the page
 +	# B, is rendered before B, it will display the wrongly-extracted meta
 +	# title as the link text to B.
  	#
  	# On the one hand, such a corner case only happens on rebuild: on
  	# refresh, every rendered page is fixed to contain correct meta titles.
@@@ -786,10 -786,9 +784,10 @@@ sub refreshpot ($) 
  	$doc->{TT}{file_in_charset} = 'utf-8';
  	$doc->{TT}{file_out_charset} = 'utf-8';
  	$doc->read($masterfile);
 -	# let's cheat a bit to force porefs option to be passed to Locale::Po4a::Po;
 -	# this is undocument use of internal Locale::Po4a::TransTractor's data,
 -	# compulsory since this module prevents us from using the porefs option.
 +	# let's cheat a bit to force porefs option to be passed to
 +	# Locale::Po4a::Po; this is undocument use of internal
 +	# Locale::Po4a::TransTractor's data, compulsory since this module
 +	# prevents us from using the porefs option.
  	$doc->{TT}{po_out}=Locale::Po4a::Po->new({ 'porefs' => 'none' });
  	$doc->{TT}{po_out}->set_charset('utf-8');
  	# do the actual work