]> git.donarmstrong.com Git - lilypond.git/commitdiff
Issue 4809 Keep "\""-signs for graphviz
authorThomas Morley <thomasmorley65@gmail.com>
Tue, 15 Mar 2016 23:10:20 +0000 (00:10 +0100)
committerThomas Morley <thomasmorley65@gmail.com>
Thu, 31 Mar 2016 12:42:13 +0000 (14:42 +0200)
Transform them to "\\\""

ly/graphviz-init.ly

index 470faffa6ac36228222bb077a250e1fdb2e240cb..96f45ded93ccc3f784eeaea6e1ebe8a61764f2b1 100644 (file)
@@ -2,6 +2,8 @@
 
 #(use-modules (scm graphviz))
 
+#(use-modules (ice-9 regex))
+
 #(define last-grob-action '())
 
 #(define sym-blacklist '())
 
 #(define (grob-mod grob file line func prop val)
   (let* ((val-str (truncate-value val))
-         (label (format #f "~a\\n~a:~a\\n~a <- ~a" (grob::name grob) file line prop val-str)))
+         (label (format #f "~a\\n~a:~a\\n~a <- ~a" (grob::name grob) file line prop val-str))
+         ;; to keep escaped "\"" we need to transform it to "\\\""
+         ;; otherwise the final pdf-creation will break
+         (escaped-label
+           (regexp-substitute/global #f "\"" label 'pre "\\\"" 'post)))
    (if (relevant? grob file line prop)
-       (grob-event-node grob label file))))
+       (grob-event-node grob escaped-label file))))
 
 #(define (grob-cache grob prop callback value)
   (let* ((val-str (truncate-value value))