]> git.donarmstrong.com Git - lilypond.git/commitdiff
SVG backend: escape `<' and `&' in UTF-8 strings.
authorPatrick McCarty <pnorcks@gmail.com>
Wed, 14 Jul 2010 19:00:58 +0000 (12:00 -0700)
committerPatrick McCarty <pnorcks@gmail.com>
Wed, 14 Jul 2010 19:04:46 +0000 (12:04 -0700)
This is required to create valid SVG.  All other characters within
<text> or <tspan> elements are permitted.

scm/output-svg.scm

index 2a98529e75dfbb1bf5527c5b0336ddf35e18c739..654c3a36a1c9d4514c3959b3b1404ce0efe2be9f 100644 (file)
    (ec 'a)))
 
 (define (utf-8-string pango-font-description string)
-  (dispatch `(fontify ,pango-font-description ,(entity 'tspan string))))
+  (let ((escaped-string (string-regexp-substitute
+                         "<" "&lt;"
+                         (string-regexp-substitute "&" "&amp;" string))))
+  (dispatch `(fontify ,pango-font-description
+                     ,(entity 'tspan escaped-string)))))