]> git.scottworley.com Git - paperdoorknob/blobdiff - paperdoorknob.py
Render links as footnotes
[paperdoorknob] / paperdoorknob.py
index 4e7cdf6840b8bbd7fb6a227db538bc9db9cde915..6a556753479b96f55c535f53a14d6c444822edf0 100644 (file)
@@ -34,7 +34,9 @@ def process(spec: Spec) -> None:
         spec.texout.write(b'\\usepackage[' +
                           spec.geometry.encode('UTF-8') +
                           b']{geometry}\n')
         spec.texout.write(b'\\usepackage[' +
                           spec.geometry.encode('UTF-8') +
                           b']{geometry}\n')
-    spec.texout.write(b'\\begin{document}\n')
+    spec.texout.write(b'''\\begin{document}
+\\newcommand{\\href}[2]{#2\\footnote{#1}}
+''')
     url = flatURL(spec.url)
     html = parse(spec.htmlfilter(spec.fetcher.fetch(url)))
     num_chunks = ilen(chunkDOMs(html))
     url = flatURL(spec.url)
     html = parse(spec.htmlfilter(spec.fetcher.fetch(url)))
     num_chunks = ilen(chunkDOMs(html))