-
Notifications
You must be signed in to change notification settings - Fork 6
/
contributor_name2link.mc
56 lines (39 loc) · 1.1 KB
/
contributor_name2link.mc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<%doc>
=head1 NAME
contributor_name2link.mc
=head1 SYNOPSIS
<& contributor_list.mc,
asset => $story,
sep => ', ',
final => ' and ',
format => '%f% l',
default => ''
&>
=head1 DESCRIPTION
Changes a contributor's name to a url structure called by contributor_list.mc on thetyee.ca
Utility template that returns the URI of a contributor page,
given the contributor's name. Right now this just means
converting all non-alphanumeric characters to underscores.
=head1 AUTHOR
Dawn Buie <[email protected]>
=head1 COPYRIGHT AND LICENSE
This template is free software; you can redistribute it and/or modify it under
the same terms as Bricolage itself.
=cut
</%doc>
<%args>
$name => undef
$caturi => '/Bios'
</%args>
<%perl>
return unless defined $name;
my @names = ref($name) ? @$name : $name;
@names = map {
(my $slug = $_) =~ s/\W/_/g;
"<a class=\"contrib-link\" title=\"Bio page for $_\" href=\"$caturi/$slug\">$_</a>"
} @names;
# return wantarray ? @names : $names[0];
return wantarray ? @names : $names[0];
#use Data::Dump 'dump';
#print dump(@names);
</%perl>