diff options
author | Paul Morris <paulwmorris@gmail.com> | 2016-09-18 11:32:05 -0400 |
---|---|---|
committer | Paul Morris <paulwmorris@gmail.com> | 2016-10-04 11:07:04 -0400 |
commit | f80e0f5e69fa8ffb35b6d3b7d162ed4191586c0c (patch) | |
tree | c5e8aabcec6892a64f17c7b74b196afe869f04fd /scm | |
parent | 71fa1bbb755d3ba14eea93394af88fa4a1092222 (diff) |
Issue 4974/1: Add output-attributes grob property
It is used for setting multiple attributes on <g>
nodes in SVG output, specified as an alist. The id
grob property is no longer used for this.
Diffstat (limited to 'scm')
-rw-r--r-- | scm/define-grob-properties.scm | 16 | ||||
-rw-r--r-- | scm/define-stencil-commands.scm | 6 | ||||
-rw-r--r-- | scm/output-ps.scm | 4 | ||||
-rw-r--r-- | scm/output-svg.scm | 13 |
4 files changed, 23 insertions, 16 deletions
diff --git a/scm/define-grob-properties.scm b/scm/define-grob-properties.scm index d55ab4c8c7..06358986b0 100644 --- a/scm/define-grob-properties.scm +++ b/scm/define-grob-properties.scm @@ -524,13 +524,7 @@ left and one to the right of this grob.") ;;; ;;; 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 @@ -720,6 +714,14 @@ different voices. Default value@tie{}1.") ;;; ;;; 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 diff --git a/scm/define-stencil-commands.scm b/scm/define-stencil-commands.scm index 7eb31a9600..23c17abb9b 100644 --- a/scm/define-stencil-commands.scm +++ b/scm/define-stencil-commands.scm @@ -29,7 +29,7 @@ defined in the output modules (@file{output-*.scm})." ellipse embedded-ps embedded-svg - end-enclosing-id-node + end-group-node glyph-string grob-cause named-glyph @@ -46,7 +46,7 @@ defined in the output modules (@file{output-*.scm})." setcolor setrotation setscale - start-enclosing-id-node + start-group-node text unknown url-link @@ -63,7 +63,7 @@ are used internally in @file{lily/@/stencil-interpret.cc}." combine-stencil delay-stencil-evaluation footnote - id + output-attributes rotate-stencil scale-stencil translate-stencil diff --git a/scm/output-ps.scm b/scm/output-ps.scm index 6d3ab63c2f..97909da80c 100644 --- a/scm/output-ps.scm +++ b/scm/output-ps.scm @@ -52,10 +52,10 @@ "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) diff --git a/scm/output-svg.scm b/scm/output-svg.scm index 78bda3c35b..653664122c 100644 --- a/scm/output-svg.scm +++ b/scm/output-svg.scm @@ -61,10 +61,15 @@ "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) |