From 69d9ee2f5c3e8f250b9a148a1322aefa288d7435 Mon Sep 17 00:00:00 2001 From: Carl Chang Date: Thu, 1 Feb 2024 07:50:49 +0100 Subject: [PATCH] Show event description (#56) Make use of the description property on events render it as html or as text in a span. --- neoteroi/mkdocs/projects/gantt/html.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/neoteroi/mkdocs/projects/gantt/html.py b/neoteroi/mkdocs/projects/gantt/html.py index c4deffa..8762dc4 100644 --- a/neoteroi/mkdocs/projects/gantt/html.py +++ b/neoteroi/mkdocs/projects/gantt/html.py @@ -419,6 +419,15 @@ def build_event(self, parent, event: Event): if event.icon: build_icon_html(dot_element, event.icon) + if event.description: + try: + des = etree.fromstring(event.description) + except etree.ParseError: + des = etree.fromstring(f"{event.description}") + + des.set("class", f"description {des.get('class') or ''}") + dot_element.append(des) + def _calc_time_left(self, time: Union[date, datetime]) -> float: delta = ( time