# -----------------------------------------------------------------------------
- # mkurl( destination_page, params_to_set, params_to_clear )
+ # mkurl( destination_page, params_to_set, params_to_clear, opts )
+ # Currently the opts hash only accepts a filter key (values 'html', 'uri', or 'none')
#
# Current page, updated params:
# mkurl('', {foo => 'bar', boo => 'baz'});
#
# Current page to a named anchor 'copies'
# mkurl('', {}, [], 'copies');
- MACRO mkurl(page, params, clear_params, named_anchor) BLOCK;
+ #
+ # Current page, don't filter output at all
+ # mkurl('', {}, [], '', { filter => 'none' });
+ #
+ # Current page, use html filter on output (the default, but made explicit)
+ # mkurl('', {}, [], '', { filter => 'html' });
+ MACRO mkurl(page, params, clear_params, named_anchor, opts) BLOCK;
# clone the query string to avoid clobberation
cgi = CGI.new(CGI.query_string);
END;
END;
+ # Hold resulting URL
+ result = '';
+
final = named_anchor ? '#' _ named_anchor : '';
IF page;
IF cgi.query_string;
- page _ '?' _ cgi.query_string _ final | html;
+ result = page _ '?' _ cgi.query_string _ final;
ELSE;
- page _ final | html;
+ result = page _ final;
END;
ELSE;
# staying on the current page
- cgi.url("-absolute" => 1, "-path" => 1, "-query" => 1) _ final | html;
+ result = cgi.url("-absolute" => 1, "-path" => 1, "-query" => 1) _ final;
+ END;
+
+ UNLESS opts.filter;
+ result | html;
+return;
END;
+
+ IF opts.filter == 'none';
+ result;
+return;
+ ELSIF opts.filter == 'uri';
+ result | uri;
+return;
+ ELSIF opts.filter == 'html';
+ result | html;
+return;
+ ELSE;
+ result | html;
+ END;
+
END;
# Dojo is required for the copy locations advanced search filter