]> Lady’s Gitweb - Gitweb/blobdiff - gitweb.perl
gitweb: provide function to format the URL for an action link.
[Gitweb] / gitweb.perl
index 527ab1621ee3cce97006c9ed6b6d2bc494e9052a80ebc83cdb1ce35d0992b4d1..b31f7074e5d198506173ac07fb2fbc236674e744beb318dfb675cae1360cea44 100755 (executable)
@@ -184,6 +184,33 @@ if (!defined($actions{$action})) {
 $actions{$action}->();
 exit;
 
+## ======================================================================
+## action links
+
+sub href(%) {
+       my %mapping = (
+               action => "a",
+               project => "p",
+               file_name => "f",
+               hash => "h",
+               hash_parent => "hp",
+               hash_base => "hb",
+               page => "pg",
+               searchtext => "s",
+       );
+
+       my %params = @_;
+       $params{"project"} ||= $project;
+
+       my $href = "$my_uri?";
+       $href .= esc_param( join(";",
+               map { "$mapping{$_}=$params{$_}" } keys %params
+       ) );
+
+       return $href;
+}
+
+
 ## ======================================================================
 ## validation, quoting/unquoting and escaping
 
This page took 0.21057 seconds and 4 git commands to generate.