edit/page: input replacement of breaking space after abbreviations
authorMischa POSLAWSKY <perl@shiar.org>
Tue, 1 Dec 2020 02:54:24 +0000 (03:54 +0100)
committerMischa POSLAWSKY <perl@shiar.org>
Sat, 5 Dec 2020 00:41:21 +0000 (01:41 +0100)
Clean up rule to prevent line breaks after common name titles.

edit/page.js

index 4e389dbe624f0765ad66a31115016527085bdf2c..d1f16bf3c2b705d3323de6fb7963d010d5b0d440 100644 (file)
@@ -8,6 +8,8 @@ CKEDITOR.plugins.add('inlinesave', {
                                body = body.replace(/((?!<p>).{3})(?:\s|\u200B)+(?=<\/p>)/g, '$1');
                                // empty line is equivalent to a paragraph break
                                body = body.replace(/<br \/>\s*<br \/>/g, '<p>');
+                               // keep names and preceding abbreviations together
+                               body = body.replace(/\b((?:dhr|mw|me?vr|mr?s?)\.)\s+(?=[A-Z])/ig, '$1&nbsp;');
                                // wrap long line after each sentence
                                body = body.replace(/^(\t*).{73,}/mg, function (line, indent) {
                                        var dots = '(?:.{24,72}|.{73,}?)'; // chars before punctuation