import datetime, html from db import get_conn """ Build an HTML digest of the latest papers on a specific topic . Example: build_html(lookback_hours=48) """ def build_html(): today = datetime.date.today().isoformat() conn = get_conn() rows = conn.execute( "SELECT title, authors, summary, published " "FROM papers WHERE published >= ? " "ORDER BY published DESC" ) out = [ "", "", f"

Literature Digest — {today}

", "" ] for title, authors, summary, pub in rows: out += [ f"

{html.escape(title)}

", f"

Authors: {html.escape(authors)}
{pub[:10]}

", f"
{html.escape(summary)}
", "
" ] return "\n".join(out)