brendonh/pyth — pull request #18 by Sets88 (2013-06-20 10:52:11+00:00)
Title: Added callback function to xhtml reader, which could be used to make absolute paths

Sometimes you need to dump html page and then save it to pdf, but it'll raise an exception, because of relative paths in urls
i added additional callback function, which user can use to make absolute paths in urls, same thing i've seen in pisa(https://pypi.python.org/pypi/pisa/)
here is simple example:

from pyth.plugins.xhtml.reader import XHTMLReader

content = """
text

link

text
"""

doc=XHTMLReader.read(content, link_callback=link_callback)
print str(doc.content[1].content)

That, what i needed:

[Text('[link]' {'url': u'http://domain.com/relative/path/to/something'})]