custom line breaks more robust refs #21

This commit is contained in:
tux 2024-02-04 16:28:48 +01:00 committed by Christoph Wagner
parent a0f60bc1c7
commit e72efbd156

View File

@ -114,7 +114,16 @@
(make-custom-linebreaks
(cdr break-words)
(ly:regex-replace
(ly:make-regex (string-append "(" (ly:regex-replace (ly:make-regex "(.)") (car break-words) "(?: *,[^,)]+\\)" 1 "|\\(?" 1 ")") "(?: *,[^,)]+\\))?)(.*)$"))
(ly:make-regex
(string-append
"("
(string-concatenate
(map
(lambda (character)
(let ((escaped_char (ly:regex-quote (string character))))
(string-append "(?: *,[^,)]+\\)" escaped_char "|\\(?" escaped_char ")")))
(string->list (car break-words))))
"(?: *,[^,)]+\\))?)(.*)$"))
newtext
1 "\n" 2))))))