From 769be3d48e5612a73232b868cbd6cd35ab3515df Mon Sep 17 00:00:00 2001 From: intrigeri Date: Thu, 6 Nov 2008 13:47:09 +0100 Subject: po: po_link_to is safe, and fallbacks to a working value if needed warnings are displayed if it is set to an invalid or incompatible value (e.g. po_link_to=negotiated and disabled usedirs) Signed-off-by: intrigeri --- IkiWiki/Plugin/po.pm | 22 +++++++++++++++------- doc/plugins/po.mdwn | 11 ----------- 2 files changed, 15 insertions(+), 18 deletions(-) diff --git a/IkiWiki/Plugin/po.pm b/IkiWiki/Plugin/po.pm index 3b92583a1..1ef332d83 100644 --- a/IkiWiki/Plugin/po.pm +++ b/IkiWiki/Plugin/po.pm @@ -87,7 +87,7 @@ sub getsetup () { #{{{ type => "string", example => "current", description => "internal linking behavior (default/current/negotiated)", - safe => 0, + safe => 1, rebuild => 1, }, } #}}} @@ -107,16 +107,24 @@ sub checkconfig () { #{{{ islanguagecode($_) or error(sprintf(gettext("%s is not a valid language code"), $_)); } ($config{po_master_language}{code}, keys %{$config{po_slave_languages}}); - if (! exists $config{po_link_to} || - ! defined $config{po_link_to}) { - $config{po_link_to}="default"; - } if (! exists $config{po_translatable_pages} || ! defined $config{po_translatable_pages}) { $config{po_translatable_pages}=""; } - if ($config{po_link_to} eq "negotiated" && ! $config{usedirs}) { - error(gettext("po_link_to=negotiated requires usedirs to be set")); + if (! exists $config{po_link_to} || + ! defined $config{po_link_to}) { + $config{po_link_to}='default'; + } + elsif ($config{po_link_to} != 'default' + && $config{po_link_to} != 'current' + && $config{po_link_to} != 'negotiated') { + warn(sprintf(gettext('po_link_to=%s is not a valid setting, falling back to po_link_to=default'), + $config{po_link_to})); + $config{po_link_to}='default'; + } + elsif ($config{po_link_to} eq "negotiated" && ! $config{usedirs}) { + warn(gettext('po_link_to=negotiated requires usedirs to be enabled, falling back to po_link_to=default')); + $config{po_link_to}='default'; } push @{$config{wiki_file_prune_regexps}}, qr/\.pot$/; } #}}} diff --git a/doc/plugins/po.mdwn b/doc/plugins/po.mdwn index ee6dbb097..93ece9fb9 100644 --- a/doc/plugins/po.mdwn +++ b/doc/plugins/po.mdwn @@ -255,17 +255,6 @@ does. This is actually a duplicate for [[bugs/pagetitle_function_does_not_respect_meta_titles]], which might be fixed by something like [[todo/using_meta_titles_for_parentlinks]]. -### websetup - -Which configuration settings are safe enough for websetup, apart of -`po_master_language`, `po_slave_languages` and `po_translatable_pages` -that have been checked already? - -> `po_link_to` w/o usedirs causes ikiwiki to error out. If it were -> changed to fall back to a safe setting in this case rather than -> error, it would be safe. -> --[[Joey]] - ### backlinks `po_link_to = negotiated`: if a given translatable `sourcepage.mdwn` -- cgit v1.2.3