Skip to content

Commit

Permalink
improved and allowed more tiny/html options
Browse files Browse the repository at this point in the history
  • Loading branch information
lvanderree committed Oct 19, 2011
1 parent 47cf9ac commit 425d71a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions mercury/static/mercury/stylesheets/structured.css
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ pre, code {
white-space: -moz-pre-wrap; /* Mozilla, since 1999 */
white-space: -o-pre-wrap; /* Opera 7 */
word-wrap: break-word; /* Internet Explorer 5.5+ */
display: block
}

dd.lot-eigenaar a {
Expand Down
12 changes: 11 additions & 1 deletion mercury/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
'abbr', 'acronym', 'blockquote',
'br',
'img',

'table', 'thead', 'tbody', 'tfoot', 'tr', 'th', 'td',
]

ALLOWED_ATTRIBUTES = {
Expand Down Expand Up @@ -40,6 +42,14 @@
'acronym': ['title'],

'img': ['class', 'src', 'alt', 'title', 'width', 'height'],

'table': ['class', 'style', 'border', 'cellspacing', 'cellpadding'],
'thead': ['class'],
'tbody': ['class'],
'tfoot': ['class'],
'tr': ['class'],
'th': ['class', 'scope', 'colspan'],
'td': ['class', 'scope', 'colspan'],
}

def sanitize(text, tags=ALLOWED_TAGS, attributes=ALLOWED_ATTRIBUTES):
Expand All @@ -51,4 +61,4 @@ def sanitize(text, tags=ALLOWED_TAGS, attributes=ALLOWED_ATTRIBUTES):

def tidy(text):
"sanitize wrapper in tidy interface"
return (sanitize(text), None, None) # TODO: return errors and warnings
return (sanitize(text), None, None) # TODO: return errors and warnings

0 comments on commit 425d71a

Please sign in to comment.