commit bcc1cab9357caaac928611cd6c130b425bce83ce from: Aleksey Ryndin date: Mon Sep 09 09:55:13 2024 UTC Add: render header of honk commit - e0f420c4ff20b5846f753c684667402baa8da73d commit + bcc1cab9357caaac928611cd6c130b425bce83ce blob - 079940967c9575fc031a1e80d8e71c1e84fb8cc3 blob + 98ee657e7dafdf04a7d7faf7aeb4e68becbb336b --- lonk.py +++ lonk.py @@ -188,11 +188,9 @@ class HtmlToGmi(HTMLParser): return self.stack[0] -def _format_honk(honk): - assert honk["Format"] == "html", honk +def _format_honk(honk, header): assert honk["Noise"] == honk["HTML"], honk - firts_line = f'## From: {honk.get("Oondle") or honk["Handle"]}, {honk["Date"]}' - lines = [firts_line, f'=> {honk["XID"]}', HtmlToGmi(_build_url()).feed(honk["Noise"])] + lines = [header, f'=> {honk["XID"]}', HtmlToGmi(_build_url()).feed(honk["HTML"])] for donk in (honk.get("Donks") or []): lines.append(f'=> {donk["URL"]}') @@ -213,10 +211,16 @@ def demo(): if honk.get("RID"): for honk_in_convoy in _load_from(action="gethonks", page="convoy", c=convoy)["honks"]: if not honk_in_convoy.get("RID"): - collected[convoy] = honk_in_convoy + header = f'## From: {honk["Handle"]}, {honk["Date"]} ๐Ÿงต' + collected[convoy] = (honk_in_convoy, header) break else: - collected[convoy] = honk + oondle = honk.get("Oondle") + if oondle: + header = f'## From: {oondle}, {honk["Date"]} (๐Ÿ” {honk["Handle"]})' + else: + header = f'## From: {honk["Handle"]}, {honk["Date"]}' + collected[convoy] = (honk, header) print("# ๐“— onk\n") line = f"=> {_build_url(path='atme')} @me" @@ -229,9 +233,9 @@ def demo(): line += f' ({home["chatcount"]})' print(line) - for honk in reversed(collected.values()): - print("\n") - print(_format_honk(honk)) + print() + for honk, header in reversed(collected.values()): + print(_format_honk(honk, header)) def create_schema(dbcon):