retval = Stencil (retval.extent_box (), expr);
}
- SCM id = get_property ("id");
- if (scm_is_string (id))
+ SCM attributes = get_property ("output-attributes");
+ if (scm_is_pair (attributes))
{
- SCM expr = scm_list_3 (ly_symbol2scm ("id"),
- id,
+ SCM expr = scm_list_3 (ly_symbol2scm ("output-attributes"),
+ attributes,
retval.expr ());
retval = Stencil (retval.extent_box (), expr);
"cause "
"color "
"cross-staff "
- "id "
"extra-offset "
"footnote-music "
"forced-spacing "
"horizontal-skylines "
+ "id "
"interfaces "
"layer "
"meta "
"minimum-X-extent "
"minimum-Y-extent "
+ "output-attributes "
"parenthesis-friends "
"pure-Y-offset-in-progress "
"rotation "
return stencil_traverser (trans, scm_caddr (expr));
else if (scm_is_eq (scm_car (expr), ly_symbol2scm ("transparent-stencil")))
return stencil_traverser (trans, scm_cadr (expr));
- else if (scm_is_eq (scm_car (expr), ly_symbol2scm ("id")))
+ else if (scm_is_eq (scm_car (expr), ly_symbol2scm ("output-attributes")))
return stencil_traverser (trans, scm_caddr (expr));
else
{
return;
}
- else if (scm_is_eq (head, ly_symbol2scm ("id")))
+ else if (scm_is_eq (head, ly_symbol2scm ("output-attributes")))
{
- SCM id = scm_cadr (expr);
+ SCM attributes = scm_cadr (expr);
- (*func) (func_arg, scm_list_2 (ly_symbol2scm ("start-enclosing-id-node"), id));
+ (*func) (func_arg, scm_list_2 (ly_symbol2scm ("start-group-node"),
+ ly_quote_scm (attributes)));
interpret_stencil_expression (scm_caddr (expr), func, func_arg, o);
- (*func) (func_arg, scm_list_1 (ly_symbol2scm ("end-enclosing-id-node")));
+ (*func) (func_arg, scm_list_1 (ly_symbol2scm ("end-group-node")));
return;
}
;;;
;;; i
;;;
- (id ,string? "An id string for the grob. Depending on the typestting
-backend being used, this id will be assigned to a group containing all of
-the stencils that comprise a given grob. For example, in the svg backend,
-the string will be assigned to the @code{id} attribute of a group (<g>)
-that encloses the stencils that comprise the grob. In the Postscript
-backend, as there is no way to group items, the setting of the id property
-will have no effect.")
+ (id ,string? "An id string for the grob.")
(ignore-ambitus ,boolean? "If set, don't consider this notehead
for ambitus calculation.")
(ignore-collision ,boolean? "If set, don't do note collision
;;;
;;; o
;;;
+ (output-attributes ,list? "An alist of attributes for the grob, to
+be included in output files. When the SVG typesetting backend is used,
+the attributes are assigned to a group (<g>) containing all of the
+stencils that comprise a given grob. For example,
+@code{'((id . 123) (class . foo) (data-whatever . @qq{bar}))} will produce
+@code{<g id=@qq{123} class=@qq{foo} data-whatever=@qq{bar}> @dots{} </g>}.
+In the Postscript backend, where there is no way to group items, the
+setting of the output-attributes property will have no effect.")
(outside-staff-horizontal-padding ,number? "By default, an
outside-staff-object can be placed so that is it very close to another
grob horizontally. If this property is set, the outside-staff-object
ellipse
embedded-ps
embedded-svg
- end-enclosing-id-node
+ end-group-node
glyph-string
grob-cause
named-glyph
setcolor
setrotation
setscale
- start-enclosing-id-node
+ start-group-node
text
unknown
url-link
combine-stencil
delay-stencil-evaluation
footnote
- id
+ output-attributes
rotate-stencil
scale-stencil
translate-stencil
"false")
radius thick))
-(define (start-enclosing-id-node s)
+(define (start-group-node attributes)
"")
-(define (end-enclosing-id-node)
+(define (end-group-node)
"")
(define (dashed-line thick on off dx dy phase)
"c = close"
(format #f "</~S>\n" entity))
-(define (start-enclosing-id-node s)
- (string-append "<g id=\"" s "\">\n"))
-
-(define (end-enclosing-id-node)
+(define (start-group-node attributes)
+ (define attributes-string
+ (string-concatenate
+ (map (lambda (item)
+ (ly:format " ~a=\"~a\"" (car item) (cdr item)))
+ attributes)))
+ (string-append "<g" attributes-string ">\n"))
+
+(define (end-group-node)
"</g>\n")
(define-public (comment s)