add a base element to deal with relative urls for images and links

workspace
Brendan Howell 3 years ago
parent 564232d109
commit 565f3a9d83

@ -461,21 +461,12 @@ class Bureau(object):
# use an URL fetcher that waits 30s instead of 10s
def slowfetch(url, timeout=30, ssl_context=None):
if len(url) < 50:
print("fetching", url)
import time
start = time.time()
ret = weasyprint.default_url_fetcher(url, 30, ssl_context)
elapsed = time.time() - start
if len(url) < 50:
print("fetched", url, "in", elapsed)
return ret
html_rendered = weasyprint.HTML(url_fetcher=slowfetch,
string=templ.render_unicode(**kwargs))
print("log level:", str(self.log.getEffectiveLevel()))
print("config:", self.config)
if self.log.getEffectiveLevel() == logging.DEBUG:
with open("/tmp/debug.html", "w") as html_out:
html_out.write(templ.render_unicode(**kwargs))

@ -2,6 +2,7 @@
<html>
<title>${title}</title>
<meta charset="utf-8">
<base href="${url}">
<style type="text/css">
@media print {
@page {

@ -161,7 +161,7 @@ class Publications(Bureau):
break
prn.ln()
prn.cut()
prn.close()
self._free_small_printer(prn)
@add_command("r", "Print a web page for reading")
def print_url(self, data):

Loading…
Cancel
Save