"""A separate 'My Reading' directory: every paper in MY_PAPERS, filed by landscape → branch (family) → subcategory, with links. Built from gen_landscape.build_data() + gen_vlm.build_data() (which carry data.mypapers). Run: .venv_robot_paradigms/bin/python gen_reading.py -> robot_reading.html """ import html as H import gen_landscape import gen_vlm def esc(t): return H.escape(str(t), quote=True) def render(): landscapes = [ ("🤖 Robot Learning", gen_landscape.build_data()), ("👁️ Vision-Language Models", gen_vlm.build_data()), ] total = 0 sections = [] for label, d in landscapes: byid = {p["id"]: p for p in d["paradigms"]} flabel = {f["key"]: f["label"] for f in d["families"]} fcolor = {f["key"]: f["color"] for f in d["families"]} order = [f["key"] for f in d["families"]] groups = {} for m in d.get("mypapers", []): node = m["node"] if node in byid: fk, method = byid[node]["family"], byid[node]["short"] else: fk, method = node, None groups.setdefault(fk, []).append((m, method)) if not groups: continue n = sum(len(v) for v in groups.values()) total += n cards = [] for fk in order: if fk not in groups: continue items = "" for (m, method) in groups[fk]: tag = ('%s' % esc(method)) if method \ else 'branch' note = ('%s' % esc(m["note"])) if m.get("note") else "" title = esc(m["title"]) link = ('%s ↗' % (esc(m["url"]), title)) \ if m.get("url") else title items += "
  • %s %s%s
  • " % (link, tag, note) cards.append('
    %s
    ' % (fcolor.get(fk, "#64748b"), esc(flabel.get(fk, fk)), items)) sections.append('

    %s %d

    ' '
    %s
    ' % (esc(label), n, "".join(cards))) body = "".join(sections) if sections else ( '
    No papers yet — send your reading list and each one will be filed here ' 'under its branch / subcategory.
    ') return TEMPLATE.replace("__TOTAL__", str(total)).replace("__BODY__", body) TEMPLATE = """ My Reading

    📚 My Reading

    Every paper I've read, filed by branch and subcategory. __TOTAL__ total. Click a title to open it.

    __BODY__ """ def main(): html = render() with open("robot_reading.html", "w", encoding="utf-8") as fh: fh.write(html) print("wrote robot_reading.html (%d chars)" % len(html)) if __name__ == "__main__": main()