X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=scm%2Fto-xml.scm;h=4db94a185250a7ba53e025f79cc2d07fde3275ef;hb=7533822f4cff54c8cb39ae96e0bff9f8b292c314;hp=a6b9508a6e442d029fbb2f6d9456a6c6f2f5f6e9;hpb=dccf66d6efc98f1c6e531fcdc3ee9b6016f9f504;p=lilypond.git diff --git a/scm/to-xml.scm b/scm/to-xml.scm index a6b9508a6e..4db94a1852 100644 --- a/scm/to-xml.scm +++ b/scm/to-xml.scm @@ -2,7 +2,7 @@ ;;;; ;;;; source file of the GNU LilyPond music typesetter ;;;; -;;;; (c) 2003--2004 Han-Wen Nienhuys +;;;; (c) 2003--2005 Han-Wen Nienhuys ;;;; Jan Nieuwenhuizen (use-modules (ice-9 regex) @@ -24,8 +24,8 @@ is then separated. - - + + " @@ -47,20 +47,19 @@ is then separated. (pitch . pitch) (duration . duration) (octave . octave) - (step . step) - )) + (step . step))) (define (musicxml-node->string node) (let ((xml-name (assoc-get (node-name node) node-names #f))) - (string-append - (if xml-name (open-tag xml-name '() '()) "") - (if (equal? (node-value node) "") - (string-append - (if xml-name "\n" "") - (apply string-append (map musicxml-node->string (node-children node)))) - (node-value node)) - (if xml-name (close-tag xml-name) "") - (if xml-name "\n" "")))) + (string-append + (if xml-name (open-tag xml-name '() '()) "") + (if (equal? (node-value node) "") + (string-append + (if xml-name "\n" "") + (apply string-append (map musicxml-node->string (node-children node)))) + (node-value node)) + (if xml-name (close-tag xml-name) "") + (if xml-name "\n" "")))) (define (xml-node->string node) (string-append @@ -106,7 +105,7 @@ is then separated. #:attributes `((octave . ,(ly:pitch-octave p)) (notename . ,(ly:pitch-notename p)) (alteration . ,(ly:pitch-alteration p))))) - + (define (music->xml-node music) (let* ((name (ly:music-property music 'name)) (e (ly:music-property music 'element)) @@ -136,8 +135,8 @@ is then separated. ]> ")) - - + + ;; as computed from input/trip.ly, by ;; http://www.pault.com/pault/dtdgenerator/ @@ -188,7 +187,7 @@ is then separated. (define (assert x) (if x #t - (error "assertion failed"))) + (ly:error (_ "assertion failed")))) (define (re-sub re to string) (regexp-substitute/global #f re string 'pre to 'post)) @@ -211,20 +210,16 @@ is then separated. (not (memq (car x) exceptions))) (define (dump-attr sym-val) - (let* - ( - (sym (car sym-val)) - (val (cdr sym-val)) - ) + (let* ((sym (car sym-val)) + (val (cdr sym-val))) - (string-append - "\n " - (symbol->string sym) - "=\"" - (let ((s (call-with-output-string (lambda (port) (display val port))))) - (re-sub-alist s xml-entities-alist)) - "\"" - ))) + (string-append + "\n " + (symbol->string sym) + "=\"" + (let ((s (call-with-output-string (lambda (port) (display val port))))) + (re-sub-alist s xml-entities-alist)) + "\""))) (string-append "<" (symbol->string tag)