edit/page: nbsp after initials, not unrelated abbreviations
authorMischa POSLAWSKY <perl@shiar.org>
Mon, 11 Jan 2021 19:37:17 +0000 (20:37 +0100)
committerMischa POSLAWSKY <perl@shiar.org>
Mon, 11 Jan 2021 19:50:51 +0000 (20:50 +0100)
Case-sensitive match; fix space after "i.v.m." not "I.V.M.".

edit/page.js

index 34abe36c0e03dcf59f396f84cb6948fac49f036a..3101ea1c134317d3f57bc66cad0b68226e8559d6 100644 (file)
@@ -19,7 +19,7 @@ CKEDITOR.plugins.add('inlinesave', {
                                // 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;');
+                               body = body.replace(/\b((?:[Dd]hr|[Mm](?:w|e?vr|r|r?ss?)|[A-Z])\.)\s+(?=[A-Zdtv])/g, '$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