From 7520cd583a92860e2a33ee0b3155fd1695cc21bf Mon Sep 17 00:00:00 2001
From: Moritz Bunkus <m.bunkus@linet.de>
Date: Tue, 23 Feb 2021 12:16:58 +0100
Subject: [PATCH] HTML zu LaTeX: gewisse kaputte Konstrukte vom CKEditor
 entfernen
MIME-Version: 1.0
Content-Type: text/plain; charset=utf8
Content-Transfer-Encoding: 8bit

Dazu gehören leere Listen <ul></ul> oder Paragraphen mit
Zeilenumbrüchen und non-breakable spaces <p><br><br>&nbsp;</p>
---
 SL/Template/LaTeX.pm | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/SL/Template/LaTeX.pm b/SL/Template/LaTeX.pm
index bc03eb3bb..293db2e18 100644
--- a/SL/Template/LaTeX.pm
+++ b/SL/Template/LaTeX.pm
@@ -83,6 +83,8 @@ sub _format_html {
   $content =~ s{ (?:\&nbsp;|\s)+ }{ }gx;
   $content =~ s{ (?:\&nbsp;|\s)+$ }{}gx;
   $content =~ s{ (?: <br/?> )+$ }{}gx;
+  $content =~ s{ <ul>\s*</ul> | <ol>\s*</ol> }{}igx;
+  $content =~ s{ (?: <p>\s*</p>\s* )+ \Z }{}imgx;
 
   my @parts = grep { $_ } map {
     if (substr($_, 0, 1) eq '<') {
-- 
2.20.1