From ee641e73fa73ea6097b964a455344114f319c717 Mon Sep 17 00:00:00 2001 From: Steve Pothier Date: Fri, 27 Dec 2024 15:03:13 -0700 Subject: [PATCH] DM-48259 in review --- .../lsst/ts/logging_and_reporting/source_adapters.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/python/lsst/ts/logging_and_reporting/source_adapters.py b/python/lsst/ts/logging_and_reporting/source_adapters.py index f81a7b9..964d790 100644 --- a/python/lsst/ts/logging_and_reporting/source_adapters.py +++ b/python/lsst/ts/logging_and_reporting/source_adapters.py @@ -50,6 +50,7 @@ import copy import datetime as dt import itertools +import re import traceback from abc import ABC from collections import defaultdict @@ -509,7 +510,8 @@ def telescope(rec): for tele, g0 in itertools.groupby(recs, key=telescope): table.append(f"### Telescope: {tele}") for rec in g0: - msg = rec["summary"].strip() + # Replace 3 or more newlines with just two. + msg = re.sub(r"\n{3,}", "\n\n", rec["summary"].strip()) table.append(f"\n{msg}\n") crew_list = rec.get("observers_crew", []) @@ -711,7 +713,11 @@ def obs_date(rec): if new: msg = new else: - msg = rep.htmlcode(rec["message_text"].strip()) + + # Replace 3 or more newlines with just two. + msg = rep.htmlcode( + re.sub(r"\n{3,}", "\n\n", rec["message_text"].strip()) + ) mdstr += f"- {attrstr}" mdstr += "\n\n" + msg + "\n"