AUTHORS:
Converts a string to a safe/clean name by converting non-alphanumeric characters to underscores.
INPUT:
EXAMPLES:
sage: from sagenb.notebook.template import clean_name
sage: print clean_name('this!is@bad+string')
this_is_bad_string
Returns a string with all characters not legal in a css name replaced with hyphens (-).
INPUT:
EXAMPLES:
sage: from sagenb.notebook.template import css_escape
sage: css_escape('abcd')
'abcd'
sage: css_escape('12abcd')
'12abcd'
sage: css_escape(r'\'"abcd\'"')
'---abcd---'
sage: css_escape('my-invalid/identifier')
'my-invalid-identifier'
sage: css_escape(r'quotes"mustbe!escaped')
'quotes-mustbe-escaped'
Converts seconds to a meaningful string.
INPUT
Returns HTML, CSS, etc., for a template file rendered in the given context.
INPUT:
OUTPUT:
EXAMPLES:
sage: from sagenb.notebook.template import template
sage: s = template(os.path.join('html', 'yes_no.html')); type(s)
<type 'unicode'>
sage: 'Yes' in s
True
sage: u = unicode('Are Gröbner bases awesome?','utf-8')
sage: s = template(os.path.join('html', 'yes_no.html'), message=u)
sage: 'Gröbner' in s.encode('utf-8')
True