From: Michael Tremer Date: Sun, 31 Aug 2025 11:43:06 +0000 (+0000) Subject: generator: Implement better line wrapping in the table X-Git-Tag: 0.1~12 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c332afaefe54aaf6ebcc74935e35b34ae142d762;p=suricata-reporter.git generator: Implement better line wrapping in the table Sometimes the signature names are very long and we need to be able to wrap the next which is only possible by using Paragraph() inside the individual table cells. Signed-off-by: Michael Tremer --- diff --git a/src/suricata-report-generator.in b/src/suricata-report-generator.in index 40559b4..63d5584 100644 --- a/src/suricata-report-generator.in +++ b/src/suricata-report-generator.in @@ -74,6 +74,15 @@ class ReportGenerator(object): ) self.styles.add(centered) + # Add a smaller style for the table content + small = reportlab.lib.styles.ParagraphStyle( + name = "Small", + parent = self.styles["Normal"], + fontSize = 8, + leading = 10, + ) + self.styles.add(small) + def generate(self, output, year, month, week, day): """ Generates a PDF report. @@ -272,16 +281,26 @@ class ReportGenerator(object): # Append the row rows.append(( + # Time t.strftime("%H:%M:%S"), - "%s %s\n[%s:%s:%s] - %s" % ( - "*" * row.alert_severity, - row.alert_signature, - row.alert_gid, - row.alert_signature_id, - row.alert_rev, - row.alert_category, + + # Signature + reportlab.platypus.Paragraph( + "%s %s
[%s:%s:%s] - %s" % ( + "*" * row.alert_severity, + row.alert_signature, + row.alert_gid, + row.alert_signature_id, + row.alert_rev, + row.alert_category, + ), + self.styles["Small"], ), + + # Protocol row.protocol, + + # Source/Destination "%s:%s\n%s:%s" % ( row.source_address, (row.source_port or row.icmp_code), row.destination_address, (row.destination_port or row.icmp_type),