Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(3457)

Side by Side Diff: scm/markup.scm

Issue 7799048: Fix composition of markup lists containing markup command list calls (Closed)
Patch Set: Some comments, make robust about throw not actually happening Created 12 years ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « scm/ly-syntax-constructors.scm ('k') | scm/markup-macros.scm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 ;;;; This file is part of LilyPond, the GNU music typesetter. 1 ;;;; This file is part of LilyPond, the GNU music typesetter.
2 ;;;; 2 ;;;;
3 ;;;; Copyright (C) 2003--2012 Han-Wen Nienhuys <hanwen@xs4all.nl> 3 ;;;; Copyright (C) 2003--2012 Han-Wen Nienhuys <hanwen@xs4all.nl>
4 ;;;; 4 ;;;;
5 ;;;; LilyPond is free software: you can redistribute it and/or modify 5 ;;;; LilyPond is free software: you can redistribute it and/or modify
6 ;;;; it under the terms of the GNU General Public License as published by 6 ;;;; it under the terms of the GNU General Public License as published by
7 ;;;; the Free Software Foundation, either version 3 of the License, or 7 ;;;; the Free Software Foundation, either version 3 of the License, or
8 ;;;; (at your option) any later version. 8 ;;;; (at your option) any later version.
9 ;;;; 9 ;;;;
10 ;;;; LilyPond is distributed in the hope that it will be useful, 10 ;;;; LilyPond is distributed in the hope that it will be useful,
(...skipping 30 matching lines...) Expand all
41 (define (markup-join markups sep) 41 (define (markup-join markups sep)
42 "Return line-markup of MARKUPS, joining them with markup SEP" 42 "Return line-markup of MARKUPS, joining them with markup SEP"
43 (if (pair? markups) 43 (if (pair? markups)
44 (make-line-markup (list-insert-separator markups sep)) 44 (make-line-markup (list-insert-separator markups sep))
45 empty-markup)) 45 empty-markup))
46 46
47 47
48 (define-public interpret-markup ly:text-interface::interpret-markup) 48 (define-public interpret-markup ly:text-interface::interpret-markup)
49 49
50 (define-public (interpret-markup-list layout props markup-list) 50 (define-public (interpret-markup-list layout props markup-list)
51 (let ((stencils (list))) 51 ;; This relies on the markup list returned by a markup list command
52 (for-each (lambda (m) 52 ;; to be modifiable
53 (set! stencils 53 (reverse!
54 (if (markup-command-list? m) 54 (fold
55 (append! (reverse! (apply (car m) layout props (cdr m) )) 55 (lambda (m prev)
56 stencils) 56 (if (markup-command-list? m)
57 (cons (interpret-markup layout props m) stencils)))) 57 (reverse! (apply (car m) layout props (cdr m)) prev)
58 markup-list) 58 (cons (interpret-markup layout props m) prev)))
59 (reverse! stencils))) 59 '()
60 markup-list)))
60 61
61 (define-public (prepend-alist-chain key val chain) 62 (define-public (prepend-alist-chain key val chain)
62 (cons (acons key val (car chain)) (cdr chain))) 63 (cons (acons key val (car chain)) (cdr chain)))
63 64
64 (define-public (stack-stencil-line space stencils) 65 (define-public (stack-stencil-line space stencils)
65 "Adjoin a list of STENCILS along the X axis, leaving SPACE between the 66 "Adjoin a list of STENCILS along the X axis, leaving SPACE between the
66 end of each stencil and the reference point of the following stencil." 67 end of each stencil and the reference point of the following stencil."
67 (if (and (pair? stencils) 68 (if (and (pair? stencils)
68 (ly:stencil? (car stencils))) 69 (ly:stencil? (car stencils)))
69 70
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 (markup->string (ly:modules-lookup scopes var) (cons mod scopes)))) 144 (markup->string (ly:modules-lookup scopes var) (cons mod scopes))))
144 145
145 ;; ignore all other markup functions 146 ;; ignore all other markup functions
146 ((markup-function? (car m)) "") 147 ((markup-function? (car m)) "")
147 148
148 ;; handle markup lists 149 ;; handle markup lists
149 ((list? m) 150 ((list? m)
150 (string-join (map (lambda (mm) (markup->string mm scopes)) m) " ")) 151 (string-join (map (lambda (mm) (markup->string mm scopes)) m) " "))
151 152
152 (else "ERROR, unable to extract string from markup")))) 153 (else "ERROR, unable to extract string from markup"))))
OLDNEW
« no previous file with comments | « scm/ly-syntax-constructors.scm ('k') | scm/markup-macros.scm » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b