#!/usr/bin/perl # Ikiwiki language guessing plugin. package IkiWiki::Plugin::lang; use warnings; use strict; use IkiWiki 2.00; my %meta; my %title; my %permalink; my %author; my %authorurl; sub import { #{{{ hook(type => "pagetemplate", id => "meta", call => \&pagetemplate); } # }}} sub pagetemplate (@) { #{{{ my %params=@_; my $page=$params{page}; my $template=$params{template}; if ($page =~ m/^(.*)\.(\S\S\S?)$/) { $template->param(basename => $1); $template->param(lang => $2); $template->param($2 => 1); } else { $template->param(basename => $page); $template->param(lang => "en"); } } # }}} 1