return BeautifulSoup(content, 'html.parser')
-def clean(html: BeautifulSoup) -> BeautifulSoup:
- for eb in html.find_all("div", class_="post-edit-box"):
- eb.decompose()
- for footer in html.find_all("div", class_="post-footer"):
- footer.decompose()
- return html
-
-
def replies(html: BeautifulSoup) -> Iterable[Tag]:
def text() -> Tag:
body = html.body
def process(spec: Spec) -> None:
- spec.texout.write(b'\\documentclass{article}\n\\begin{document}\n')
- html = clean(parse(spec.htmlfilter(spec.fetcher.fetch(spec.url))))
+ spec.texout.write(b'\\documentclass{article}\n')
+ if spec.geometry is not None:
+ spec.texout.write(b'\\usepackage[' +
+ spec.geometry.encode('UTF-8') +
+ b']{geometry}\n')
+ spec.texout.write(b'\\begin{document}\n')
+ html = parse(spec.htmlfilter(spec.fetcher.fetch(spec.url)))
for r in replies(html):
+ spec.domfilter(r)
spec.texout.write(spec.texifier.texify(r))
spec.texout.write(b'\\end{document}\n')