1 <:url:>
<:url path [queryargs] [text] [noescape] [extra_args]:>
Produces a URL or an HTML <A> tag.
All arguments except path are optional.
- queryargs can be a dictionary of arguments which you
would like added to the URL as a query string, for example, the
dictionary {'foo':5, 'bar':'yes'} gets translated to
appending ?foo=5&bar=yes to the url. Defaults to an empty
dictionary.
- text is an optional string. If it is present, the tag
will not just produce a URL, but a full HTML <A>
tag with an HREF attribute holding the URL and the text in
between.
- The noescape argument, if present,
tells SkunkWeb not to escape URL-unsafe characters in the path
argument, such as spaces or extended characters. By default,
SkunkWeb will escape all non-safe characters except for the /
character, which it leaves intact. It will escape the :
character in your path argument, however.
- extra_args is not an argument name: it just means
that any other arguments you pass by name will be put in the
<A> tag if text is not empty. Example:
<:url /index.html text="Home Page" target="_blank" :>
# produces
<a href="/index.html" target="_blank">Home Page<a>
The equivalent Python component code would be:
import templating.UrlBuilder
print templating.UrlBuilder.url(path, queryargs, text,
extra_args_as_dict, noescape)