1
1
mirror of https://github.com/Kozea/WeasyPrint.git synced 2024-10-05 00:21:15 +03:00

Docstrings.

This commit is contained in:
Simon Sapin 2011-08-22 17:55:30 +02:00
parent 87c52957d6
commit a6ebeb9314

View File

@ -43,6 +43,10 @@ def get_replaced_element(element):
def register(tag):
"""
Return a decorator that registers a function handling replacements for
`tag` HTML elements.
"""
def decorator(function):
REPLACEMENT_HANDLERS[tag] = function
return function
@ -51,6 +55,9 @@ def register(tag):
@register('img')
def handle_img(element):
"""
Handle <img> tags: return either an image or the alt-text.
"""
# TODO: somehow use the alt-text on broken images.
src = get_url_attribute(element, 'src')
return ImageReplacement(src)