This module provides helper functions which can be used to auto
generate AXML tag blocks in templates.
|
|
image_tag(source,
alt=None,
size=None,
**options)
Returns an image tag for the specified 'source' |
|
|
|
|
auto_discovery_link_tag(source,
type="rss",
**kwargs)
Returns a link tag allowing browsers and news readers to auto-detect
RSS or ATOM feeds for the current page. |
|
|
|
|
|
|
|
javascript_tag(content,
**html_options)
Returns a javascript tag with the 'content' inside. |
|
|
|
|
| cdata_section(content="") |
|
|
|
|
link_to(name,
url="",
**html_options)
Create a link of the given 'name' using a URL created by the set of
'options'. |
|
|
|
|
| convert_options_to_javascript(confirm=None,
method=None,
post=None,
popup=None,
**html_options) |
|
|
|
|
| confirm_javascript_function(confirm) |
|
|
|
|
| popup_javascript_function(popup) |
|
|
|
|
| method_javascript_function(method) |
|
|
|
|
link_to_function(name,
function,
**html_options)
Returns a link that will trigger a javascript 'function' using the
onclick handler and return false afterwards. |
|
|
|
|
button_to_function(name,
function,
**html_options)
Returns a button that will trigger a javascript 'function' using the
onclick handler and return false afterwards. |
|
|
|
|
truncate(text,
length=30,
truncate_string="...")
Truncate a string to a limited number of characters |
|
|
|
|
highlight(text,
phrase,
className='highlight')
Highlight a phrase in text |
|
|
|
|
|
|
|
auto_link_urls(text,
**href_options)
Convert all urls in text to href links |
|
|
|
|
auto_link(text,
**href_options)
Turns all urls and email addresses into clickable links. |
|
|
|
|
| number_with_delimiter(number,
delimiter=",",
separator=".") |
|
|
|
|
number_to_currency(number,
units="$",
precision=2,
separator=".",
delimiter=",")
Formats a 'number' into a currency string. |
|
|
|
|
number_to_percentage(number,
precision=2,
separator=".")
Formats a 'number' into a percentage string |
|
|
|
|
|
|
|
|
|
|
time_ago_in_words(from_time,
to_time=time.time())
Return from_time in human readable format. |
|
|
|
|
escape_javascript(javascript)
Escape carriage returns and single and double quotes for JavaScript
segments. |
|
|
|
|
|
|
|
|
|
|
fix_double_escape(escaped)
Fix double-escaped entities, such as &, {,
etc |
|
|
|
|
escape_once(html)
Escapes a given string without affecting existing escaped entities. |
|
|
|
|
options_for_select(container,
selected=None)
Creates select options from 'container' which can be a (list, tuple,
dict) If container is a list or tuple, then the text is the first
element in the entry and the value is the second element. |
|
|
|
|
options_for_select_from_dicts(container,
name_key,
value_key=None,
selected=None)
Creates select options from dicts in a container |
|
|
|
|
options_for_select_from_objects(container,
name_attr,
value_attr=None,
selected=None)
Creates select options from objects in a container |
|
|
|
|
| list_of_links(container,
**html_options) |
|
|
|
|
list_of_links_from_dicts(container,
name_key,
value_key=None,
**html_options)
Creates a list of links from dicts in a container |
|
|
|
|
list_of_links_from_objects(container,
name_attr,
value_attr=None,
**html_options)
Creates a list of links from objects in a container |
|
|
|
|
property_list(container,
**html_options)
Creates a table with property names/keys in the left column and
property values in the right column. |
|
|
|
|
property_list_from_dicts(container,
name_key,
value_key=None,
**html_options)
Create a property list from a list of dictionaries where each
dictionary contains a key-value pair. |
|
|
|
|
property_list_from_objects(container,
name_attr,
value_attr=None,
**html_options)
Create a property list from a list of objects where each object
contains a key-value pair. |
|
|